mirror of
https://github.com/documize/community.git
synced 2025-07-25 16:19:46 +02:00
Tweak format of returned data
This commit is contained in:
parent
052ffa3090
commit
19f77855fd
5 changed files with 33 additions and 12 deletions
|
@ -3,9 +3,11 @@ import JSONAPISerializer from 'ember-data/serializers/json-api';
|
||||||
export default JSONAPISerializer.extend({
|
export default JSONAPISerializer.extend({
|
||||||
normalize(modelClass, resourceHash) {
|
normalize(modelClass, resourceHash) {
|
||||||
return {
|
return {
|
||||||
id: resourceHash.id,
|
data: {
|
||||||
type: modelClass.modelName,
|
id: resourceHash.id,
|
||||||
attributes: resourceHash
|
type: modelClass.modelName,
|
||||||
|
attributes: resourceHash
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,9 +3,11 @@ import ApplicationSerializer from './application';
|
||||||
export default ApplicationSerializer.extend({
|
export default ApplicationSerializer.extend({
|
||||||
normalize(modelClass, resourceHash) {
|
normalize(modelClass, resourceHash) {
|
||||||
return {
|
return {
|
||||||
id: resourceHash.userId ? resourceHash.userId : 'public',
|
data: {
|
||||||
type: modelClass.modelName,
|
id: resourceHash.userId ? resourceHash.userId : 0,
|
||||||
attributes: resourceHash
|
type: modelClass.modelName,
|
||||||
|
attributes: resourceHash
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,9 +3,11 @@ import ApplicationSerializer from './application';
|
||||||
export default ApplicationSerializer.extend({
|
export default ApplicationSerializer.extend({
|
||||||
normalize(modelClass, resourceHash) {
|
normalize(modelClass, resourceHash) {
|
||||||
return {
|
return {
|
||||||
id: resourceHash.id ? resourceHash.id : resourceHash.documentId,
|
data: {
|
||||||
type: modelClass.modelName,
|
id: resourceHash.id ? resourceHash.id : resourceHash.documentId,
|
||||||
attributes: resourceHash
|
type: modelClass.modelName,
|
||||||
|
attributes: resourceHash
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,9 +3,11 @@ import ApplicationSerializer from './application';
|
||||||
export default ApplicationSerializer.extend({
|
export default ApplicationSerializer.extend({
|
||||||
normalize(modelClass, resourceHash) {
|
normalize(modelClass, resourceHash) {
|
||||||
return {
|
return {
|
||||||
id: resourceHash.id ? resourceHash.id : resourceHash.documentId,
|
data: {
|
||||||
type: modelClass.modelName,
|
id: resourceHash.id ? resourceHash.id : resourceHash.documentId,
|
||||||
attributes: resourceHash
|
type: modelClass.modelName,
|
||||||
|
attributes: resourceHash
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
13
app/app/serializers/user.js
Normal file
13
app/app/serializers/user.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import ApplicationSerializer from './application';
|
||||||
|
|
||||||
|
export default ApplicationSerializer.extend({
|
||||||
|
normalize(modelClass, resourceHash) {
|
||||||
|
return {
|
||||||
|
data: {
|
||||||
|
id: resourceHash.id ? resourceHash.id : 0,
|
||||||
|
type: modelClass.modelName,
|
||||||
|
attributes: resourceHash
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue