feat: make assignedTo field accept multiple values for all collections

This commit is contained in:
2025-11-18 13:32:47 +05:30
parent b7f63479a6
commit 8f5c0a1827
12 changed files with 202 additions and 108 deletions

View File

@@ -1,5 +1,5 @@
import { buildJsonSchemas } from "fastify-zod";
import mongoose from "mongoose";
import mongoose, { Schema } from "mongoose";
import { z } from "zod";
import { pageQueryParams } from "../pagination";
@@ -27,7 +27,7 @@ const notificationSchema = new mongoose.Schema({
createdAt: Date,
updatedAt: Date,
assignedTo: {
type: mongoose.Types.ObjectId,
type: [Schema.Types.ObjectId],
ref: "user",
},
taggedUsers: Array,
@@ -52,12 +52,12 @@ const createNotificationInput = z.object({
county: z.object({}).passthrough(),
client: z.string(),
clientData: z.object({}).passthrough(),
assignedTo: z.string().optional(),
assignedTo: z.array(z.string()).optional(),
});
const updateNotificationInput = z.object({
status: z.string().optional(),
assignedTo: z.string().optional(),
assignedTo: z.array(z.string()).optional(),
});
export type CreateNotificationInput = z.infer<typeof createNotificationInput>;