only show workflows where user is assigned to at least one step.

This commit is contained in:
Joao Correia
2025-02-26 17:21:37 +00:00
parent a4ef2222e2
commit dd8f821e35
2 changed files with 11 additions and 2 deletions

View File

@@ -23,5 +23,10 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
const entityIdsArray = entityIdsString.split(",");
return res.status(200).json(await getApprovalWorkflows("active-workflows", entityIdsArray));
if (!["admin", "developer"].includes(user.type)) {
// filtering workflows that have user as assignee in at least one of the steps
return res.status(200).json(await getApprovalWorkflows("active-workflows", entityIdsArray, undefined, user.id));
} else {
return res.status(200).json(await getApprovalWorkflows("active-workflows", entityIdsArray));
}
}