diff --git a/packages/trpc/server/routers/viewer/availability/util.ts b/packages/trpc/server/routers/viewer/availability/util.ts index 94b3621274..74ce058b82 100644 --- a/packages/trpc/server/routers/viewer/availability/util.ts +++ b/packages/trpc/server/routers/viewer/availability/util.ts @@ -27,7 +27,12 @@ export const getDefaultScheduleId = async (userId: number, prisma: PrismaClient) }, }); - return defaultSchedule?.id; // TODO: Handle no schedules AT ALL + if (!defaultSchedule) { + // Handle case where defaultSchedule is null by throwing an error + throw new Error("No schedules found for user"); + } + + return defaultSchedule.id; }; export const hasDefaultSchedule = async (user: Partial, prisma: PrismaClient) => {