Skip to content

Commit

Permalink
feat: seperate querying for entries and assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Khaledgarbaya committed Dec 1, 2017
1 parent 21dde2f commit 8eebbaa
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/get/get-full-source-space.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export default function getFullSourceSpace ({
includeDrafts,
maxAllowedLimit,
listrOptions,
query
queryEntries,
queryAssets
}) {
pageLimit = maxAllowedLimit || MAX_ALLOWED_LIMIT
listrOptions = listrOptions || {
Expand Down Expand Up @@ -73,7 +74,7 @@ export default function getFullSourceSpace ({
title: 'Fetching content entries data',
task: (ctx, task) => {
const teardownTaskListeners = logToTaskOutput(task)
return pagedGet({space: ctx.space, method: 'getEntries', query})
return pagedGet({space: ctx.space, method: 'getEntries', query: queryEntries})
.then(extractItems)
.then(sortEntries)
.then((items) => filterDrafts(items, includeDrafts))
Expand All @@ -87,11 +88,8 @@ export default function getFullSourceSpace ({
{
title: 'Fetching assets data',
task: (ctx, task) => {
const assetsQuery = Object.assign({}, query)
// no content_type query for the assets endpoint
delete assetsQuery.content_type
const teardownTaskListeners = logToTaskOutput(task)
return pagedGet({space: ctx.space, method: 'getAssets', assetsQuery})
return pagedGet({space: ctx.space, method: 'getAssets', query: queryAssets})
.then(extractItems)
.then((items) => {
ctx.data.assets = items
Expand Down

0 comments on commit 8eebbaa

Please sign in to comment.