mirror of
https://github.com/strapi/strapi.git
synced 2025-08-01 21:36:25 +00:00
Merge pull request #11592 from strapi/v4/graphql-remove-manually-added-timestamps
[V4] GraphQL - Remove Manually Added Timestamps
This commit is contained in:
commit
e40aa0c99e
@ -275,10 +275,9 @@ module.exports = context => {
|
|||||||
isRelation,
|
isRelation,
|
||||||
} = utils.attributes;
|
} = utils.attributes;
|
||||||
|
|
||||||
const { attributes, modelType, options = {} } = contentType;
|
const { attributes, modelType } = contentType;
|
||||||
|
|
||||||
const attributesKey = Object.keys(attributes);
|
const attributesKey = Object.keys(attributes);
|
||||||
const hasTimestamps = isArray(options.timestamps);
|
|
||||||
|
|
||||||
const name = (modelType === 'component' ? getComponentName : getTypeName).call(
|
const name = (modelType === 'component' ? getComponentName : getTypeName).call(
|
||||||
null,
|
null,
|
||||||
@ -293,17 +292,7 @@ module.exports = context => {
|
|||||||
t.nonNull.id('id');
|
t.nonNull.id('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Timestamps
|
/** Attributes
|
||||||
// If the content type has timestamps enabled
|
|
||||||
// then we should add the corresponding attributes in the definition
|
|
||||||
if (hasTimestamps) {
|
|
||||||
const [createdAtKey, updatedAtKey] = contentType.options.timestamps;
|
|
||||||
|
|
||||||
t.nonNull.dateTime(createdAtKey);
|
|
||||||
t.nonNull.dateTime(updatedAtKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 2. Attributes
|
|
||||||
*
|
*
|
||||||
* Attributes can be of 7 different kind:
|
* Attributes can be of 7 different kind:
|
||||||
* - Scalar
|
* - Scalar
|
||||||
|
Loading…
x
Reference in New Issue
Block a user