Properly normalize array repsonse for V2 jobs

This commit is contained in:
Piotr Sarnacki 2015-12-23 17:57:32 +01:00
parent 0885052537
commit c9bfb0c05e

View File

@ -23,7 +23,24 @@ var Serializer = V2FallbackSerializer.extend({
}
return this._super(modelClass, resourceHash);
}
},
normalizeArrayResponse: function(store, primaryModelClass, payload, id, requestType) {
var result;
if (payload.commits) {
payload.jobs.forEach(function(job) {
var commit, commit_id;
commit_id = job.commit_id;
if (commit = payload.commits.findBy('id', commit_id)) {
job.commit = commit;
return delete job.commit_id;
}
});
}
return this._super.apply(this, arguments);
},
});
export default Serializer;