add notification routes

This commit is contained in:
2025-02-05 13:52:04 +05:30
parent 8559aab3da
commit 2d62e9712b
8 changed files with 193 additions and 1 deletions

View File

@@ -0,0 +1,50 @@
import { buildJsonSchemas } from "fastify-zod";
import mongoose from "mongoose";
import { z } from "zod";
import { pageQueryParams } from "../pagination";
const notificationSchema = new mongoose.Schema({
pid: {
type: String,
unique: true,
},
tenantId: String,
permitNumber: String,
permitLink: String,
status: String,
changes: Object,
county: {
type: mongoose.Types.ObjectId,
ref: "organization",
},
client: {
type: mongoose.Types.ObjectId,
ref: "organization",
},
createdAt: Date,
updatedAt: Date,
});
export const notificationFields = Object.keys(notificationSchema.paths).filter(
(path) => path !== "__v"
);
export const notificationModel = mongoose.model(
"notification",
notificationSchema
);
const updateNotificationInput = z.object({
status: z.string(),
});
export type UpdateNotificationInput = z.infer<typeof updateNotificationInput>;
export const { schemas: notificationSchemas, $ref: $notification } =
buildJsonSchemas(
{
updateNotificationInput,
pageQueryParams,
},
{ $id: "notification" }
);