feat: let bot R/W RTS, add fileValidationStatus to RTS

This commit is contained in:
2025-09-17 17:25:43 +05:30
parent b2268e52df
commit 3e15e55ea2
3 changed files with 5 additions and 1 deletions

View File

@@ -55,6 +55,7 @@ const rtsSchema = new mongoose.Schema({
ref: "user", ref: "user",
}, },
taggedUsers: Array, taggedUsers: Array,
fileValidationStatus: String,
}); });
export const rtsFields = Object.keys(rtsSchema.paths).filter( export const rtsFields = Object.keys(rtsSchema.paths).filter(
@@ -110,6 +111,7 @@ const rtsUpdateInput = z.object({
.optional(), .optional(),
assignedTo: z.string().optional(), assignedTo: z.string().optional(),
status: z.string().optional(), status: z.string().optional(),
fileValidationStatus: z.string().optional(),
}); });
const rtsNewUpload = z.object({ const rtsNewUpload = z.object({

View File

@@ -37,6 +37,7 @@ export async function createRts(
client: user.role == "client" ? defaultClient : input.client, client: user.role == "client" ? defaultClient : input.client,
createdAt: new Date(), createdAt: new Date(),
createdBy: user.userId ?? null, createdBy: user.userId ?? null,
fileValidationStatus: "pending",
}); });
await createAlert( await createAlert(
@@ -162,6 +163,7 @@ export async function listRts(
priority: 1, priority: 1,
dueDate: 1, dueDate: 1,
taggedUsers: 1, taggedUsers: 1,
fileValidationStatus: 1,
county: { county: {
$let: { $let: {
vars: { county: { $arrayElemAt: ["$countyRec", 0] } }, vars: { county: { $arrayElemAt: ["$countyRec", 0] } },

View File

@@ -164,7 +164,7 @@ export const rules: Record<
}, },
}, },
bot: { bot: {
claims: ["file:download", "note:write"], claims: ["file:download", "note:write", "rts:read", "rts:write"],
hiddenFields: { hiddenFields: {
orgs: ["__v"], orgs: ["__v"],
permits: ["__v"], permits: ["__v"],