[Maintenance] - Allow Deletion of Future Events

Đang mở
#4,516 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

@deepikarul đang làm issue này rồi.

Từ ngày 6/10/2026.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
68/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
api, backend, databases, frontend

Hướng nghiên cứu

Bắt đầu với DeleteSeriesConfirmationModal.tsx và luồng deleteScheduleSlot hiện có, sau đó lần theo CalendarWeekView.tsx, CalendarDayView.tsx, EventClickPopup.tsx, calendar.routes.ts, CalendarController.ts và CalendarService.ts. Hãy lần theo các điểm vào API, mutation và service đã nêu; công việc được xem là hoàn tất khi modal cung cấp các lần xuất hiện trong tương lai, endpoint xóa các slot đáp ứng điều kiện và các view bị ảnh hưởng dùng chung phần xử lý xóa khi phù hợp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

maintenance
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.

Image
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
Image
Ngôn ngữ chính
TypeScript
Star
39
Fork
10
Merge trung bình
3 ngày 18 giờ
Pull request đã merge (30 ngày)
43

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Northeastern-Electric-Racing/FinishLine

Tất cả issue của Northeastern-Electric-Racing/FinishLine

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.