trails/packages/api/src
Ullrich Schäfer edd2cabf12
DRY up ZodError → FieldError mapping
Five journal API route handlers had the same inline lambda:

    parsed.error.issues.map((i) => ({
      field: i.path.join("."),
      message: i.message,
    }))

Pull it into `zodIssuesToFieldErrors(error)` next to FieldError in
`@trails-cool/api/errors.ts` and re-export it so all five handlers
share the same implementation. The path-flattening rule now lives in
one place, and new routes get it for free.

Public error-response shape is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 11:45:09 +02:00
..
activities.ts Modernise zod idioms to v4 2026-04-19 11:41:03 +02:00
auth.ts Modernise zod idioms to v4 2026-04-19 11:41:03 +02:00
discovery.ts Modernise zod idioms to v4 2026-04-19 11:41:03 +02:00
endpoints.ts Add @trails-cool/api package with Zod schemas for REST API contract 2026-04-12 22:49:30 +02:00
errors.ts DRY up ZodError → FieldError mapping 2026-04-19 11:45:09 +02:00
index.test.ts Standardize monorepo pipeline: test, lint, typecheck across all workspaces 2026-04-13 00:00:43 +02:00
index.ts DRY up ZodError → FieldError mapping 2026-04-19 11:45:09 +02:00
pagination.ts Add @trails-cool/api package with Zod schemas for REST API contract 2026-04-12 22:49:30 +02:00
routes.ts Modernise zod idioms to v4 2026-04-19 11:41:03 +02:00
uploads.ts Modernise zod idioms to v4 2026-04-19 11:41:03 +02:00
version.ts Add @trails-cool/api package with Zod schemas for REST API contract 2026-04-12 22:49:30 +02:00