create alerts when user is assignedTo a resource

This commit is contained in:
2025-06-21 17:59:41 +05:30
parent e821c8d11d
commit ad24708f85
5 changed files with 45 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ import mongoose from "mongoose";
import { noteModel } from "../note/note.schema";
import { getUser } from "../user/user.service";
import { createNote } from "../note/note.service";
import { createAlert } from "../alert/alert.service";
export async function createPermit(
input: CreatePermitInput,
@@ -206,6 +207,17 @@ export async function updatePermit(
permitId,
user
);
if (key == "assignedTo") {
await createAlert(
user.tenantId,
`You are assigned to ${updatePermitResult.permitNumber}`,
"user",
user.userId,
updatePermitResult.pid,
"permits"
);
}
}
}