import { ValidationError } from "./chunk-ER4KPD22.js"; // api/middlewares/validate.ts import { ZodError } from "zod"; var validateBody = (schema) => { return (req, _res, next) => { try { req.body = schema.parse(req.body); next(); } catch (error) { if (error instanceof ZodError) { next(new ValidationError("Request validation failed", { issues: error.issues })); } else { next(error); } } }; }; var validateQuery = (schema) => { return (req, _res, next) => { try { req.query = schema.parse(req.query); next(); } catch (error) { if (error instanceof ZodError) { next(new ValidationError("Query validation failed", { issues: error.issues })); } else { next(error); } } }; }; export { validateBody, validateQuery };