feat: add tagging alerts and sorting on tags

This commit is contained in:
2025-08-19 08:03:44 +05:30
parent 17a63f67a5
commit caea0e60e6
20 changed files with 260 additions and 49 deletions

28
src/utils/tags.ts Normal file
View File

@@ -0,0 +1,28 @@
import mongoose from "mongoose";
import { userModel } from "../user/user.schema";
import { permitModel } from "../permit/permit.schema";
import { orgModel } from "../organization/organization.schema";
import { processedModel } from "../processed/processed.schema";
import { notificationModel } from "../notification/notification.schema";
import { rtsModel } from "../rts/rts.schema";
import { taskModel } from "../task/task.schema";
import { taskModel as ctaskModel } from "../ctask/ctask.schema";
import { paymentModel } from "../payments/payment.schema";
export function extractExpressions(input: string) {
return [...input.matchAll(/{{(.*?)}}/g)]
.map((match) => match[1].trim())
.filter((item) => mongoose.Types.ObjectId.isValid(item));
}
export const modelMap = {
users: userModel,
permits: permitModel,
orgs: orgModel,
processed: processedModel,
notifications: notificationModel,
rts: rtsModel,
ctasks: ctaskModel,
tasks: taskModel,
payments: paymentModel,
};