fix: event type validations skip

pull/9078/head
Agusti Fernandez Pardo 2022-05-20 03:40:14 +02:00
parent d991c68b08
commit 1717f14e83
2 changed files with 6 additions and 4 deletions

View File

@ -153,10 +153,10 @@ interface EventTypeExtended extends Omit<EventType, "recurringEvent" | "location
// EventType
export type EventTypeResponse = BaseResponse & {
event_type?: Partial<EventTypeExtended>;
event_type?: Partial<EventType | EventTypeExtended>;
};
export type EventTypesResponse = BaseResponse & {
event_types?: Partial<EventTypeExtended>[];
event_types?: Partial<EventType | EventTypeExtended>[];
};
// Payment

View File

@ -30,8 +30,10 @@ async function createOrlistAllEventTypes(
* description: No event types were found
*/
const data = await prisma.eventType.findMany({ where: { userId } });
const event_types = data.map((eventType) => schemaEventTypeReadPublic.parse(eventType));
if (event_types) res.status(200).json({ event_types });
// const event_types = data.map(
// async (eventType) => await schemaEventTypeReadPublic.safeParseAsync(eventType)
// );
if (data) res.status(200).json({ event_types: data });
else
(error: Error) =>
res.status(404).json({