mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-26 09:20:24 -05:00
* Initial * Start implementing TournamentFormatSelector * Progress * Small progress * Add source * Progress * Skeleton * Progress * Rename progression * Can submit progression * Fix potential issue with caching errors * Settings * isFinals/isUnderground * Valid formats tests * New bracket check in progress * Perf optimization: simulate brackets only frontend * Admin check in fix * resolvesWinner logic * SAME_PLACEMENT_TO_MULTIPLE_BRACKETS * Structure work * Edit bracket while tournament in progress initial * Delayed check in to follow up bracket * Progress validation * NEGATIVE_PROGRESSION * test first sources = null * Different text when invitational * More checks * Validate changed are in preview * Rename * Translated errors * Disbale submti if bracket progression is bad * Adjust bracketIdx * changedBracketProgressionFormat * Progress * Fix E2E tests * Docs progress * Fix state change * Add docs
63 lines
1.2 KiB
TypeScript
63 lines
1.2 KiB
TypeScript
import { z } from "zod";
|
|
import {
|
|
_action,
|
|
checkboxValueToBoolean,
|
|
id,
|
|
modeShort,
|
|
optionalId,
|
|
safeJSONParse,
|
|
stageId,
|
|
} from "~/utils/zod";
|
|
import { TOURNAMENT } from "./tournament-constants";
|
|
|
|
export const teamName = z
|
|
.string()
|
|
.trim()
|
|
.min(1)
|
|
.max(TOURNAMENT.TEAM_NAME_MAX_LENGTH);
|
|
|
|
export const registerSchema = z.union([
|
|
z.object({
|
|
_action: _action("UPSERT_TEAM"),
|
|
teamName,
|
|
prefersNotToHost: z.preprocess(checkboxValueToBoolean, z.boolean()),
|
|
noScreen: z.preprocess(checkboxValueToBoolean, z.boolean()),
|
|
teamId: optionalId,
|
|
}),
|
|
z.object({
|
|
_action: _action("UPDATE_MAP_POOL"),
|
|
mapPool: z.preprocess(
|
|
safeJSONParse,
|
|
z.array(z.object({ stageId, mode: modeShort })),
|
|
),
|
|
}),
|
|
z.object({
|
|
_action: _action("DELETE_TEAM_MEMBER"),
|
|
userId: id,
|
|
}),
|
|
z.object({
|
|
_action: _action("LEAVE_TEAM"),
|
|
}),
|
|
z.object({
|
|
_action: _action("CHECK_IN"),
|
|
}),
|
|
z.object({
|
|
_action: _action("ADD_PLAYER"),
|
|
userId: id,
|
|
}),
|
|
z.object({
|
|
_action: _action("UNREGISTER"),
|
|
}),
|
|
z.object({
|
|
_action: _action("DELETE_LOGO"),
|
|
}),
|
|
]);
|
|
|
|
export const seedsActionSchema = z.object({
|
|
seeds: z.preprocess(safeJSONParse, z.array(id)),
|
|
});
|
|
|
|
export const joinSchema = z.object({
|
|
trust: z.preprocess(checkboxValueToBoolean, z.boolean()),
|
|
});
|