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>
|
||
|---|---|---|
| .. | ||
| activities.ts | ||
| auth.ts | ||
| discovery.ts | ||
| endpoints.ts | ||
| errors.ts | ||
| index.test.ts | ||
| index.ts | ||
| pagination.ts | ||
| routes.ts | ||
| uploads.ts | ||
| version.ts | ||