Description
Implement a robust Zod validation schema for expense creation requests in the backend API to ensure all incoming payload fields (such as description, amount, currency, and participants) are correctly typed and formatted before processing.
Context & Requirements
The Mergepay backend uses Fastify and Zod for input validation. Currently, some expense endpoints lack comprehensive request body validation, risking malformed data entering the database or settlement services. We need a dedicated Zod schema for expense creation matching the client types in mergepay-web.
Acceptance Criteria
Implementation Guidance
- Likely files to touch:
src/schemas/expense.schema.ts, route definitions under src/routes/.
- Follow existing Zod validation patterns found across other route handlers in the codebase.
Testing & Validation
- Run
npm test to ensure all existing and new unit tests pass successfully.
Submission Guidelines
- Open a Pull Request referencing
Closes #<issue-number>.
- Adhere to TypeScript strict rules and existing codebase formatting standards.
Wave complexity: Trivial
Description
Implement a robust Zod validation schema for expense creation requests in the backend API to ensure all incoming payload fields (such as description, amount, currency, and participants) are correctly typed and formatted before processing.
Context & Requirements
The Mergepay backend uses Fastify and Zod for input validation. Currently, some expense endpoints lack comprehensive request body validation, risking malformed data entering the database or settlement services. We need a dedicated Zod schema for expense creation matching the client types in
mergepay-web.Acceptance Criteria
src/schemas/expense.schema.ts.Implementation Guidance
src/schemas/expense.schema.ts, route definitions undersrc/routes/.Testing & Validation
npm testto ensure all existing and new unit tests pass successfully.Submission Guidelines
Closes #<issue-number>.Wave complexity: Trivial