diff --git a/graphql/resolvers/workspaceResolver.js b/graphql/resolvers/workspaceResolver.js index 20685d2d0..8128177ad 100644 --- a/graphql/resolvers/workspaceResolver.js +++ b/graphql/resolvers/workspaceResolver.js @@ -118,11 +118,11 @@ module.exports = { * @param {{ loaders: { articles } }} context * @returns {Promise<*>} */ - async articles (workspace, _args, context) { - const articles = (await Promise.all(workspace.articles.map((articleId) => context.loaders.articles.load(articleId)))) - .filter((a) => a !== undefined) // remove deleted articles - articles.sort((a, b) => a.createdAt > b.createdAt ? -1 : 1) - return Article.complete(articles, context.loaders) + async articles(workspace, _args, context) { + return Article.getArticles({ + filter: { _id: { $in: workspace.articles } }, + loaders: context.loaders, + }) }, async corpus(workspace) {