- NAS storage for created invoices (PDF via puppeteer), received invoices, and offers with auto-save on create/edit - Deterministic file paths derived from DB fields (no file_path column needed) - Separate NAS mount points: NAS_FINANCIALS_PATH, NAS_OFFERS_PATH - Invoice language field (cs/en) stored per invoice, replaces lang modal - Invoices list filtered by month/year matching KPI card selection - Centralized date helpers (src/utils/date.ts) replacing all .toISOString() calls that returned UTC instead of local time - Attendance project switching uses exact time (not rounded) - Comment cleanup: removed ~100 unnecessary/Czech comments - Removed as-any casts in orders and attendance - Prisma migrations: add invoice language, drop received_invoices BLOB columns Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import { z } from "zod";
|
|
|
|
export const CreateVehicleSchema = z.object({
|
|
spz: z.string().min(1, "SPZ je povinná"),
|
|
name: z.string().min(1, "Název je povinný"),
|
|
brand: z.string().nullish(),
|
|
model: z.string().nullish(),
|
|
initial_km: z
|
|
.union([z.number(), z.string()])
|
|
.transform((v) => Number(v))
|
|
.optional()
|
|
.default(0),
|
|
actual_km: z
|
|
.union([z.number(), z.string()])
|
|
.transform((v) => Number(v))
|
|
.optional()
|
|
.default(0),
|
|
is_active: z
|
|
.preprocess((v) => v === true || v === 1 || v === "1", z.boolean())
|
|
.optional()
|
|
.default(true),
|
|
});
|
|
|
|
export const UpdateVehicleSchema = z.object({
|
|
spz: z.string().optional(),
|
|
name: z.string().optional(),
|
|
brand: z.string().nullish(),
|
|
model: z.string().nullish(),
|
|
initial_km: z
|
|
.union([z.number(), z.string()])
|
|
.transform((v) => Number(v))
|
|
.optional(),
|
|
actual_km: z
|
|
.union([z.number(), z.string()])
|
|
.transform((v) => Number(v))
|
|
.optional(),
|
|
is_active: z
|
|
.preprocess((v) => v === true || v === 1 || v === "1", z.boolean())
|
|
.optional(),
|
|
});
|
|
|
|
export type CreateVehicleInput = z.infer<typeof CreateVehicleSchema>;
|
|
export type UpdateVehicleInput = z.infer<typeof UpdateVehicleSchema>;
|