fix: apply standard pagination to /bookings (#19973)
* fix: apply standard pagination to /bookings * rename params * fix type error --------- Co-authored-by: Benny Joo <[email protected]> Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
6 files changed
+204
-256
No files matched your search
@@ -77,7 +77,7 @@ const getAllUserBookings = async ({ ctx, filters, bookingListingByStatus, take,
|
||||
|
||||
const combinedFilters = bookingListingByStatus.map((status) => bookingListingFilters[status]);
|
||||
|
||||
const { bookings, recurringInfo } = await getBookings({
|
||||
const { bookings, recurringInfo, totalCount } = await getBookings({
|
||||
user,
|
||||
prisma,
|
||||
passedBookingsStatusFilter: {
|
||||
@@ -89,18 +89,10 @@ const getAllUserBookings = async ({ ctx, filters, bookingListingByStatus, take,
|
||||
skip,
|
||||
});
|
||||
|
||||
const bookingsFetched = bookings.length;
|
||||
let nextCursor: typeof skip | null = skip;
|
||||
if (bookingsFetched > take) {
|
||||
nextCursor += bookingsFetched;
|
||||
} else {
|
||||
nextCursor = null;
|
||||
}
|
||||
|
||||
return {
|
||||
bookings,
|
||||
recurringInfo,
|
||||
nextCursor,
|
||||
totalCount,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user