Description
Currently you can either delete a single instance of a recurring schedule slot or all instances of the recurring schedule slot (aka, delete the entire event). The request is to add a third option to delete all future scheduled slots of that event.
Acceptance Criteria
- Add a third option: "All future occurrences (X slots)"
- Create the API endpoint that deletes any future schedule slots
- BONUS:
CalendarWeekView.tsx and CalendarDayView.tsx both have this function (also EventClickPopup.tsx):
const handleSeriesDeleteConfirm = async (deleteEntireEvent: boolean) => {
try {
setShowSeriesDeleteModal(false);
setLockedTooltipEventId(null);
if (deleteEntireEvent) {
await deleteEvent();
toast.success('Event deleted successfully!');
} else {
await deleteScheduleSlot();
toast.success('Event occurrence deleted successfully!');
}
} catch (err) {
if (err instanceof Error) toast.error(err.message);
}
};
- If possible, please merge these all into one shared function from a helper file
Proposed Solution
- Start by removing the logic that is currently in place. As it stands right now, there is a boolean: either all events, or one event. You must turn this into an Enum instead where it is either all events, future events, or the one event. For this you must reformat
setDeleteEntireEvent within DeleteSeriesConfirmationModal.tsx with a new name and for it must take that Enum as its state.
- Add the new
FormControlLabel below the other options
- Create the mutation similar to the one below: (name it useDeleteFutureScheduleSlots
export const useDeleteScheduleSlot = (eventId: string, scheduleSlotId: string) => {
const queryClient = useQueryClient();
return useMutation<Event, Error>(
['events', 'delete-schedule-slot', eventId, scheduleSlotId],
async () => {
const { data } = await postDeleteScheduleSlot(eventId, scheduleSlotId);
return data;
},
{
onSuccess: () => {
queryClient.invalidateQueries(['filter-events']);
queryClient.invalidateQueries(EVENT_KEY);
queryClient.invalidateQueries(['events', eventId]);
}
}
);
};
- Create the axios post similar to: (name it postDeleteFutureScheduleSlots)
export const postDeleteScheduleSlot = async (eventId: string, scheduleSlotId: string) => {
return axios.post<Event>(
apiUrls.calendarDeleteScheduleSlot(eventId, scheduleSlotId),
{},
{
transformResponse: (data) => eventTransformer(JSON.parse(data))
}
);
};
- Make a new route in
calendar.routes.ts similar to this:
calendarRouter.post('/event/:eventId/schedule-slot/:scheduleSlotId/delete', CalendarController.deleteScheduleSlot);
- Make a new function in
CalendarController.ts named deleteFutureScheduleSlots
- Make a function in
CalendarService.ts also named deleteFutureScheduleSlots
- It may be very helpful to follow
deleteScheduleSlot in calendar.service.ts
- Do a prisma call to find all schedule slots after a "selectedDate" (gte stands for Greater Than or Equal to ensure that you also delete the current one seleted as well)
const scheduleSlots = await prisma.schedule_Slot.findMany({
where: {
startTime: {
gte: selectedDate
}
}
});
- Follow the rest of the logic that happens in
deleteScheduleSlot within calendar.service.ts.
Mocks

Description
Currently you can either delete a single instance of a recurring schedule slot or all instances of the recurring schedule slot (aka, delete the entire event). The request is to add a third option to delete all future scheduled slots of that event.
Acceptance Criteria
CalendarWeekView.tsxandCalendarDayView.tsxboth have this function (alsoEventClickPopup.tsx):Proposed Solution
setDeleteEntireEventwithinDeleteSeriesConfirmationModal.tsxwith a new name and for it must take that Enum as its state.FormControlLabelbelow the other optionscalendar.routes.tssimilar to this:CalendarController.tsnamed deleteFutureScheduleSlotsCalendarService.tsalso named deleteFutureScheduleSlotsdeleteScheduleSlotincalendar.service.tsdeleteScheduleSlotwithincalendar.service.ts.Mocks