Merge pull request #17222 from strapi/feature/workflow-return-count-in-meta

This commit is contained in:
Marc Roig 2023-07-07 10:56:02 +02:00 committed by GitHub
commit 5f46fc52a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,16 +121,15 @@ module.exports = {
); );
const { populate, filters, sort } = await sanitizedQuery.read(query); const { populate, filters, sort } = await sanitizedQuery.read(query);
const workflows = await workflowService.find({ const [workflows, workflowCount] = await Promise.all([
populate, workflowService.find({ populate, filters, sort }),
filters, workflowService.count(),
sort, ]);
});
ctx.body = { ctx.body = {
data: await mapAsync(workflows, sanitizeOutput), data: await mapAsync(workflows, sanitizeOutput),
meta: { meta: {
workflowCount: workflows.length, workflowCount,
}, },
}; };
}, },