feat(bookings): implement Booking UID filter for bookings data table. (#21380)

Fixes: #21357
This commit is contained in:
Akarsh Jain authored and GitHub committed 2025-05-21 11:51:50 -04:00
1 parent 1dca160db0
commit f84c8239e7
6 files changed
+37 -1

No files matched your search

@@ -28,6 +28,7 @@ type GetOptions = {
eventTypeIds?: number[] | undefined;
attendeeEmail?: string | TextFilterValue;
attendeeName?: string | TextFilterValue;
bookingUid?: string | undefined;
};
sort?: SortOptions;
};
@@ -81,6 +81,16 @@ export class GetBookingsInput_2024_08_13 {
})
attendeeName?: string;
@IsString()
@IsOptional()
@ApiProperty({
type: String,
required: false,
description: "Filter bookings by the booking Uid.",
example: "2NtaeaVcKfpmSZ4CthFdfk",
})
bookingUid?: string;
@IsOptional()
@Transform(({ value }) => {
if (typeof value === "string") {
@@ -355,7 +355,12 @@ export async function getBookings({
}
}
// 6. Booking Start/End Time Range Filters
// 6. Filter by Booking Uid (if provided)
if (filters?.bookingUid) {
fullQuery = fullQuery.where("Booking.uid", "=", filters.bookingUid.trim());
}
// 7. Booking Start/End Time Range Filters
if (filters?.afterStartDate) {
fullQuery = fullQuery.where("Booking.startTime", ">=", dayjs.utc(filters.afterStartDate).toDate());
}
@@ -10,6 +10,7 @@ export const ZGetInputSchema = z.object({
eventTypeIds: z.number().array().optional(),
attendeeEmail: z.union([z.string(), ZTextFilterValue]).optional(),
attendeeName: z.union([z.string(), ZTextFilterValue]).optional(),
bookingUid: z.string().optional(),
afterStartDate: z.string().optional(),
beforeEndDate: z.string().optional(),
afterUpdatedDate: z.string().optional(),