Merge pull request #86 from calcom/fix-event-type

fix: event type validations skip
pull/9078/head
Agusti Fernandez Pardo 2022-05-20 03:40:58 +02:00 committed by GitHub
commit 82da509eac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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({