mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-09 12:13:10 -05:00
18 lines
514 B
TypeScript
18 lines
514 B
TypeScript
import { SeedVariationsSchema } from "~/utils/schemas";
|
|
import { seed } from "../prisma/seed/script";
|
|
import type { Express } from "express";
|
|
|
|
export function setUpSeed(app: Express): void {
|
|
if (process.env.NODE_ENV !== "development") return;
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
app.post("/seed", async (req, res) => {
|
|
const variation = SeedVariationsSchema.optional().parse(
|
|
req.query.variation
|
|
);
|
|
await seed(variation);
|
|
|
|
res.status(200).end();
|
|
});
|
|
}
|