mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-26 09:20:24 -05:00
* Initial * Calendar initial * Extract EventCalendar * Events list initial * Winners * SQL fixes * List events by series * Leaderboards * Series leaderboard * Own entry peek * Edit page skeleton * RHF initial test * RHF stuff * Form etc. progress * Fix tournament series description * Fix tabs layout * Fix socials insert * Check for not removing admin * Adding series * TODOs * Allow updating org with no series * FormFieldset * Allow series without events * TextAreaFormfield accepting array syntax * Input form array field * ToggleFormField * SelectFormField * UserSearchFormField * Fetch badgeOptions * Badge editing * Progress * Use native preventScrollReset * Rename func * Fix sticky scroll * Fix translation * i18n errors * handle,meta in edit * Add ref to user search * TODOs * Done
30 lines
676 B
TypeScript
30 lines
676 B
TypeScript
import type { ActionFunction } from "@remix-run/node";
|
|
import { z } from "zod";
|
|
import { seed } from "~/db/seed";
|
|
import { parseRequestPayload } from "~/utils/remix";
|
|
|
|
const seedSchema = z.object({
|
|
variation: z
|
|
.enum(["NO_TOURNAMENT_TEAMS", "DEFAULT", "REG_OPEN", "SMALL_SOS"])
|
|
.nullish(),
|
|
});
|
|
|
|
export type SeedVariation = NonNullable<
|
|
z.infer<typeof seedSchema>["variation"]
|
|
>;
|
|
|
|
export const action: ActionFunction = async ({ request }) => {
|
|
if (process.env.NODE_ENV === "production") {
|
|
throw new Response(null, { status: 400 });
|
|
}
|
|
|
|
const { variation } = await parseRequestPayload({
|
|
request,
|
|
schema: seedSchema,
|
|
});
|
|
|
|
await seed(variation);
|
|
|
|
return null;
|
|
};
|