Merge pull request #11592 from strapi/v4/graphql-remove-manually-added-timestamps

[V4] GraphQL - Remove Manually Added Timestamps
This commit is contained in:
Alexandre BODIN 2021-11-16 14:57:10 +01:00 committed by GitHub
commit e40aa0c99e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -275,10 +275,9 @@ module.exports = context => {
isRelation,
} = utils.attributes;
const { attributes, modelType, options = {} } = contentType;
const { attributes, modelType } = contentType;
const attributesKey = Object.keys(attributes);
const hasTimestamps = isArray(options.timestamps);
const name = (modelType === 'component' ? getComponentName : getTypeName).call(
null,
@ -293,17 +292,7 @@ module.exports = context => {
t.nonNull.id('id');
}
// 1. Timestamps
// 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
*
* Attributes can be of 7 different kind:
* - Scalar