feat: add tagging alerts and sorting on tags
This commit is contained in:
28
src/utils/tags.ts
Normal file
28
src/utils/tags.ts
Normal 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,
|
||||
};
|
||||
Reference in New Issue
Block a user