Scheduling infrastructure for absolutely everyone.
fix: moves event-types to find user including it's event-types
Agusti Fernandez Pardo8f9a970fb63a
diff --git a/pages/api/event-types/index.ts b/pages/api/event-types/index.tsindex c3a7cc954f5..610743baacf 100644--- a/pages/api/event-types/index.ts+++ b/pages/api/event-types/index.ts@@ -29,15 +29,17 @@ async function createOrlistAllEventTypes(* 404:* description: No event types were found*/- const data = await prisma.eventType- .findMany({ where: { userId } })+ const data = await prisma.user+ .findUnique({+ where: { id: userId },+ rejectOnNotFound: true,+ select: { eventTypes: true },+ }).catch((error) => res.status(404).json({ message: "No event types were found", error }));- console.log("eventTypes:", data);- console.log("userId:", userId);// const event_types = data.map(// async (eventType) => await schemaEventTypeReadPublic.safeParseAsync(eventType)// );- if (data) res.status(200).json({ event_types: data });+ if (data) res.status(200).json({ event_types: data.eventTypes });else(error: Error) =>res.status(404).json({