Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1007 from parameter1/magazine-sort
Browse files Browse the repository at this point in the history
Add sort parameter to magazineScheduledContent
  • Loading branch information
brandonbk authored Nov 9, 2024
2 parents 1920ddc + a7966c0 commit 4f4f230
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ input MagazineScheduledContentQueryInput {
excludeContentTypes: [ContentType!] = []
includeContentTypes: [ContentType!] = []
requiresImage: Boolean = false
sort: ContentSortInput = {}
pagination: PaginationInput = {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1361,11 +1361,13 @@ module.exports = {

if (requiresImage) query.primaryImage = { $exists: true };

const sort = input.sort.field ? input.sort : { field: 'published', order: 'desc' };

const projection = connectionProjection(info);
return basedb.paginate('platform.Content', {
query,
projection,
sort: { field: 'published', order: 'desc' },
sort,
...pagination,
});
},
Expand Down

0 comments on commit 4f4f230

Please sign in to comment.