basic booking load behavior
This commit is contained in:
@@ -607,15 +607,16 @@ export class CalendarService {
|
||||
eventId: number,
|
||||
queryParams: CalendarGetBookingDto,
|
||||
): Promise<CalenderControllerGetBookingResponse> {
|
||||
console.info('getBookings', userId, eventId);
|
||||
await Promise.resolve();
|
||||
const { page = 1, limit = 0 } = queryParams;
|
||||
// const { page = 1, limit = 0, sortBy, order } = queryParams;
|
||||
// const { page = 1, limit = 0 } = queryParams;
|
||||
const { page = 1, limit = 0, order } = queryParams;
|
||||
const findOptions: FindManyOptions<Booking> = {
|
||||
where: {
|
||||
eventId: eventId,
|
||||
occurrenceStartTime: queryParams.startTime,
|
||||
},
|
||||
order: {
|
||||
['createdAt']: order!,
|
||||
},
|
||||
};
|
||||
const paginated = limit > 0;
|
||||
const [data, totalItems] =
|
||||
|
||||
@@ -22,6 +22,9 @@ export class BookingResponseDto {
|
||||
@ApiProperty({ nullable: true })
|
||||
canceledAt?: string;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
createdAt?: string; // ISO String for the client
|
||||
|
||||
// Flattened User Info (Avoid sending the whole User object)
|
||||
@ApiProperty({
|
||||
nullable: true,
|
||||
@@ -36,6 +39,7 @@ export class BookingResponseDto {
|
||||
this.notes = booking.notes;
|
||||
this.reservedSeatsCount = booking.reservedSeatsCount;
|
||||
this.canceledAt = booking.canceledAt?.toISOString() || undefined;
|
||||
this.createdAt = booking.createdAt?.toISOString() || undefined;
|
||||
|
||||
// Safety check: Only map user if relation is loaded
|
||||
if (booking.user) {
|
||||
|
||||
Reference in New Issue
Block a user