fix: resolve TypeScript compilation errors from service extraction

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-03-23 09:11:04 +01:00
parent 28eb58946f
commit c0b8a94210
8 changed files with 34 additions and 29 deletions

View File

@@ -1,11 +1,11 @@
import { ZodSchema, ZodError } from 'zod';
import { ZodSchema, z } from 'zod';
export function parseBody<T>(schema: ZodSchema<T>, body: unknown): { data: T } | { error: string } {
try {
return { data: schema.parse(body) };
} catch (e) {
if (e instanceof ZodError) {
return { error: e.errors.map(err => err.message).join(', ') };
if (e instanceof z.ZodError) {
return { error: e.issues.map((err: z.ZodIssue) => err.message).join(', ') };
}
return { error: 'Neplatný požadavek' };
}