feat(plan): bulk entry creation endpoint + service

This commit is contained in:
BOHA
2026-06-08 11:58:56 +02:00
parent 6db87bf4ae
commit 95ca258718
4 changed files with 385 additions and 0 deletions

View File

@@ -83,3 +83,26 @@ export const PlanGridQuerySchema = z.object({
date_to: isoDate,
view: z.enum(["week", "month"]).default("week"),
});
export const BulkPlanEntrySchema = z
.object({
user_ids: z
.array(intFromForm)
.min(1, "Vyberte alespoň jednoho zaměstnance"),
date_from: isoDate,
date_to: isoDate,
include_weekends: z
.union([z.boolean(), z.string()])
.transform((v) => v === true || v === "true" || v === "1")
.default(false),
project_id: z
.union([z.number(), z.string(), z.null()])
.transform((v) => (v === null ? null : Number(v)))
.nullish(),
category: planCategoryEnum.default("work"),
note: z.string().max(500, "Maximálně 500 znaků").default(""),
})
.refine((v) => v.date_to >= v.date_from, {
message: "Datum do musí být stejné nebo po datumu od",
path: ["date_to"],
});