add config routes

This commit is contained in:
2025-02-18 15:10:51 +05:30
parent fc9abbbec4
commit 5d5cee2d7e
8 changed files with 203 additions and 2 deletions

View File

@@ -0,0 +1,33 @@
import { buildJsonSchemas } from "fastify-zod";
import mongoose from "mongoose";
import { z } from "zod";
export const configModel = mongoose.model(
"config",
new mongoose.Schema({
tenantId: {
type: String,
unique: true,
},
statusMap: Object,
updatedAt: Date,
updatedBy: {
type: mongoose.Types.ObjectId,
ref: "user",
},
}),
"config"
);
const updateConfigInput = z.object({
statusMap: z.record(z.string(), z.array(z.string())).optional(),
});
export type UpdateConfigInput = z.infer<typeof updateConfigInput>;
export const { schemas: configSchemas, $ref: $config } = buildJsonSchemas(
{
updateConfigInput,
},
{ $id: "config" }
);