Convert job serializer to js
This commit is contained in:
parent
cbe5d7ac34
commit
0885052537
|
@ -1,24 +0,0 @@
|
||||||
`import Ember from 'ember'`
|
|
||||||
`import V2FallbackSerializer from 'travis/serializers/v2_fallback'`
|
|
||||||
|
|
||||||
Serializer = V2FallbackSerializer.extend
|
|
||||||
isNewSerializerAPI: true
|
|
||||||
attrs: {
|
|
||||||
_config: { key: 'config' }
|
|
||||||
_finished_at: { key: 'finished_at' }
|
|
||||||
_started_at: { key: 'started_at' }
|
|
||||||
}
|
|
||||||
|
|
||||||
keyForV2Relationship: (key, typeClass, method) ->
|
|
||||||
if key == 'repo'
|
|
||||||
'repository_id'
|
|
||||||
else
|
|
||||||
@_super.apply(this, arguments)
|
|
||||||
|
|
||||||
normalize: (modelClass, resourceHash) ->
|
|
||||||
if resourceHash.commit
|
|
||||||
resourceHash.commit['type'] = 'commit'
|
|
||||||
|
|
||||||
@_super(modelClass, resourceHash)
|
|
||||||
|
|
||||||
`export default Serializer`
|
|
29
app/serializers/job.js
Normal file
29
app/serializers/job.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
import Ember from 'ember';
|
||||||
|
import V2FallbackSerializer from 'travis/serializers/v2_fallback';
|
||||||
|
|
||||||
|
var Serializer = V2FallbackSerializer.extend({
|
||||||
|
isNewSerializerAPI: true,
|
||||||
|
attrs: {
|
||||||
|
_config: { key: 'config' },
|
||||||
|
_finished_at: { key: 'finished_at' },
|
||||||
|
_started_at: { key: 'started_at' }
|
||||||
|
},
|
||||||
|
|
||||||
|
keyForV2Relationship(key, typeClass, method) {
|
||||||
|
if (key === 'repo') {
|
||||||
|
return 'repository_id';
|
||||||
|
} else {
|
||||||
|
return this._super.apply(this, arguments);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
normalize(modelClass, resourceHash) {
|
||||||
|
if (resourceHash.commit) {
|
||||||
|
resourceHash.commit['type'] = 'commit';
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._super(modelClass, resourceHash);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Serializer;
|
Loading…
Reference in New Issue
Block a user