feat: add recurring event deletion with three modes
Implement three deletion modes for recurring events: - single: exclude specific occurrence via EXDATE mechanism - future: set RRULE UNTIL to stop future occurrences - all: delete entire event series Changes include: - Add exceptionDates field to CalendarEvent model - Add RecurringDeleteMode type and DeleteRecurringEventDTO - EventService.deleteRecurring() with mode-based logic using rrule library - EventController DELETE endpoint accepts mode/occurrenceDate query params - recurrenceExpander filters out exception dates during expansion - AI tools support deleteMode and occurrenceDate for proposed deletions - ChatService.confirmEvent() handles recurring delete modes - New DeleteEventModal component for unified delete confirmation UI - Calendar screen integrates modal for both recurring and non-recurring events
This commit is contained in:
@@ -47,4 +47,17 @@ export class MongoEventRepository implements EventRepository {
|
||||
const result = await EventModel.findByIdAndDelete(id);
|
||||
return result !== null;
|
||||
}
|
||||
|
||||
async addExceptionDate(
|
||||
id: string,
|
||||
date: string,
|
||||
): Promise<CalendarEvent | null> {
|
||||
const event = await EventModel.findByIdAndUpdate(
|
||||
id,
|
||||
{ $addToSet: { exceptionDates: date } },
|
||||
{ new: true },
|
||||
);
|
||||
if (!event) return null;
|
||||
return event.toJSON() as unknown as CalendarEvent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,10 @@ const EventSchema = new Schema<
|
||||
recurrenceRule: {
|
||||
type: String,
|
||||
},
|
||||
exceptionDates: {
|
||||
type: [String],
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
|
||||
Reference in New Issue
Block a user