add calendar dashboard edit
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user