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