fix: move cancelled upcoming booking to cancelled tab (#883)

* fix: move cancelled upcoming booking to cancelled tab

* fix: lint

* Update server/routers/viewer.tsx

Co-authored-by: Mihai Colceriu <colceriumi@gmail.com>

* fix: also for past bookings

Co-authored-by: Alex Johansson <alexander@n1s.se>
pull/889/head
Mihai C 2021-10-08 18:58:37 +03:00 committed by GitHub
parent 015b7c18af
commit 35dd3f088c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -28,8 +28,8 @@ export const viewerRouter = createProtectedRouter()
const { prisma, user } = ctx;
const bookingListingByStatus = input.status;
const bookingListingFilters: Record<typeof bookingListingByStatus, Prisma.BookingWhereInput[]> = {
upcoming: [{ endTime: { gte: new Date() } }],
past: [{ endTime: { lte: new Date() } }],
upcoming: [{ endTime: { gte: new Date() }, NOT: { status: { equals: BookingStatus.CANCELLED } } }],
past: [{ endTime: { lte: new Date() }, NOT: { status: { equals: BookingStatus.CANCELLED } } }],
cancelled: [{ status: { equals: BookingStatus.CANCELLED } }],
};
const bookingListingOrderby: Record<typeof bookingListingByStatus, Prisma.BookingOrderByInput> = {