refactor(contentful): only include till the level we actually need

This commit is contained in:
Benedikt Rötsch
2018-02-20 13:11:08 +01:00
committed by Benedikt Rötsch
parent 82a9a48d86
commit 0bb53d8295

View File

@@ -75,7 +75,7 @@ module.exports.getCourses = throwOnEmptyResult('Course', (locale = 'en-US', api
content_type: 'course', content_type: 'course',
locale, locale,
order: '-sys.createdAt', // Ordering the entries by creation date order: '-sys.createdAt', // Ordering the entries by creation date
include: 6 // We use include param to increase the link level, the include value goes from 1 to 6 include: 1 // We use include param to increase the link level, the include value goes from 1 to 6
}) })
.then((response) => response.items) .then((response) => response.items)
}) })
@@ -94,7 +94,7 @@ module.exports.getLandingPage = (slug, locale = 'en-US', api = 'cda') => {
content_type: 'layout', content_type: 'layout',
locale, locale,
'fields.slug': slug, 'fields.slug': slug,
include: 6 include: 3
}) })
.then((response) => response.items[0]) .then((response) => response.items[0])
} }
@@ -113,7 +113,7 @@ module.exports.getCourse = throwOnEmptyResult('Course', (slug, locale = 'en-US',
content_type: 'course', content_type: 'course',
'fields.slug': slug, 'fields.slug': slug,
locale, locale,
include: 6 include: 2
}) })
.then((response) => response.items[0]) .then((response) => response.items[0])
}) })
@@ -139,7 +139,7 @@ module.exports.getCoursesByCategory = throwOnEmptyResult('Category', (category,
'fields.categories.sys.id': category, 'fields.categories.sys.id': category,
locale, locale,
order: '-sys.createdAt', order: '-sys.createdAt',
include: 6 include: 1
}) })
.then((response) => response.items) .then((response) => response.items)
}) })