mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-11 21:29:09 -05:00
24 lines
624 B
TypeScript
24 lines
624 B
TypeScript
import { SeedVariationsSchema } from "~/validators/seedVariations";
|
|
import { seed } from "../prisma/seed/script";
|
|
import type { Express } from "express";
|
|
|
|
declare module "express-session" {
|
|
export interface SessionData {
|
|
returnTo?: string;
|
|
}
|
|
}
|
|
|
|
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();
|
|
});
|
|
}
|