fix event types
parent
47ce92714b
commit
075808ce40
|
@ -39,6 +39,7 @@ const schemaEventTypeBaseParams = z
|
|||
description: z.string().optional().nullable(),
|
||||
length: z.number().int(),
|
||||
locations: jsonSchema.optional().nullable().or(z.null()),
|
||||
metadata: jsonSchema.optional().nullable().or(z.null()),
|
||||
recurringEvent: jsonSchema.optional().nullable().or(z.null()),
|
||||
})
|
||||
.strict();
|
||||
|
@ -79,8 +80,9 @@ export const schemaEventTypeReadPublic = EventType.pick({
|
|||
beforeEventBuffer: true,
|
||||
afterEventBuffer: true,
|
||||
schedulingType: true,
|
||||
metadata: true,
|
||||
price: true,
|
||||
currency: true,
|
||||
slotInterval: true,
|
||||
successRedirectUrl: true,
|
||||
}).partial();
|
||||
}).merge(schemaEventTypeBaseParams);
|
||||
|
|
|
@ -30,7 +30,7 @@ async function createOrlistAllEventTypes(
|
|||
* description: No event types were found
|
||||
*/
|
||||
const data = await prisma.eventType.findMany({ where: { userId } });
|
||||
const event_types = data.map((eventType) => (eventType.metadata = {}));
|
||||
const event_types = data.map((eventType) => schemaEventTypeReadPublic.parse(eventType));
|
||||
if (event_types) res.status(200).json({ event_types });
|
||||
else
|
||||
(error: Error) =>
|
||||
|
|
Loading…
Reference in New Issue