mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 17:00:55 +00:00
Merge pull request #1266 from johannpinson/patch-graphql-timestamp
Change names for timestamp fields in GraphQL plugin
This commit is contained in:
commit
2844d34ad1
@ -407,15 +407,15 @@ module.exports = {
|
|||||||
// Add timestamps attributes.
|
// Add timestamps attributes.
|
||||||
if (_.get(model, 'options.timestamps') === true) {
|
if (_.get(model, 'options.timestamps') === true) {
|
||||||
Object.assign(initialState, {
|
Object.assign(initialState, {
|
||||||
created_at: 'String',
|
createdAt: 'String',
|
||||||
updated_at: 'String'
|
updatedAt: 'String'
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.assign(acc.resolver[globalId], {
|
Object.assign(acc.resolver[globalId], {
|
||||||
created_at: (obj, options, context) => { // eslint-disable-line no-unused-vars
|
createdAt: (obj, options, context) => { // eslint-disable-line no-unused-vars
|
||||||
return obj.createdAt || obj.created_at;
|
return obj.createdAt || obj.created_at;
|
||||||
},
|
},
|
||||||
updated_at: (obj, options, context) => { // eslint-disable-line no-unused-vars
|
updatedAt: (obj, options, context) => { // eslint-disable-line no-unused-vars
|
||||||
return obj.updatedAt || obj.updated_at;
|
return obj.updatedAt || obj.updated_at;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user