Files
leim-tools/models/CalendarConfig.ts
Alexis c99059d9a8 Fixed event popover not closing on submit
This was caused by a random stray isLoading
2024-12-19 14:01:05 +01:00

31 lines
797 B
TypeScript

import { z } from "zod"
import type { CalendarEvent } from "./CalendarEvent"
import { calendarMonthSchema, type CalendarMonth } from "./CalendarMonth"
import { dateSchema, type RPGDate } from "./Date"
import type { World } from "./World"
export type CalendarState = "published" | "draft" | "archived"
export interface CalendarConfig {
months: CalendarMonth[]
today: RPGDate
}
export interface Calendar extends CalendarConfig {
id?: number
shortId?: string
name: string
events: CalendarEvent[]
state: CalendarState
color?: string
world?: World
}
export const postCalendarSchema = z.object({
name: z.string(),
today: dateSchema.optional().nullable(),
color: z.string().optional().nullable(),
months: z.array(calendarMonthSchema).min(1),
worldId: z.number().int(),
})