feat: add support for filtering on notification changes

This commit is contained in:
2025-07-29 11:03:04 +05:30
parent bbfb7a4588
commit 63b6cbbc2a
2 changed files with 17 additions and 0 deletions

View File

@@ -112,6 +112,13 @@ export async function listNotifications(
const sortObj = getSortObject(params, notificationFields);
const filterObj = getFilterObject(params) || [];
filterObj.forEach((item) => {
if (item.changes) {
item[`changes.${item.changes.$eq}`] = { $exists: true };
delete item["changes"];
}
});
if (user.role == "client") {
filterObj.push({ client: new mongoose.Types.ObjectId(user.orgId) });
}