- feat: order confirmation PDF generation with VAT support - feat: order confirmation modal with custom item editing - fix: attendance negative duration clamping and switchProject timing - fix: Quill editor locked to Tahoma 14px, PDF heading sizes - fix: invoice/offer PDF font consistency (Tahoma enforcement) - fix: invoice alert cron improvements - fix: NAS financials manager edge cases - refactor: numbering service with unique sequence constraints Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
import { z } from "zod";
|
|
|
|
const safeProjectNumber = z
|
|
.string()
|
|
.regex(/^[\p{L}\p{N}_\-.]+$/u, "Číslo projektu obsahuje nepovolené znaky")
|
|
.nullish();
|
|
|
|
export const CreateProjectSchema = z.object({
|
|
project_number: safeProjectNumber,
|
|
name: z.string().nullish(),
|
|
customer_id: z
|
|
.union([z.number(), z.string()])
|
|
.transform((v) => Number(v))
|
|
.nullish(),
|
|
responsible_user_id: z
|
|
.union([z.number(), z.string()])
|
|
.transform((v) => Number(v))
|
|
.nullish(),
|
|
quotation_id: z
|
|
.union([z.number(), z.string()])
|
|
.transform((v) => Number(v))
|
|
.nullish(),
|
|
order_id: z
|
|
.union([z.number(), z.string()])
|
|
.transform((v) => Number(v))
|
|
.nullish(),
|
|
status: z.string().optional().default("aktivni"),
|
|
start_date: z.string().nullish(),
|
|
end_date: z.string().nullish(),
|
|
notes: z.string().nullish(),
|
|
});
|
|
|
|
export const UpdateProjectSchema = z.object({
|
|
name: z.string().nullish(),
|
|
status: z.string().optional(),
|
|
notes: z.string().nullish(),
|
|
customer_id: z.union([z.number(), z.string(), z.null()]).optional(),
|
|
responsible_user_id: z.union([z.number(), z.string(), z.null()]).optional(),
|
|
quotation_id: z.union([z.number(), z.string(), z.null()]).optional(),
|
|
order_id: z.union([z.number(), z.string(), z.null()]).optional(),
|
|
start_date: z.union([z.string(), z.null()]).optional(),
|
|
end_date: z.union([z.string(), z.null()]).optional(),
|
|
});
|
|
|
|
export const CreateProjectNoteSchema = z.object({
|
|
content: z.string().nullish(),
|
|
});
|
|
|
|
export type CreateProjectInput = z.infer<typeof CreateProjectSchema>;
|
|
export type UpdateProjectInput = z.infer<typeof UpdateProjectSchema>;
|
|
export type CreateProjectNoteInput = z.infer<typeof CreateProjectNoteSchema>;
|