Fix requests payload
This commit is contained in:
parent
e8f2e5ae97
commit
2be45cdc18
|
@ -1,11 +0,0 @@
|
||||||
`import Ember from 'ember'`
|
|
||||||
`import ApplicationSerializer from 'travis/serializers/application'`
|
|
||||||
|
|
||||||
Serializer = ApplicationSerializer.extend
|
|
||||||
attrs: {
|
|
||||||
branch_name: { key: 'branch' }
|
|
||||||
tag_name: { key: 'tag' }
|
|
||||||
repo: { key: 'repository_id' }
|
|
||||||
}
|
|
||||||
|
|
||||||
`export default Serializer`
|
|
35
app/serializers/request.js
Normal file
35
app/serializers/request.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import Ember from 'ember';
|
||||||
|
import V2FallbackSerializer from 'travis/serializers/v2_fallback';
|
||||||
|
|
||||||
|
var Serializer = V2FallbackSerializer.extend({
|
||||||
|
isNewSerializerAPI: true,
|
||||||
|
attrs: {
|
||||||
|
branch_name: { key: 'branch' },
|
||||||
|
tag_name: { key: 'tag' }
|
||||||
|
},
|
||||||
|
|
||||||
|
keyForV2Relationship: function(key, typeClass, method) {
|
||||||
|
if (key === 'repo') {
|
||||||
|
return 'repository_id';
|
||||||
|
} else {
|
||||||
|
return this._super.apply(this, arguments);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
normalizeArrayResponse: function(store, primaryModelClass, payload, id, requestType) {
|
||||||
|
var result;
|
||||||
|
if (payload.commits) {
|
||||||
|
payload.requests.forEach(function(request) {
|
||||||
|
var commit, commit_id;
|
||||||
|
commit_id = request.commit_id;
|
||||||
|
if (commit = payload.commits.findBy('id', commit_id)) {
|
||||||
|
request.commit = commit;
|
||||||
|
return delete request.commit_id;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return this._super.apply(this, arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Serializer;
|
Loading…
Reference in New Issue
Block a user