View serializer.js
// jscs:disable requireSpread
import V2Serializer from './v2';
import Ember from 'ember';
export default V2Serializer.extend({
_normalizeBossAndAssistant(resourceObject, object) {
let bosses = window.server.schema.employeeAssistants.where({
assistantId: object.id
}).models.mapBy('employee');
View mirage-migrator.js
/**
* npm install inflected
* find . -type f | xargs perl -pi -e 's/all\(\)\.length/all\(\)\.models\.length/g'
* find . -type f | xargs perl -pi -e 's/all\(\)\.forEach/all\(\)\.models\.forEach/g'
toArray
* $ jscodeshift -t mirage-migrator.js tests/acceptance
*/
View example29.sh
curl -X GET http://localhost:3000/friends\
--data-urlencode 'page[page]=1'\
--data-urlencode 'page[limit]=1' | jq
View example28.sh
curl -X GET http://localhost:3000/friends\
--data-urlencode 'filter[first-name]=Cyril'\
| jq '.data | map (.attributes."first-name")'
View example27.sh
curl -X GET http://localhost:3000/friends\
--data-urlencode 'filter[id]=2,3' | jq '.data | map(.id)'
View example26.sh
curl http://localhost:3000/friends?sort=-id,first-name\
| jq '.data | map(.attributes)'
View example25.sh
curl http://localhost:3000/friends?sort=-first-name\
| jq '.data | map(.attributes)'
View example24.sh
curl http://localhost:3000/friends?sort=first-name\
| jq '.data | map(.attributes)'
View example23.sh
curl -X GET http://localhost:3000/friends/2?include=loans.article\
--data-urlencode 'fields[friends]=first-name,last-name' \
--data-urlencode 'fields[loans]=id,notes' \
--data-urlencode 'fields[articles]=id' | jq
View example22.sh
curl -X GET http://localhost:3000/friends/2\
--data-urlencode 'fields[friends]=first-name,last-name' | jq