Added category creation interface
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod"
|
||||
import { categorySchema, type Category } from "./Category"
|
||||
import type { Category } from "./Category"
|
||||
import { dateSchema, type RPGDate } from "./Date"
|
||||
|
||||
export interface CalendarEvent {
|
||||
@@ -26,7 +26,11 @@ export const postEventBodySchema = z.object({
|
||||
startDate: dateSchema.required(),
|
||||
endDate: dateSchema.optional().nullable(),
|
||||
hidden: z.boolean().optional().nullable(),
|
||||
category: categorySchema.optional().nullable(),
|
||||
category: z.object({
|
||||
id: z.number().int(),
|
||||
name: z.string(),
|
||||
color: z.string().default("black")
|
||||
}).optional().nullable(),
|
||||
}),
|
||||
calendarId: z.number({ coerce: true }).int().positive()
|
||||
})
|
||||
|
||||
@@ -2,13 +2,15 @@ import { z } from "zod"
|
||||
import type { RPGColor } from "./Color"
|
||||
|
||||
export interface Category {
|
||||
id: number
|
||||
id?: number
|
||||
name: string
|
||||
color?: RPGColor
|
||||
}
|
||||
|
||||
export const categorySchema = z.object({
|
||||
id: z.number().int(),
|
||||
name: z.string(),
|
||||
color: z.string().default("black"),
|
||||
category: z.object({
|
||||
name: z.string(),
|
||||
color: z.string().default("black"),
|
||||
}),
|
||||
calendarId: z.number({ coerce: true }).int().positive()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user