Hi, I’m using node-cron to clean up all expired `I...
# prisma-client
a
Hi, I’m using node-cron to clean up all expired
Invites
every minute, with each having an
expiry
field. How can I use
prisma.invite.deleteMany
and select all documents where the
expiry
date is in the past?
1
Never mind, solved
Copy code
import { toDate } from "date-fns";
import prisma from "../utils/prisma.mjs";

const cleanupInvites = await prisma.invite.deleteMany({
      where: {
        expiry: {
          lte: toDate(Date.now()),
        },
      },
    });