feat: Add originalStartTime to event DTOs and service to correctly identify and manage event exceptions in the UI.
This commit is contained in:
@@ -36,10 +36,15 @@ export class SingleEventDashboardEventActivation {
|
||||
|
||||
const event = this.event();
|
||||
console.info('setEventOccurrenceActivation', event);
|
||||
const eventId = this.event()?.id!;
|
||||
const startTime = this.event()?.startTime!;
|
||||
const eventId = event?.id!;
|
||||
const originalStartTime = event?.originalStartTime!;
|
||||
let payload: CreateExceptionDto | undefined;
|
||||
const eventException = event?.exceptions?.length ? event.exceptions[0] : undefined;
|
||||
|
||||
// Correctly find the exception that matches this specific occurrence
|
||||
const eventException = event?.exceptions?.find(ex =>
|
||||
new Date(ex.originalStartTime).getTime() === new Date(originalStartTime).getTime()
|
||||
);
|
||||
|
||||
if (eventException) {
|
||||
payload = {
|
||||
...eventException,
|
||||
@@ -50,7 +55,7 @@ export class SingleEventDashboardEventActivation {
|
||||
};
|
||||
} else {
|
||||
payload = {
|
||||
originalStartTime: new Date(startTime),
|
||||
originalStartTime: new Date(originalStartTime),
|
||||
isCancelled: !activated,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ export type BookingWithUserDto = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
export interface EventExceptionDto{
|
||||
export interface EventExceptionDto {
|
||||
id: number,
|
||||
description: string;
|
||||
eventId: number;
|
||||
@@ -33,6 +33,7 @@ export type CalendarEventDto = {
|
||||
id: number;
|
||||
title: string;
|
||||
startTime: string,
|
||||
originalStartTime: string,
|
||||
endTime: string,
|
||||
description: string,
|
||||
isModified?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user