handles scenario where defaultschedule is nil (#8714)
parent
a2e2b0ed34
commit
c6ab889b98
|
@ -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<User>, prisma: PrismaClient) => {
|
||||
|
|
Loading…
Reference in New Issue