mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-22 11:05:09 -05:00
all rotations backend route
This commit is contained in:
18
pages/api/sr/rotations.ts
Normal file
18
pages/api/sr/rotations.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import prisma from "prisma/client";
|
||||
|
||||
const rotationsHandler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method !== "GET") {
|
||||
return res.status(405).end();
|
||||
}
|
||||
|
||||
const rotations = await prisma.salmonRunRotation.findMany({
|
||||
where: { startTime: { lt: new Date() } },
|
||||
orderBy: { id: "desc" },
|
||||
select: { id: true, startTime: true, weapons: true, stage: true },
|
||||
});
|
||||
|
||||
res.status(200).json(rotations);
|
||||
};
|
||||
|
||||
export default rotationsHandler;
|
||||
Reference in New Issue
Block a user