add calendar dashboard edit

This commit is contained in:
Schneider Roland
2025-12-08 16:40:19 +01:00
parent cacc04a217
commit 2e2f37ab86
16 changed files with 194 additions and 69 deletions

View File

@@ -51,6 +51,7 @@ type BookingWithUserDto = {
// The final shape of a calendar event occurrence
export type CalendarEventDto = Omit<Event, 'bookings'> & {
isModified?: boolean;
isCancelled?: boolean;
eventBookings: BookingWithUserDto[];
};
@@ -170,16 +171,20 @@ export class CalendarService {
);
if (exception) {
if (exception.isCancelled) continue;
// if (exception.isCancelled) continue;
// This is a MODIFIED occurrence
const key = `${event.id}-${exception.newStartTime.getTime()}`;
const key = `${event.id}-${exception.newStartTime?.getTime() || occurrenceDate.getTime()}`;
recurringOccurrences.push({
...event,
startTime: exception.newStartTime,
endTime: exception.newEndTime,
// startTime: exception.newStartTime || occurrenceDate,
startTime: exception.newStartTime || occurrenceDate,
endTime:
exception.newEndTime ||
new Date(occurrenceDate.getTime() + duration),
isModified: true,
eventBookings: bookingMap.get(key) || [],
isCancelled: !!exception.isCancelled,
});
} else {
// This is a REGULAR occurrence

View File

@@ -1,4 +1,10 @@
import { IsDate, IsNotEmpty, IsOptional, IsString, IsBoolean } from 'class-validator';
import {
IsDate,
IsNotEmpty,
IsOptional,
IsString,
IsBoolean,
} from 'class-validator';
import { Type } from 'class-transformer';
export class CreateExceptionDto {
@@ -28,4 +34,4 @@ export class CreateExceptionDto {
@IsOptional()
@IsString()
description?: string;
}
}