added default views routes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { buildJsonSchemas } from "fastify-zod";
|
||||
import mongoose from "mongoose";
|
||||
import { z } from "zod";
|
||||
import { TypeOf, z } from "zod";
|
||||
import { pageQueryParams } from "../pagination";
|
||||
|
||||
export const viewModel = mongoose.model(
|
||||
@@ -54,11 +54,28 @@ const updateViewInput = z.object({
|
||||
export type CreateViewInput = z.infer<typeof createViewInput>;
|
||||
export type UpdateViewInput = z.infer<typeof updateViewInput>;
|
||||
|
||||
export const defaultViewModel = mongoose.model(
|
||||
"defaultView",
|
||||
new mongoose.Schema({
|
||||
userId: {
|
||||
type: mongoose.Types.ObjectId,
|
||||
ref: "user",
|
||||
},
|
||||
defaultViews: Object,
|
||||
}),
|
||||
"defaultView"
|
||||
);
|
||||
|
||||
const setDefaultView = z.record(z.string(), z.string());
|
||||
|
||||
export type SetDefaultView = z.infer<typeof setDefaultView>;
|
||||
|
||||
export const { schemas: viewSchemas, $ref: $view } = buildJsonSchemas(
|
||||
{
|
||||
createViewInput,
|
||||
updateViewInput,
|
||||
pageQueryParams,
|
||||
setDefaultView,
|
||||
},
|
||||
{ $id: "view" }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user