feat: v2 GET bookings updated at filters and sort (#19133)

* fix: make Booking.updatedAt update automatically

* feat: return updatedAt by bookings endpoints

* feat: GET bookings beforeUpdatedAt, afterUpdatedAt, sortUpdated params

* docs: api

* chore: bump platform-libraries

* refactor: sortUpdated -> sortUpdatedAt query param

* chore: delete wrong migration
This commit is contained in:
Lauris Skraucis authored and GitHub committed 2025-02-11 08:39:50 +00:00
1 parent c211f181fc
commit 08bcc77e2c
14 files changed
+6261 -95

No files matched your search

@@ -201,6 +201,22 @@ export async function getBookings({
};
}
if (filters?.afterUpdatedDate) {
bookingWhereInputFilters.afterUpdatedDate = {
updatedAt: {
gte: dayjs.utc(filters.afterUpdatedDate).toDate(),
},
};
}
if (filters?.beforeUpdatedDate) {
bookingWhereInputFilters.beforeUpdatedDate = {
updatedAt: {
lte: dayjs.utc(filters.beforeUpdatedDate).toDate(),
},
};
}
const filtersCombined: Prisma.BookingWhereInput[] = !filters
? []
: Object.keys(filters)
@@ -10,6 +10,8 @@ export const ZGetInputSchema = z.object({
attendeeName: z.string().optional(),
afterStartDate: z.string().optional(),
beforeEndDate: z.string().optional(),
afterUpdatedDate: z.string().optional(),
beforeUpdatedDate: z.string().optional(),
}),
limit: z.number().min(1).max(100).nullish(),
cursor: z.number().nullish(), // <-- "cursor" needs to exist when using useInfiniteQuery, but can be any type