order workflows table in descent startDate
This commit is contained in:
@@ -19,7 +19,11 @@ export const getApprovalWorkflows = async (collection: string, entityIds?: strin
|
||||
filters["steps.assignees"] = assignee;
|
||||
}
|
||||
|
||||
return await db.collection<ApprovalWorkflow>(collection).find(filters).toArray();
|
||||
return await db
|
||||
.collection<ApprovalWorkflow>(collection)
|
||||
.find(filters)
|
||||
.sort({ startDate: -1 })
|
||||
.toArray();
|
||||
};
|
||||
|
||||
export const getApprovalWorkflow = async (collection: string, id: string) => {
|
||||
@@ -30,6 +34,7 @@ export const getApprovalWorkflowsByEntities = async (collection: string, ids: st
|
||||
return await db
|
||||
.collection<ApprovalWorkflow>(collection)
|
||||
.find({ entityId: { $in: ids } })
|
||||
.sort({ startDate: -1 })
|
||||
.toArray();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user