diff --git a/app/models/reservation.server.ts b/app/models/reservation.server.ts index dea3b1d..a5224eb 100644 --- a/app/models/reservation.server.ts +++ b/app/models/reservation.server.ts @@ -1,5 +1,5 @@ import { type User, Prisma } from "@prisma/client"; -import { addDays, addHours, compareAsc, differenceInMinutes, startOfDay, startOfToday } from "date-fns"; +import { addDays, addHours, compareAsc, differenceInMinutes, startOfDay, startOfToday, subDays } from "date-fns"; import { prisma } from "~/db.server"; @@ -24,7 +24,12 @@ export type Reservation = Prisma.ReservationGetPayload // since we allow anonymous requests, we dont return PII export function getReservations() { return prisma.reservation.findMany({ - select: { ...reservationSelect.select } + select: { ...reservationSelect.select }, + where: { + start: { + gt: subDays(startOfToday(), 1) + } + } }); } diff --git a/app/routes/faq.tsx b/app/routes/faq.tsx index edd12bc..b896ab9 100644 --- a/app/routes/faq.tsx +++ b/app/routes/faq.tsx @@ -2,12 +2,12 @@ import type { MetaFunction } from "@remix-run/node"; import { json, useLoaderData } from "@remix-run/react"; import { Header } from "~/components/Header/Header"; -// import { getReservationCount } from "~/models/reservation.server"; +import { getReservationCount } from "~/models/reservation.server"; export const meta: MetaFunction = () => [{ title: "Court dibs - faq" }]; export const loader = async () => - json({ rezCount: "several" /*await getReservationCount()*/ }); + json({ rezCount: await getReservationCount() }); export default function FAQ() { return (