refactor: remove redundant isRecurring property, use recurrenceRule instead
isRecurring was redundant since recurrenceRule as truthy/falsy check suffices. Removed from shared CalendarEvent type, Mongoose virtual, and all usages.
This commit is contained in:
@@ -37,8 +37,8 @@ export class EventService {
|
||||
const allEvents = await this.eventRepo.findByUserId(userId);
|
||||
|
||||
// Separate recurring and non-recurring events
|
||||
const recurringEvents = allEvents.filter((e) => e.isRecurring);
|
||||
const nonRecurringEvents = allEvents.filter((e) => !e.isRecurring);
|
||||
const recurringEvents = allEvents.filter((e) => e.recurrenceRule);
|
||||
const nonRecurringEvents = allEvents.filter((e) => !e.recurrenceRule);
|
||||
|
||||
// Expand all events (recurring get multiple instances, non-recurring stay as-is)
|
||||
const expanded = expandRecurringEvents(
|
||||
@@ -90,7 +90,7 @@ export class EventService {
|
||||
}
|
||||
|
||||
// For non-recurring events, always delete completely
|
||||
if (!event.isRecurring || !event.recurrenceRule) {
|
||||
if (!event.recurrenceRule) {
|
||||
await this.eventRepo.delete(id);
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user