only show workflows where user is assigned to at least one step.
This commit is contained in:
@@ -4,7 +4,7 @@ import { ObjectId } from "mongodb";
|
||||
|
||||
const db = client.db(process.env.MONGODB_DB);
|
||||
|
||||
export const getApprovalWorkflows = async (collection: string, entityIds?: string[], ids?: string[]) => {
|
||||
export const getApprovalWorkflows = async (collection: string, entityIds?: string[], ids?: string[], assignee?: string) => {
|
||||
const filters: any = {};
|
||||
|
||||
if (ids && ids.length > 0) {
|
||||
@@ -15,6 +15,10 @@ export const getApprovalWorkflows = async (collection: string, entityIds?: strin
|
||||
filters.entityId = { $in: entityIds };
|
||||
}
|
||||
|
||||
if (assignee) {
|
||||
filters["steps.assignees"] = assignee;
|
||||
}
|
||||
|
||||
return await db.collection<ApprovalWorkflow>(collection).find(filters).toArray();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user