Bailey Granam
05/21/2022, 7:41 PMwhere statement. For now I am using a raw query but would rather not if possible.
Current:
SELECT "Resource".*
    FROM "Resource"
    LEFT JOIN "Appointment" ON "Appointment"."resourceId" = "Resource"."id"
    WHERE "Appointment"."id" IS NULL
    OR NOT (
        "Appointment"."startAt" < ${range.endDate}
        AND ("Appointment"."startAt" + INTERVAL '1 Minute' * "Appointment"."duration") > ${range.startDate}
    );
Desired:
prisma.resource.findMany({
    where: {
      appointments: {
        none: {
          startAt: { lt: range.endDate },
          // How do I query:
          // ("Appointment"."startAt" + INTERVAL '1 Minute' * "Appointment"."duration") > ${range.startDate}
        },
      },
    },
  });Nurul
05/24/2022, 12:17 PM