feat: add note to RTS when permitType is updated
This commit is contained in:
@@ -17,6 +17,7 @@ import { getUserWithoutPopulate } from "../user/user.service";
|
||||
import mongoose from "mongoose";
|
||||
import { rtsPipeline } from "../utils/pipeline";
|
||||
import { createAlert } from "../alert/alert.service";
|
||||
import { createNote } from "../note/note.service";
|
||||
|
||||
export async function createRts(
|
||||
input: CreateRtsInput,
|
||||
@@ -230,6 +231,15 @@ export async function updateRts(
|
||||
.populate({ path: "client", select: "pid name avatar" })
|
||||
.populate({ path: "assignedTo", select: "pid name avatar" });
|
||||
|
||||
if (updateRts && input.permitType) {
|
||||
await createNote(
|
||||
{ content: `Updated type to '${input.permitType}'` },
|
||||
id,
|
||||
"rts",
|
||||
user
|
||||
);
|
||||
}
|
||||
|
||||
if (updatedRts && input.assignedTo) {
|
||||
await createAlert(
|
||||
user.tenantId,
|
||||
|
||||
Reference in New Issue
Block a user