Skip to content

Scheduling infrastructure for absolutely everyone.

Applying feedback from a merged PR (#4887)

Leo Giovanetti0098591a56bf
diff --git a/apps/web/components/booking/BookingListItem.tsx b/apps/web/components/booking/BookingListItem.tsx
index 56ca8bf9fbb..c376c4e88ef 100644
--- a/apps/web/components/booking/BookingListItem.tsx
+++ b/apps/web/components/booking/BookingListItem.tsx
@@ -53,6 +53,16 @@ function BookingListItem(booking: BookingItemProps) {
},
});
+ const isUpcoming = new Date(booking.endTime) >= new Date();
+ const isPast = new Date(booking.endTime) < new Date();
+ const isCancelled = booking.status === BookingStatus.CANCELLED;
+ const isConfirmed = booking.status === BookingStatus.ACCEPTED;
+ const isRejected = booking.status === BookingStatus.REJECTED;
+ const isPending = booking.status === BookingStatus.PENDING;
+ const isRecurring = booking.recurringEventId !== null;
+ const isTabRecurring = booking.listingStatus === "recurring";
+ const isTabUnconfirmed = booking.listingStatus === "unconfirmed";
+
const bookingConfirm = async (confirm: boolean) => {
let body = {
bookingId: booking.id,
@@ -69,16 +79,6 @@ function BookingListItem(booking: BookingItemProps) {
mutation.mutate(body);
};
- const isUpcoming = new Date(booking.endTime) >= new Date();
- const isPast = new Date(booking.endTime) < new Date();
- const isCancelled = booking.status === BookingStatus.CANCELLED;
- const isConfirmed = booking.status === BookingStatus.ACCEPTED;
- const isRejected = booking.status === BookingStatus.REJECTED;
- const isPending = booking.status === BookingStatus.PENDING;
- const isRecurring = booking.recurringEventId !== null;
- const isTabRecurring = booking.listingStatus === "recurring";
- const isTabUnconfirmed = booking.listingStatus === "unconfirmed";
-
const pendingActions: ActionType[] = [
{
id: "reject",
diff --git a/packages/trpc/server/routers/viewer.tsx b/packages/trpc/server/routers/viewer.tsx
index 2eaf991fa72..00ff75643c7 100644
--- a/packages/trpc/server/routers/viewer.tsx
+++ b/packages/trpc/server/routers/viewer.tsx
@@ -454,20 +454,12 @@ const loggedInViewerRouter = createProtectedRouter()
// handled separately for each occurrence
OR: [
{
- AND: [
- { NOT: { recurringEventId: { equals: null } } },
- {
- status: {
- notIn: [BookingStatus.PENDING, BookingStatus.CANCELLED, BookingStatus.REJECTED],
- },
- },
- ],
+ recurringEventId: { not: null },
+ status: { notIn: [BookingStatus.PENDING, BookingStatus.CANCELLED, BookingStatus.REJECTED] },
},
{
- AND: [
- { recurringEventId: { equals: null } },
- { status: { notIn: [BookingStatus.CANCELLED, BookingStatus.REJECTED] } },
- ],
+ recurringEventId: { equals: null },
+ status: { notIn: [BookingStatus.CANCELLED, BookingStatus.REJECTED] },
},
],
},
@@ -495,12 +487,8 @@ const loggedInViewerRouter = createProtectedRouter()
endTime: { gte: new Date() },
OR: [
{
- AND: [
- { NOT: { recurringEventId: { equals: null } } },
- {
- status: { equals: BookingStatus.PENDING },
- },
- ],
+ recurringEventId: { not: null },
+ status: { equals: BookingStatus.PENDING },
},
{
status: { equals: BookingStatus.PENDING },