From a9bb76c113161dd39f592d4501cd16352f4247b8 Mon Sep 17 00:00:00 2001 From: Brandon Krigbaum Date: Sat, 9 Nov 2024 11:17:58 -0600 Subject: [PATCH 1/2] Add sort parameter to magazineScheduledContent --- .../graphql-server/src/graphql/resolvers/platform/content.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/graphql-server/src/graphql/resolvers/platform/content.js b/services/graphql-server/src/graphql/resolvers/platform/content.js index 13583412f..cdfe9c173 100644 --- a/services/graphql-server/src/graphql/resolvers/platform/content.js +++ b/services/graphql-server/src/graphql/resolvers/platform/content.js @@ -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, }); }, From a7966c07009e58150dcf2c91842bd2ca1c7b3e6d Mon Sep 17 00:00:00 2001 From: Brandon Krigbaum Date: Sat, 9 Nov 2024 16:45:08 -0600 Subject: [PATCH 2/2] Add sort to MagazineScheduledContentQueryInput --- .../src/graphql/definitions/platform/content/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/services/graphql-server/src/graphql/definitions/platform/content/index.js b/services/graphql-server/src/graphql/definitions/platform/content/index.js index 3ce0e3c8a..726b012b5 100644 --- a/services/graphql-server/src/graphql/definitions/platform/content/index.js +++ b/services/graphql-server/src/graphql/definitions/platform/content/index.js @@ -663,6 +663,7 @@ input MagazineScheduledContentQueryInput { excludeContentTypes: [ContentType!] = [] includeContentTypes: [ContentType!] = [] requiresImage: Boolean = false + sort: ContentSortInput = {} pagination: PaginationInput = {} }