summaryrefslogtreecommitdiffstats
path: root/src/services
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-05-23 14:07:02 +0200
committerArmand Philippot <git@armandphilippot.com>2022-05-23 16:00:13 +0200
commit34e216546151eaf8a0a3cbb0bc8b65dae4c63bf2 (patch)
treebff34f8a1dc65f0559ddf851433f242edb092824 /src/services
parent0f8f963ba3eccd7fd94785bf7fb216b6287cec57 (diff)
refactor: reduce the number of data transformation
Diffstat (limited to 'src/services')
-rw-r--r--src/services/graphql/articles.query.ts7
-rw-r--r--src/services/graphql/articles.ts3
-rw-r--r--src/services/graphql/thematics.query.ts9
-rw-r--r--src/services/graphql/thematics.ts1
-rw-r--r--src/services/graphql/topics.query.ts9
-rw-r--r--src/services/graphql/topics.ts1
6 files changed, 1 insertions, 29 deletions
diff --git a/src/services/graphql/articles.query.ts b/src/services/graphql/articles.query.ts
index 7bd0901..3e1f575 100644
--- a/src/services/graphql/articles.query.ts
+++ b/src/services/graphql/articles.query.ts
@@ -56,7 +56,6 @@ export const articleBySlugQuery = `query PostBy($slug: ID!) {
}
}
info {
- readingTime
wordsCount
}
modified
@@ -90,11 +89,6 @@ export const articlesQuery = `query Articles($after: String = "", $first: Int =
}
}
}
- author {
- node {
- name
- }
- }
commentCount
contentParts {
beforeMore
@@ -113,7 +107,6 @@ export const articlesQuery = `query Articles($after: String = "", $first: Int =
}
}
info {
- readingTime
wordsCount
}
modified
diff --git a/src/services/graphql/articles.ts b/src/services/graphql/articles.ts
index f130872..f0ba4e4 100644
--- a/src/services/graphql/articles.ts
+++ b/src/services/graphql/articles.ts
@@ -71,13 +71,12 @@ export const getArticleFromRawData = (data: RawArticle): Article => {
id: databaseId,
intro: contentParts.beforeMore,
meta: {
- author: getAuthorFromRawData(author.node, 'page'),
+ author: author && getAuthorFromRawData(author.node, 'page'),
commentsCount: commentCount || 0,
cover: featuredImage?.node
? getImageFromRawData(featuredImage.node)
: undefined,
dates: { publication: date, update: modified },
- readingTime: info.readingTime,
seo: {
description: seo?.metaDesc || '',
title: seo?.title || '',
diff --git a/src/services/graphql/thematics.query.ts b/src/services/graphql/thematics.query.ts
index 3b3ebd6..5a82133 100644
--- a/src/services/graphql/thematics.query.ts
+++ b/src/services/graphql/thematics.query.ts
@@ -15,13 +15,6 @@ export const thematicBySlugQuery = `query ThematicBy($slug: ID!) {
}
}
}
- author {
- node {
- gravatarUrl
- name
- url
- }
- }
commentCount
contentParts {
beforeMore
@@ -40,7 +33,6 @@ export const thematicBySlugQuery = `query ThematicBy($slug: ID!) {
}
}
info {
- readingTime
wordsCount
}
modified
@@ -67,7 +59,6 @@ export const thematicBySlugQuery = `query ThematicBy($slug: ID!) {
}
}
info {
- readingTime
wordsCount
}
modified
diff --git a/src/services/graphql/thematics.ts b/src/services/graphql/thematics.ts
index e526db8..fd9d9f5 100644
--- a/src/services/graphql/thematics.ts
+++ b/src/services/graphql/thematics.ts
@@ -117,7 +117,6 @@ export const getThematicFromRawData = (data: RawThematic): Thematic => {
? getImageFromRawData(featuredImage.node)
: undefined,
dates: { publication: date, update: modified },
- readingTime: info.readingTime,
seo: {
description: seo?.metaDesc || '',
title: seo?.title || '',
diff --git a/src/services/graphql/topics.query.ts b/src/services/graphql/topics.query.ts
index 4574256..57b2569 100644
--- a/src/services/graphql/topics.query.ts
+++ b/src/services/graphql/topics.query.ts
@@ -16,13 +16,6 @@ export const topicBySlugQuery = `query TopicBy($slug: ID!) {
}
}
}
- author {
- node {
- gravatarUrl
- name
- url
- }
- }
commentCount
contentParts {
beforeMore
@@ -41,7 +34,6 @@ export const topicBySlugQuery = `query TopicBy($slug: ID!) {
}
}
info {
- readingTime
wordsCount
}
modified
@@ -68,7 +60,6 @@ export const topicBySlugQuery = `query TopicBy($slug: ID!) {
}
}
info {
- readingTime
wordsCount
}
modified
diff --git a/src/services/graphql/topics.ts b/src/services/graphql/topics.ts
index 3c92442..277580f 100644
--- a/src/services/graphql/topics.ts
+++ b/src/services/graphql/topics.ts
@@ -119,7 +119,6 @@ export const getTopicFromRawData = (data: RawTopic): Topic => {
: undefined,
dates: { publication: date, update: modified },
website: acfTopics.officialWebsite,
- readingTime: info.readingTime,
seo: {
description: seo?.metaDesc || '',
title: seo?.title || '',