feat: add more metaFields to alerts
This commit is contained in:
@@ -17,6 +17,15 @@ export const alertsModel = mongoose.model(
|
|||||||
permitType: String,
|
permitType: String,
|
||||||
address: String,
|
address: String,
|
||||||
createdBy: { type: String, ref: "user" },
|
createdBy: { type: String, ref: "user" },
|
||||||
|
changes: Object,
|
||||||
|
updatedAt: Date,
|
||||||
|
permitNumber: String,
|
||||||
|
standardStatus: String,
|
||||||
|
lot: String,
|
||||||
|
block: String,
|
||||||
|
jobNumber: String,
|
||||||
|
stage: Object,
|
||||||
|
dueDate: Date,
|
||||||
},
|
},
|
||||||
recipientType: {
|
recipientType: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -29,7 +38,7 @@ export const alertsModel = mongoose.model(
|
|||||||
type: [String],
|
type: [String],
|
||||||
default: [],
|
default: [],
|
||||||
},
|
},
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const alertResponse = z.object({
|
const alertResponse = z.object({
|
||||||
@@ -45,6 +54,15 @@ const alertResponse = z.object({
|
|||||||
permitType: z.string().optional(),
|
permitType: z.string().optional(),
|
||||||
address: z.string().optional(),
|
address: z.string().optional(),
|
||||||
createdBy: z.any().optional(),
|
createdBy: z.any().optional(),
|
||||||
|
changes: z.any().optional(),
|
||||||
|
updatedAt: z.date().optional(),
|
||||||
|
permitNumber: z.string().optional(),
|
||||||
|
standardStatus: z.string().optional(),
|
||||||
|
lot: z.string().optional(),
|
||||||
|
block: z.string().optional(),
|
||||||
|
jobNumber: z.string().optional(),
|
||||||
|
stage: z.any().optional(),
|
||||||
|
dueDate: z.date().optional(),
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
recipientType: z.enum(["user", "team"]),
|
recipientType: z.enum(["user", "team"]),
|
||||||
@@ -66,5 +84,5 @@ export const { schemas: alertSchemas, $ref: $alert } = buildJsonSchemas(
|
|||||||
listAlertResponse,
|
listAlertResponse,
|
||||||
pageQueryParams,
|
pageQueryParams,
|
||||||
},
|
},
|
||||||
{ $id: "alert" },
|
{ $id: "alert" }
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,7 +17,16 @@ export async function createAlert(
|
|||||||
permitType?: String;
|
permitType?: String;
|
||||||
address?: String;
|
address?: String;
|
||||||
createdBy?: String;
|
createdBy?: String;
|
||||||
},
|
changes?: Object;
|
||||||
|
updatedAt?: Date;
|
||||||
|
permitNumber?: String;
|
||||||
|
standardStatus?: String;
|
||||||
|
lot?: String;
|
||||||
|
block?: String;
|
||||||
|
jobNumber?: String;
|
||||||
|
stage?: Object;
|
||||||
|
dueDate?: Date;
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
const newAlert = await alertsModel.create({
|
const newAlert = await alertsModel.create({
|
||||||
tenantId,
|
tenantId,
|
||||||
@@ -45,13 +54,13 @@ export async function createAlert(
|
|||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
["alert:read"],
|
["alert:read"]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getUserAlerts(
|
export async function getUserAlerts(
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser,
|
||||||
params: PageQueryParams,
|
params: PageQueryParams
|
||||||
) {
|
) {
|
||||||
const page = params.page || 1;
|
const page = params.page || 1;
|
||||||
const pageSize = params.pageSize || 10;
|
const pageSize = params.pageSize || 10;
|
||||||
@@ -95,7 +104,7 @@ export async function markAsRead(alertId: string, user: AuthenticatedUser) {
|
|||||||
const updatedAlert = await alertsModel.findOneAndUpdate(
|
const updatedAlert = await alertsModel.findOneAndUpdate(
|
||||||
{ tenantId: user.tenantId, pid: alertId },
|
{ tenantId: user.tenantId, pid: alertId },
|
||||||
{ $addToSet: { readBy: user.userId } },
|
{ $addToSet: { readBy: user.userId } },
|
||||||
{ new: true },
|
{ new: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!updatedAlert) return null;
|
if (!updatedAlert) return null;
|
||||||
@@ -123,7 +132,7 @@ export async function markAllRead(user: AuthenticatedUser) {
|
|||||||
|
|
||||||
const updatedResult = await alertsModel.updateMany(
|
const updatedResult = await alertsModel.updateMany(
|
||||||
{ $or: filters },
|
{ $or: filters },
|
||||||
{ $addToSet: { readBy: user.userId } },
|
{ $addToSet: { readBy: user.userId } }
|
||||||
);
|
);
|
||||||
|
|
||||||
return updatedResult;
|
return updatedResult;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export async function createNote(
|
|||||||
input: CreateNoteInput,
|
input: CreateNoteInput,
|
||||||
resourceId: string,
|
resourceId: string,
|
||||||
resourceType: string,
|
resourceType: string,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
const userIds = extractExpressions(input.content);
|
const userIds = extractExpressions(input.content);
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ export async function createNote(
|
|||||||
orgs.push({ orgId: obj.client.toString(), taggedAt: new Date() });
|
orgs.push({ orgId: obj.client.toString(), taggedAt: new Date() });
|
||||||
noteContent = noteContent.replaceAll(
|
noteContent = noteContent.replaceAll(
|
||||||
"{{client}}",
|
"{{client}}",
|
||||||
`{{org-${obj.client.toString()}}}`,
|
`{{org-${obj.client.toString()}}}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ export async function createNote(
|
|||||||
orgs.push({ orgId: process.env.SUNCOAST_ID, taggedAt: new Date() });
|
orgs.push({ orgId: process.env.SUNCOAST_ID, taggedAt: new Date() });
|
||||||
noteContent = noteContent.replaceAll(
|
noteContent = noteContent.replaceAll(
|
||||||
"{{agent}}",
|
"{{agent}}",
|
||||||
`{{org-${process.env.SUNCOAST_ID}}}`,
|
`{{org-${process.env.SUNCOAST_ID}}}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -75,7 +75,7 @@ export async function createNote(
|
|||||||
if (!obj.taggedOrgs) obj.taggedOrgs = [];
|
if (!obj.taggedOrgs) obj.taggedOrgs = [];
|
||||||
|
|
||||||
const orgIndex = obj.taggedOrgs.findIndex(
|
const orgIndex = obj.taggedOrgs.findIndex(
|
||||||
(item) => item.orgId == org.orgId,
|
(item) => item.orgId == org.orgId
|
||||||
);
|
);
|
||||||
if (orgIndex != -1) obj.taggedOrgs[orgIndex].taggedAt = new Date();
|
if (orgIndex != -1) obj.taggedOrgs[orgIndex].taggedAt = new Date();
|
||||||
else obj.taggedOrgs.push(org);
|
else obj.taggedOrgs.push(org);
|
||||||
@@ -85,7 +85,7 @@ export async function createNote(
|
|||||||
if (!obj.taggedUsers) obj.taggedUsers = [];
|
if (!obj.taggedUsers) obj.taggedUsers = [];
|
||||||
|
|
||||||
const userIndex = obj.taggedUsers.findIndex(
|
const userIndex = obj.taggedUsers.findIndex(
|
||||||
(item) => item.userId == user.userId,
|
(item) => item.userId == user.userId
|
||||||
);
|
);
|
||||||
if (userIndex != -1) obj.taggedUsers[userIndex].taggedAt = new Date();
|
if (userIndex != -1) obj.taggedUsers[userIndex].taggedAt = new Date();
|
||||||
else obj.taggedUsers.push(user);
|
else obj.taggedUsers.push(user);
|
||||||
@@ -93,7 +93,7 @@ export async function createNote(
|
|||||||
|
|
||||||
if (taggedUsers.length > 0) {
|
if (taggedUsers.length > 0) {
|
||||||
const assignee = obj.assignedTo.find(
|
const assignee = obj.assignedTo.find(
|
||||||
(item) => item.toString() == taggedUsers[0].userId,
|
(item) => item.toString() == taggedUsers[0].userId
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!assignee) obj.assignedTo.push(taggedUsers[0].userId);
|
if (!assignee) obj.assignedTo.push(taggedUsers[0].userId);
|
||||||
@@ -102,6 +102,26 @@ export async function createNote(
|
|||||||
obj.markModified("taggedUsers", "assignedTo", "taggedOrgs");
|
obj.markModified("taggedUsers", "assignedTo", "taggedOrgs");
|
||||||
await obj.save();
|
await obj.save();
|
||||||
|
|
||||||
|
const metaFields: any = {};
|
||||||
|
if (obj.client) metaFields.client = obj.client.toString();
|
||||||
|
if (obj.county) {
|
||||||
|
if (resourceType == "rts") metaFields.county = obj.county.toString();
|
||||||
|
else metaFields.county = obj.county.id.toString();
|
||||||
|
}
|
||||||
|
if (obj.changes) metaFields.changes = obj.changes;
|
||||||
|
if (obj.permitNumber) metaFields.permitNumber = obj.permitNumber;
|
||||||
|
if (obj.cleanStatus) metaFields.standardStatus = obj.cleanStatus;
|
||||||
|
if (obj.address) metaFields.address = obj.address;
|
||||||
|
if (obj.lot) metaFields.lot = obj.lot;
|
||||||
|
if (obj.block) metaFields.block = obj.block;
|
||||||
|
if (obj.jobNumber) metaFields.jobNumber = obj.jobNumber;
|
||||||
|
if (obj.permitType) metaFields.permitType = obj.permitType;
|
||||||
|
if (obj.stage) metaFields.stage = obj.stage;
|
||||||
|
if (obj.dueDate) metaFields.dueDate = obj.dueDate;
|
||||||
|
if (obj.updatedAt) metaFields.updatedAt = obj.updatedAt;
|
||||||
|
|
||||||
|
metaFields.createdBy = user.userId;
|
||||||
|
|
||||||
if (taggedUsers.length > 0) {
|
if (taggedUsers.length > 0) {
|
||||||
for (const taggedUser of taggedUsers) {
|
for (const taggedUser of taggedUsers) {
|
||||||
if (taggedUser.userId == user.userId) continue;
|
if (taggedUser.userId == user.userId) continue;
|
||||||
@@ -114,8 +134,8 @@ export async function createNote(
|
|||||||
resourceId,
|
resourceId,
|
||||||
resourceType,
|
resourceType,
|
||||||
{
|
{
|
||||||
createdBy: user.userId,
|
...metaFields,
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,8 +150,8 @@ export async function createNote(
|
|||||||
resourceId,
|
resourceId,
|
||||||
resourceType,
|
resourceType,
|
||||||
{
|
{
|
||||||
createdBy: user.userId,
|
...metaFields,
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,7 +164,7 @@ export async function updateNote(
|
|||||||
input: CreateNoteInput,
|
input: CreateNoteInput,
|
||||||
resourceId: string,
|
resourceId: string,
|
||||||
noteId: string,
|
noteId: string,
|
||||||
tenantId: string,
|
tenantId: string
|
||||||
) {
|
) {
|
||||||
return await noteModel
|
return await noteModel
|
||||||
.findOneAndUpdate(
|
.findOneAndUpdate(
|
||||||
@@ -156,7 +176,7 @@ export async function updateNote(
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ ...input },
|
{ ...input },
|
||||||
{ new: true },
|
{ new: true }
|
||||||
)
|
)
|
||||||
.populate({ path: "createdBy", select: "pid name avatar" });
|
.populate({ path: "createdBy", select: "pid name avatar" });
|
||||||
}
|
}
|
||||||
@@ -200,7 +220,7 @@ export async function listNotes(resourceId: string, tenantId: string) {
|
|||||||
export async function deleteNote(
|
export async function deleteNote(
|
||||||
resourceId: string,
|
resourceId: string,
|
||||||
noteId: string,
|
noteId: string,
|
||||||
tenantId: string,
|
tenantId: string
|
||||||
) {
|
) {
|
||||||
return await noteModel.deleteOne({
|
return await noteModel.deleteOne({
|
||||||
$and: [{ pid: noteId }, { tenantId: tenantId }, { resourceId: resourceId }],
|
$and: [{ pid: noteId }, { tenantId: tenantId }, { resourceId: resourceId }],
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { arrayDiff } from "../utils/diff";
|
|||||||
|
|
||||||
export async function createNotification(
|
export async function createNotification(
|
||||||
input: CreateNotificationInput,
|
input: CreateNotificationInput,
|
||||||
tenantId: string,
|
tenantId: string
|
||||||
) {
|
) {
|
||||||
const notification = await notificationModel.create({
|
const notification = await notificationModel.create({
|
||||||
...input,
|
...input,
|
||||||
@@ -41,7 +41,7 @@ export async function createNotification(
|
|||||||
|
|
||||||
export async function getNotification(
|
export async function getNotification(
|
||||||
notifId: string,
|
notifId: string,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
return await notificationModel
|
return await notificationModel
|
||||||
.findOne({
|
.findOne({
|
||||||
@@ -54,7 +54,7 @@ export async function getNotification(
|
|||||||
export async function updateNotification(
|
export async function updateNotification(
|
||||||
notifId: string,
|
notifId: string,
|
||||||
input: UpdateNotificationInput,
|
input: UpdateNotificationInput,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
if (input.assignedToOrg && input.assignedTo) {
|
if (input.assignedToOrg && input.assignedTo) {
|
||||||
delete input.assignedTo;
|
delete input.assignedTo;
|
||||||
@@ -62,7 +62,7 @@ export async function updateNotification(
|
|||||||
|
|
||||||
const oldNotification = await notificationModel.findOne(
|
const oldNotification = await notificationModel.findOne(
|
||||||
{ pid: notifId },
|
{ pid: notifId },
|
||||||
{ assignedTo: 1, assignedToOrg: 1 },
|
{ assignedTo: 1, assignedToOrg: 1 }
|
||||||
);
|
);
|
||||||
|
|
||||||
const updateNotificationResult = await notificationModel
|
const updateNotificationResult = await notificationModel
|
||||||
@@ -72,7 +72,7 @@ export async function updateNotification(
|
|||||||
...input,
|
...input,
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
},
|
},
|
||||||
{ new: true },
|
{ new: true }
|
||||||
)
|
)
|
||||||
.populate({ path: "assignedTo", select: "pid name avatar" });
|
.populate({ path: "assignedTo", select: "pid name avatar" });
|
||||||
|
|
||||||
@@ -93,22 +93,22 @@ export async function updateNotification(
|
|||||||
},
|
},
|
||||||
notifId,
|
notifId,
|
||||||
"notifications",
|
"notifications",
|
||||||
user,
|
user
|
||||||
);
|
);
|
||||||
} else if (key == "assignedTo") {
|
} else if (key == "assignedTo") {
|
||||||
const newAssignees = arrayDiff(
|
const newAssignees = arrayDiff(
|
||||||
updateNotificationResult.assignedTo.map((item) => item._id),
|
updateNotificationResult.assignedTo.map((item) => item._id),
|
||||||
oldNotification.assignedTo,
|
oldNotification.assignedTo
|
||||||
);
|
);
|
||||||
|
|
||||||
if (newAssignees.length > 0) {
|
if (newAssignees.length > 0) {
|
||||||
let msg = "Assigned to:\n\n";
|
let msg = "Assigned to:\n\n";
|
||||||
|
|
||||||
for (const assignee of newAssignees) {
|
for (const assignee of newAssignees) {
|
||||||
const user = await getUser(assignee);
|
const assigneeDB = await getUser(assignee);
|
||||||
if (!user) continue;
|
if (!assigneeDB) continue;
|
||||||
|
|
||||||
msg += `${user.firstName + " " + user.lastName}\n`;
|
msg += `${assigneeDB.firstName + " " + assigneeDB.lastName}\n`;
|
||||||
|
|
||||||
await createAlert(
|
await createAlert(
|
||||||
user.tenantId,
|
user.tenantId,
|
||||||
@@ -118,9 +118,13 @@ export async function updateNotification(
|
|||||||
updateNotificationResult.pid,
|
updateNotificationResult.pid,
|
||||||
"permits",
|
"permits",
|
||||||
{
|
{
|
||||||
|
changes: updateNotificationResult.changes,
|
||||||
client: updateNotificationResult.client.toString(),
|
client: updateNotificationResult.client.toString(),
|
||||||
county: updateNotificationResult.county.id.toString(),
|
county: updateNotificationResult.county.id.toString(),
|
||||||
},
|
updatedAt: updateNotificationResult.updatedAt,
|
||||||
|
permitNumber: updateNotificationResult.permitNumber,
|
||||||
|
createdBy: user.userId,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +134,7 @@ export async function updateNotification(
|
|||||||
},
|
},
|
||||||
notifId,
|
notifId,
|
||||||
"notifications",
|
"notifications",
|
||||||
user,
|
user
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (key == "assignedToOrg") {
|
} else if (key == "assignedToOrg") {
|
||||||
@@ -155,9 +159,13 @@ export async function updateNotification(
|
|||||||
updateNotificationResult.pid,
|
updateNotificationResult.pid,
|
||||||
"permits",
|
"permits",
|
||||||
{
|
{
|
||||||
|
changes: updateNotificationResult.changes,
|
||||||
client: updateNotificationResult.client.toString(),
|
client: updateNotificationResult.client.toString(),
|
||||||
county: updateNotificationResult.county.id.toString(),
|
county: updateNotificationResult.county.id.toString(),
|
||||||
},
|
updatedAt: updateNotificationResult.updatedAt,
|
||||||
|
permitNumber: updateNotificationResult.permitNumber,
|
||||||
|
createdBy: user.userId,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,7 +176,7 @@ export async function updateNotification(
|
|||||||
|
|
||||||
export async function listNotifications(
|
export async function listNotifications(
|
||||||
params: PageQueryParams,
|
params: PageQueryParams,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
const page = params.page || 1;
|
const page = params.page || 1;
|
||||||
const pageSize = params.pageSize || 10;
|
const pageSize = params.pageSize || 10;
|
||||||
@@ -207,12 +215,12 @@ export async function listNotifications(
|
|||||||
|
|
||||||
let { taggedUsersFilter, taggedUserFilterIndex } = getTaggedUsersFilter(
|
let { taggedUsersFilter, taggedUserFilterIndex } = getTaggedUsersFilter(
|
||||||
filterObj,
|
filterObj,
|
||||||
sortObj,
|
sortObj
|
||||||
);
|
);
|
||||||
|
|
||||||
let { taggedOrgsFilter, taggedOrgsFilterIndex } = getTaggedOrgsFilter(
|
let { taggedOrgsFilter, taggedOrgsFilterIndex } = getTaggedOrgsFilter(
|
||||||
filterObj,
|
filterObj,
|
||||||
sortObj,
|
sortObj
|
||||||
);
|
);
|
||||||
|
|
||||||
if (taggedUserFilterIndex != -1) filterObj.splice(taggedUserFilterIndex, 1);
|
if (taggedUserFilterIndex != -1) filterObj.splice(taggedUserFilterIndex, 1);
|
||||||
@@ -289,7 +297,7 @@ export async function listNotifications(
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
const notifications = await notificationModel.aggregate(pipeline);
|
const notifications = await notificationModel.aggregate(pipeline);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import { arrayDiff } from "../utils/diff";
|
|||||||
|
|
||||||
export async function createPermit(
|
export async function createPermit(
|
||||||
input: CreatePermitInput,
|
input: CreatePermitInput,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
if (!input.stage) {
|
if (!input.stage) {
|
||||||
input.stage = {
|
input.stage = {
|
||||||
@@ -64,7 +64,7 @@ export async function createPermit(
|
|||||||
orgId: permit.client.toString(),
|
orgId: permit.client.toString(),
|
||||||
document: permit,
|
document: permit,
|
||||||
} as ChangeEvent,
|
} as ChangeEvent,
|
||||||
["permit:read"],
|
["permit:read"]
|
||||||
);
|
);
|
||||||
|
|
||||||
return await permit.populate({
|
return await permit.populate({
|
||||||
@@ -89,7 +89,7 @@ export async function createPermit(
|
|||||||
orgId: permit.client.toString(),
|
orgId: permit.client.toString(),
|
||||||
document: permit,
|
document: permit,
|
||||||
} as ChangeEvent,
|
} as ChangeEvent,
|
||||||
["permit:read"],
|
["permit:read"]
|
||||||
);
|
);
|
||||||
|
|
||||||
return await permit.populate({
|
return await permit.populate({
|
||||||
@@ -131,7 +131,7 @@ export async function getPermit(permitId: string, user: AuthenticatedUser) {
|
|||||||
|
|
||||||
export async function listPermits(
|
export async function listPermits(
|
||||||
params: PageQueryParams,
|
params: PageQueryParams,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
const page = params.page || 1;
|
const page = params.page || 1;
|
||||||
const pageSize = params.pageSize || 10;
|
const pageSize = params.pageSize || 10;
|
||||||
@@ -156,12 +156,12 @@ export async function listPermits(
|
|||||||
|
|
||||||
let { taggedUsersFilter, taggedUserFilterIndex } = getTaggedUsersFilter(
|
let { taggedUsersFilter, taggedUserFilterIndex } = getTaggedUsersFilter(
|
||||||
filterObj,
|
filterObj,
|
||||||
sortObj,
|
sortObj
|
||||||
);
|
);
|
||||||
|
|
||||||
let { taggedOrgsFilter, taggedOrgsFilterIndex } = getTaggedOrgsFilter(
|
let { taggedOrgsFilter, taggedOrgsFilterIndex } = getTaggedOrgsFilter(
|
||||||
filterObj,
|
filterObj,
|
||||||
sortObj,
|
sortObj
|
||||||
);
|
);
|
||||||
|
|
||||||
if (taggedUserFilterIndex != -1) filterObj.splice(taggedUserFilterIndex, 1);
|
if (taggedUserFilterIndex != -1) filterObj.splice(taggedUserFilterIndex, 1);
|
||||||
@@ -274,7 +274,7 @@ export async function listPermits(
|
|||||||
export async function updatePermit(
|
export async function updatePermit(
|
||||||
input: CreatePermitInput,
|
input: CreatePermitInput,
|
||||||
permitId: string,
|
permitId: string,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
if (input.assignedToOrg && input.assignedTo) {
|
if (input.assignedToOrg && input.assignedTo) {
|
||||||
delete input.assignedTo;
|
delete input.assignedTo;
|
||||||
@@ -282,7 +282,7 @@ export async function updatePermit(
|
|||||||
|
|
||||||
const oldPermitResult = await permitModel.findOne(
|
const oldPermitResult = await permitModel.findOne(
|
||||||
{ pid: permitId },
|
{ pid: permitId },
|
||||||
{ assignedTo: 1, assignedToOrg: 1 },
|
{ assignedTo: 1, assignedToOrg: 1 }
|
||||||
);
|
);
|
||||||
const updatePermitResult = await permitModel
|
const updatePermitResult = await permitModel
|
||||||
.findOneAndUpdate(
|
.findOneAndUpdate(
|
||||||
@@ -290,7 +290,7 @@ export async function updatePermit(
|
|||||||
$and: [{ tenantId: user.tenantId }, { pid: permitId }],
|
$and: [{ tenantId: user.tenantId }, { pid: permitId }],
|
||||||
},
|
},
|
||||||
{ ...input, lastUpdateDate: new Date() },
|
{ ...input, lastUpdateDate: new Date() },
|
||||||
{ new: true },
|
{ new: true }
|
||||||
)
|
)
|
||||||
.populate({ path: "assignedTo", select: "pid name avatar" })
|
.populate({ path: "assignedTo", select: "pid name avatar" })
|
||||||
.populate({ path: "createdBy", select: "pid name avatar" });
|
.populate({ path: "createdBy", select: "pid name avatar" });
|
||||||
@@ -314,7 +314,7 @@ export async function updatePermit(
|
|||||||
},
|
},
|
||||||
permitId,
|
permitId,
|
||||||
"permits",
|
"permits",
|
||||||
user,
|
user
|
||||||
);
|
);
|
||||||
|
|
||||||
if (key == "requests" && input[key] != null) {
|
if (key == "requests" && input[key] != null) {
|
||||||
@@ -337,7 +337,13 @@ export async function updatePermit(
|
|||||||
client: updatePermitResult.client.toString(),
|
client: updatePermitResult.client.toString(),
|
||||||
county: updatePermitResult.county.id.toString(),
|
county: updatePermitResult.county.id.toString(),
|
||||||
address: updatePermitResult.address,
|
address: updatePermitResult.address,
|
||||||
},
|
permitNumber: updatePermitResult.permitNumber,
|
||||||
|
standardStatus: updatePermitResult.cleanStatus,
|
||||||
|
lot: updatePermitResult.lot,
|
||||||
|
block: updatePermitResult.block,
|
||||||
|
jobNumber: updatePermitResult.jobNumber,
|
||||||
|
createdBy: user.userId,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -360,13 +366,13 @@ export async function updatePermit(
|
|||||||
},
|
},
|
||||||
permitId,
|
permitId,
|
||||||
"permits",
|
"permits",
|
||||||
user,
|
user
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (key == "assignedTo") {
|
} else if (key == "assignedTo") {
|
||||||
const newAssignees = arrayDiff(
|
const newAssignees = arrayDiff(
|
||||||
updatePermitResult.assignedTo.map((item) => item._id),
|
updatePermitResult.assignedTo.map((item) => item._id),
|
||||||
oldPermitResult.assignedTo,
|
oldPermitResult.assignedTo
|
||||||
);
|
);
|
||||||
|
|
||||||
if (newAssignees.length == 0) continue;
|
if (newAssignees.length == 0) continue;
|
||||||
@@ -374,10 +380,10 @@ export async function updatePermit(
|
|||||||
let msg = "Assigned to:\n\n";
|
let msg = "Assigned to:\n\n";
|
||||||
|
|
||||||
for (const assignee of newAssignees) {
|
for (const assignee of newAssignees) {
|
||||||
const user = await getUser(assignee);
|
const assigneeDB = await getUser(assignee);
|
||||||
if (!user) continue;
|
if (!assigneeDB) continue;
|
||||||
|
|
||||||
msg += `${user.firstName + " " + user.lastName}\n`;
|
msg += `${assigneeDB.firstName + " " + assigneeDB.lastName}\n`;
|
||||||
|
|
||||||
await createAlert(
|
await createAlert(
|
||||||
user.tenantId,
|
user.tenantId,
|
||||||
@@ -389,8 +395,14 @@ export async function updatePermit(
|
|||||||
{
|
{
|
||||||
client: updatePermitResult.client.toString(),
|
client: updatePermitResult.client.toString(),
|
||||||
county: updatePermitResult.county.id.toString(),
|
county: updatePermitResult.county.id.toString(),
|
||||||
address: updatePermitResult.address.full_address,
|
address: updatePermitResult.address,
|
||||||
},
|
permitNumber: updatePermitResult.permitNumber,
|
||||||
|
standardStatus: updatePermitResult.cleanStatus,
|
||||||
|
lot: updatePermitResult.lot,
|
||||||
|
block: updatePermitResult.block,
|
||||||
|
jobNumber: updatePermitResult.jobNumber,
|
||||||
|
createdBy: user.userId,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,7 +412,7 @@ export async function updatePermit(
|
|||||||
},
|
},
|
||||||
permitId,
|
permitId,
|
||||||
"permits",
|
"permits",
|
||||||
user,
|
user
|
||||||
);
|
);
|
||||||
} else if (key == "assignedToOrg") {
|
} else if (key == "assignedToOrg") {
|
||||||
if (oldPermitResult.assignedToOrg == updatePermitResult.assignedToOrg)
|
if (oldPermitResult.assignedToOrg == updatePermitResult.assignedToOrg)
|
||||||
@@ -426,8 +438,14 @@ export async function updatePermit(
|
|||||||
{
|
{
|
||||||
client: updatePermitResult.client.toString(),
|
client: updatePermitResult.client.toString(),
|
||||||
county: updatePermitResult.county.id.toString(),
|
county: updatePermitResult.county.id.toString(),
|
||||||
address: updatePermitResult.address.full_address,
|
address: updatePermitResult.address,
|
||||||
},
|
permitNumber: updatePermitResult.permitNumber,
|
||||||
|
standardStatus: updatePermitResult.cleanStatus,
|
||||||
|
lot: updatePermitResult.lot,
|
||||||
|
block: updatePermitResult.block,
|
||||||
|
jobNumber: updatePermitResult.jobNumber,
|
||||||
|
createdBy: user.userId,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -442,7 +460,7 @@ export async function updatePermit(
|
|||||||
orgId: updatePermitResult.client._id.toString(),
|
orgId: updatePermitResult.client._id.toString(),
|
||||||
document: updatePermitResult,
|
document: updatePermitResult,
|
||||||
} as ChangeEvent,
|
} as ChangeEvent,
|
||||||
["permit:read"],
|
["permit:read"]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,7 +482,7 @@ export async function deletePermit(permitId: string, tenantId: string) {
|
|||||||
pid: permitId,
|
pid: permitId,
|
||||||
},
|
},
|
||||||
} as ChangeEvent,
|
} as ChangeEvent,
|
||||||
["permit:read"],
|
["permit:read"]
|
||||||
);
|
);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
@@ -472,7 +490,7 @@ export async function deletePermit(permitId: string, tenantId: string) {
|
|||||||
|
|
||||||
export async function searchPermit(
|
export async function searchPermit(
|
||||||
params: PageQueryParams,
|
params: PageQueryParams,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
const page = params.page || 1;
|
const page = params.page || 1;
|
||||||
const pageSize = params.pageSize || 10;
|
const pageSize = params.pageSize || 10;
|
||||||
@@ -671,7 +689,7 @@ export async function bulkImport(csvData: any[], user: AuthenticatedUser) {
|
|||||||
clientCache[clientName] = clientData;
|
clientCache[clientName] = clientData;
|
||||||
} else {
|
} else {
|
||||||
errors.push(
|
errors.push(
|
||||||
"Client not found. The value in Client column must exactly match the client name in Quicker Permits",
|
"Client not found. The value in Client column must exactly match the client name in Quicker Permits"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -692,7 +710,7 @@ export async function bulkImport(csvData: any[], user: AuthenticatedUser) {
|
|||||||
countyCache[countyName] = countyData;
|
countyCache[countyName] = countyData;
|
||||||
} else {
|
} else {
|
||||||
errors.push(
|
errors.push(
|
||||||
"County not found. The value in County column must exactly match the county name in Quicker Permits",
|
"County not found. The value in County column must exactly match the county name in Quicker Permits"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import { arrayDiff } from "../utils/diff";
|
|||||||
|
|
||||||
export async function getProcessedPermit(
|
export async function getProcessedPermit(
|
||||||
permitId: String,
|
permitId: String,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
const permit = await processedModel
|
const permit = await processedModel
|
||||||
.findOne({
|
.findOne({
|
||||||
@@ -42,7 +42,7 @@ export async function getProcessedPermit(
|
|||||||
export async function updateProcessed(
|
export async function updateProcessed(
|
||||||
input: UpdateProcessedInput,
|
input: UpdateProcessedInput,
|
||||||
permitId: string,
|
permitId: string,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
if (input.assignedToOrg && input.assignedTo) {
|
if (input.assignedToOrg && input.assignedTo) {
|
||||||
delete input.assignedTo;
|
delete input.assignedTo;
|
||||||
@@ -50,7 +50,7 @@ export async function updateProcessed(
|
|||||||
|
|
||||||
const oldPermitResult = await processedModel.findOne(
|
const oldPermitResult = await processedModel.findOne(
|
||||||
{ pid: permitId },
|
{ pid: permitId },
|
||||||
{ assignedTo: 1, assignedToOrg: 1 },
|
{ assignedTo: 1, assignedToOrg: 1 }
|
||||||
);
|
);
|
||||||
const updateProcessedResult = await processedModel
|
const updateProcessedResult = await processedModel
|
||||||
.findOneAndUpdate(
|
.findOneAndUpdate(
|
||||||
@@ -58,7 +58,7 @@ export async function updateProcessed(
|
|||||||
$and: [{ tenantId: user.tenantId }, { pid: permitId }],
|
$and: [{ tenantId: user.tenantId }, { pid: permitId }],
|
||||||
},
|
},
|
||||||
{ ...input, lastUpdateDate: new Date() },
|
{ ...input, lastUpdateDate: new Date() },
|
||||||
{ new: true },
|
{ new: true }
|
||||||
)
|
)
|
||||||
.populate({ path: "county", select: "pid name avatar" })
|
.populate({ path: "county", select: "pid name avatar" })
|
||||||
.populate({ path: "assignedTo", select: "pid name avatar" })
|
.populate({ path: "assignedTo", select: "pid name avatar" })
|
||||||
@@ -81,7 +81,7 @@ export async function updateProcessed(
|
|||||||
},
|
},
|
||||||
permitId,
|
permitId,
|
||||||
"processed",
|
"processed",
|
||||||
user,
|
user
|
||||||
);
|
);
|
||||||
} else if (key == "client") {
|
} else if (key == "client") {
|
||||||
const orgInDb = await orgModel.findById(input.client);
|
const orgInDb = await orgModel.findById(input.client);
|
||||||
@@ -102,13 +102,13 @@ export async function updateProcessed(
|
|||||||
},
|
},
|
||||||
permitId,
|
permitId,
|
||||||
"permits",
|
"permits",
|
||||||
user,
|
user
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (key == "assignedTo") {
|
} else if (key == "assignedTo") {
|
||||||
const newAssignees = arrayDiff(
|
const newAssignees = arrayDiff(
|
||||||
updateProcessedResult.assignedTo.map((item) => item._id),
|
updateProcessedResult.assignedTo.map((item) => item._id),
|
||||||
oldPermitResult.assignedTo,
|
oldPermitResult.assignedTo
|
||||||
);
|
);
|
||||||
|
|
||||||
if (newAssignees.length == 0) continue;
|
if (newAssignees.length == 0) continue;
|
||||||
@@ -116,10 +116,10 @@ export async function updateProcessed(
|
|||||||
let msg = "Assigned to:\n\n";
|
let msg = "Assigned to:\n\n";
|
||||||
|
|
||||||
for (const assignee of newAssignees) {
|
for (const assignee of newAssignees) {
|
||||||
const user = await getUser(assignee);
|
const assigneeDB = await getUser(assignee);
|
||||||
if (!user) continue;
|
if (!assigneeDB) continue;
|
||||||
|
|
||||||
msg += `${user.firstName + " " + user.lastName}\n`;
|
msg += `${assigneeDB.firstName + " " + assigneeDB.lastName}\n`;
|
||||||
|
|
||||||
await createAlert(
|
await createAlert(
|
||||||
user.tenantId,
|
user.tenantId,
|
||||||
@@ -131,8 +131,14 @@ export async function updateProcessed(
|
|||||||
{
|
{
|
||||||
client: updateProcessedResult.client.toString(),
|
client: updateProcessedResult.client.toString(),
|
||||||
county: updateProcessedResult.county.id.toString(),
|
county: updateProcessedResult.county.id.toString(),
|
||||||
address: updateProcessedResult.address.full_address,
|
address: updateProcessedResult.address,
|
||||||
},
|
permitNumber: updateProcessedResult.permitNumber,
|
||||||
|
standardStatus: updateProcessedResult.cleanStatus,
|
||||||
|
lot: updateProcessedResult.lot,
|
||||||
|
block: updateProcessedResult.block,
|
||||||
|
jobNumber: updateProcessedResult.jobNumber,
|
||||||
|
createdBy: user.userId,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +148,7 @@ export async function updateProcessed(
|
|||||||
},
|
},
|
||||||
permitId,
|
permitId,
|
||||||
"processed",
|
"processed",
|
||||||
user,
|
user
|
||||||
);
|
);
|
||||||
} else if (key == "assignedToOrg") {
|
} else if (key == "assignedToOrg") {
|
||||||
if (
|
if (
|
||||||
@@ -167,8 +173,14 @@ export async function updateProcessed(
|
|||||||
{
|
{
|
||||||
client: updateProcessedResult.client.toString(),
|
client: updateProcessedResult.client.toString(),
|
||||||
county: updateProcessedResult.county.id.toString(),
|
county: updateProcessedResult.county.id.toString(),
|
||||||
address: updateProcessedResult.address.full_address,
|
address: updateProcessedResult.address,
|
||||||
},
|
permitNumber: updateProcessedResult.permitNumber,
|
||||||
|
standardStatus: updateProcessedResult.cleanStatus,
|
||||||
|
lot: updateProcessedResult.lot,
|
||||||
|
block: updateProcessedResult.block,
|
||||||
|
jobNumber: updateProcessedResult.jobNumber,
|
||||||
|
createdBy: user.userId,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,7 +191,7 @@ export async function updateProcessed(
|
|||||||
|
|
||||||
export async function listProcessedPermits(
|
export async function listProcessedPermits(
|
||||||
params: PageQueryParams,
|
params: PageQueryParams,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
const page = params.page || 1;
|
const page = params.page || 1;
|
||||||
const pageSize = params.pageSize || 10;
|
const pageSize = params.pageSize || 10;
|
||||||
@@ -204,12 +216,12 @@ export async function listProcessedPermits(
|
|||||||
|
|
||||||
let { taggedUsersFilter, taggedUserFilterIndex } = getTaggedUsersFilter(
|
let { taggedUsersFilter, taggedUserFilterIndex } = getTaggedUsersFilter(
|
||||||
filterObj,
|
filterObj,
|
||||||
sortObj,
|
sortObj
|
||||||
);
|
);
|
||||||
|
|
||||||
let { taggedOrgsFilter, taggedOrgsFilterIndex } = getTaggedOrgsFilter(
|
let { taggedOrgsFilter, taggedOrgsFilterIndex } = getTaggedOrgsFilter(
|
||||||
filterObj,
|
filterObj,
|
||||||
sortObj,
|
sortObj
|
||||||
);
|
);
|
||||||
|
|
||||||
if (taggedUserFilterIndex != -1) filterObj.splice(taggedUserFilterIndex, 1);
|
if (taggedUserFilterIndex != -1) filterObj.splice(taggedUserFilterIndex, 1);
|
||||||
@@ -321,7 +333,7 @@ export async function listProcessedPermits(
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
const permitsList = await processedModel.aggregate(pipeline);
|
const permitsList = await processedModel.aggregate(pipeline);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import { getOrg } from "../organization/organization.service";
|
|||||||
|
|
||||||
export async function createRts(
|
export async function createRts(
|
||||||
input: CreateRtsInput,
|
input: CreateRtsInput,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
let defaultClient = input.client;
|
let defaultClient = input.client;
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ export async function getRts(id: string, tenantId: string) {
|
|||||||
|
|
||||||
export async function listRts(
|
export async function listRts(
|
||||||
params: PageQueryParams,
|
params: PageQueryParams,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
const page = params.page || 1;
|
const page = params.page || 1;
|
||||||
const pageSize = params.pageSize || 10;
|
const pageSize = params.pageSize || 10;
|
||||||
@@ -105,12 +105,12 @@ export async function listRts(
|
|||||||
|
|
||||||
let { taggedUsersFilter, taggedUserFilterIndex } = getTaggedUsersFilter(
|
let { taggedUsersFilter, taggedUserFilterIndex } = getTaggedUsersFilter(
|
||||||
filterObj,
|
filterObj,
|
||||||
sortObj,
|
sortObj
|
||||||
);
|
);
|
||||||
|
|
||||||
let { taggedOrgsFilter, taggedOrgsFilterIndex } = getTaggedOrgsFilter(
|
let { taggedOrgsFilter, taggedOrgsFilterIndex } = getTaggedOrgsFilter(
|
||||||
filterObj,
|
filterObj,
|
||||||
sortObj,
|
sortObj
|
||||||
);
|
);
|
||||||
|
|
||||||
if (taggedUserFilterIndex != -1) filterObj.splice(taggedUserFilterIndex, 1);
|
if (taggedUserFilterIndex != -1) filterObj.splice(taggedUserFilterIndex, 1);
|
||||||
@@ -249,7 +249,7 @@ export async function listRts(
|
|||||||
export async function updateRts(
|
export async function updateRts(
|
||||||
id: string,
|
id: string,
|
||||||
input: UpdateRtsInput,
|
input: UpdateRtsInput,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
if (input.assignedToOrg && input.assignedTo) {
|
if (input.assignedToOrg && input.assignedTo) {
|
||||||
delete input.assignedTo;
|
delete input.assignedTo;
|
||||||
@@ -257,7 +257,7 @@ export async function updateRts(
|
|||||||
|
|
||||||
const oldRts = await rtsModel.findOne(
|
const oldRts = await rtsModel.findOne(
|
||||||
{ pid: id },
|
{ pid: id },
|
||||||
{ assignedTo: 1, assignedToOrg: 1 },
|
{ assignedTo: 1, assignedToOrg: 1 }
|
||||||
);
|
);
|
||||||
|
|
||||||
const updatedRts = await rtsModel
|
const updatedRts = await rtsModel
|
||||||
@@ -274,24 +274,24 @@ export async function updateRts(
|
|||||||
{ content: `Updated type to '${input.permitType}'` },
|
{ content: `Updated type to '${input.permitType}'` },
|
||||||
id,
|
id,
|
||||||
"rts",
|
"rts",
|
||||||
user,
|
user
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updatedRts && input.assignedTo) {
|
if (updatedRts && input.assignedTo) {
|
||||||
const newAssignees = arrayDiff(
|
const newAssignees = arrayDiff(
|
||||||
updatedRts.assignedTo.map((item) => item._id),
|
updatedRts.assignedTo.map((item) => item._id),
|
||||||
oldRts.assignedTo,
|
oldRts.assignedTo
|
||||||
);
|
);
|
||||||
|
|
||||||
if (newAssignees.length > 0) {
|
if (newAssignees.length > 0) {
|
||||||
let msg = "Assigned to:\n\n";
|
let msg = "Assigned to:\n\n";
|
||||||
|
|
||||||
for (const assignee of newAssignees) {
|
for (const assignee of newAssignees) {
|
||||||
const user = await getUser(assignee);
|
const assigneeDB = await getUser(assignee);
|
||||||
if (!user) continue;
|
if (!assigneeDB) continue;
|
||||||
|
|
||||||
msg += `${user.firstName + " " + user.lastName}\n`;
|
msg += `${assigneeDB.firstName + " " + assigneeDB.lastName}\n`;
|
||||||
|
|
||||||
await createAlert(
|
await createAlert(
|
||||||
user.tenantId,
|
user.tenantId,
|
||||||
@@ -306,7 +306,10 @@ export async function updateRts(
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
county: updatedRts.county._id.toString(),
|
county: updatedRts.county._id.toString(),
|
||||||
permitType: updatedRts.permitType,
|
permitType: updatedRts.permitType,
|
||||||
},
|
stage: updatedRts.stage,
|
||||||
|
dueDate: updatedRts.dueDate,
|
||||||
|
createdBy: user.userId,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,7 +319,7 @@ export async function updateRts(
|
|||||||
},
|
},
|
||||||
id,
|
id,
|
||||||
"rts",
|
"rts",
|
||||||
user,
|
user
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -346,7 +349,10 @@ export async function updateRts(
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
county: updatedRts.county._id.toString(),
|
county: updatedRts.county._id.toString(),
|
||||||
permitType: updatedRts.permitType,
|
permitType: updatedRts.permitType,
|
||||||
},
|
stage: updatedRts.stage,
|
||||||
|
dueDate: updatedRts.dueDate,
|
||||||
|
createdBy: user.userId,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,7 +366,7 @@ export async function deleteRts(id: string, tenantId: string) {
|
|||||||
export async function newUpload(
|
export async function newUpload(
|
||||||
id: string,
|
id: string,
|
||||||
newUpload: UploadRtsInput,
|
newUpload: UploadRtsInput,
|
||||||
user: AuthenticatedUser,
|
user: AuthenticatedUser
|
||||||
) {
|
) {
|
||||||
return await rtsModel.findOneAndUpdate(
|
return await rtsModel.findOneAndUpdate(
|
||||||
{ pid: id, tenantId: user.tenantId },
|
{ pid: id, tenantId: user.tenantId },
|
||||||
@@ -372,6 +378,6 @@ export async function newUpload(
|
|||||||
createdBy: user.userId,
|
createdBy: user.userId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user