feat: return workflow count

This commit is contained in:
Marc-Roig 2023-07-04 16:39:11 +02:00
parent 904ac46808
commit 83aefda65a
No known key found for this signature in database
GPG Key ID: FB4E2C43A0BEE249

View File

@ -145,10 +145,15 @@ module.exports = {
const { populate } = await sanitizedQuery.read(query); const { populate } = await sanitizedQuery.read(query);
const workflowService = getService('workflows'); const workflowService = getService('workflows');
const workflow = await workflowService.findById(id, { populate });
const [workflow, workflowCount] = await Promise.all([
workflowService.findById(id, { populate }),
workflowService.count(),
]);
ctx.body = { ctx.body = {
data: await sanitizeOutput(workflow), data: await sanitizeOutput(workflow),
meta: { workflowCount },
}; };
}, },
}; };