Add ability to get, post, and delete for other users if admin

This commit is contained in:
Joe Au-Yeung committed 2022-10-05 11:04:58 -04:00
1 parent 95fc04a453
commit a5413b40ab
2 files changed
+15 -5

No files matched your search

+8 -2
View File
@@ -5,10 +5,16 @@ import { _ScheduleModel as Schedule } from "@calcom/prisma/zod";
const schemaScheduleBaseBodyParams = Schedule.omit({ id: true }).partial();
const schemaScheduleRequiredParams = z.object({
userId: z.number().optional(),
name: z.string(),
});
export const schemaScheduleBodyParams = schemaScheduleBaseBodyParams.merge(schemaScheduleRequiredParams);
export const schemaSchedulePublic = Schedule.omit({});
export const schemaSchedulePublic = z
.object({ id: z.number() })
.merge(Schedule)
.merge(
z.object({
availability: z.array(z.object({ id: z.number() })).optional(),
})
);