From f4bc56b1af0205ac809ae7ba48dea682ea07bc7c Mon Sep 17 00:00:00 2001 From: Convly Date: Tue, 16 Nov 2021 14:04:57 +0100 Subject: [PATCH] Remove manually added timestamps from graphql types definition --- .../graphql/server/services/builders/type.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/plugins/graphql/server/services/builders/type.js b/packages/plugins/graphql/server/services/builders/type.js index 2396ced321..b0022118ab 100644 --- a/packages/plugins/graphql/server/services/builders/type.js +++ b/packages/plugins/graphql/server/services/builders/type.js @@ -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