Commit Graph

8 Commits

Author SHA1 Message Date
Paul Huliganga b62b8061f7 fix(build): resolve TypeScript errors and stabilize test suite
- Dependencies: add @types/debug; fix logger argument typing
- Core: add middleware.ts (asyncHandler), create logger.ts
- Error handling: global middleware in index.ts maps Zod/service errors to proper HTTP status codes (400/413/502/504/415)
- Import route: catch UrlImportError and return mapped responses
- Tests: add error handlers to test setups to match production behavior
- Tags: duplicate/empty name errors now return 400
- Tests expectations: CopyMeThatImportService tests updated to match parser behavior (invalid recipes filtered, not counted as failures)
- Numerous route refactors (asyncHandler, validation, pagination links) and test expansions

Result: npm run build succeeds, all 90 tests pass.

Next: review low-priority items (FTS, harness auth), commit when ready.
2026-03-30 00:45:05 -04:00
Paul Huliganga 8b729d7fc4 chore(backend): implement high-priority improvements from code review
- Configuration: dotenv support, env vars for PORT, DB_PATH, CORS_ORIGIN, rate limits
- Security: API key auth for write endpoints, rate limiting on import, configurable CORS, image URL normalization
- Reliability: DB transactions for create/update, dirty flag for saves, foreign key enforcement (PRAGMA), duplicate detection O(1) optimization
- Features: health check endpoint (/api/health)
- Bugfix: corrected tag assignment/removal routes (param order)
- Testing: added tests for PUT/DELETE recipes, tag CRUD and assignment, enabled foreign keys in tests
- All 46 backend tests passing

Closes #<ticket-if-any>
2026-03-29 23:11:27 -04:00
Paul Huliganga 3248e52057 Refactor backend to normalized ingredients/steps schema, remove tag color, update types/routes/services/tests. Blocking TS build error: all SQL params must be string|null; remaining bug is undefined may leak in RecipeRepository ingredient/step creation. See code for status. In-progress commit to checkpoint work. 2026-03-25 10:33:37 -04:00
Paul Huliganga 9f49223df3 Add import telemetry logging for success and failure reasons 2026-03-25 00:07:38 -04:00
Paul Huliganga 1ca21889ca Add URL import retry/timeout handling and friendly failure messaging 2026-03-24 23:54:23 -04:00
Paul Huliganga d3eeeb2833 feat(import): add heuristic fallback parser for recipe URL imports 2026-03-24 23:43:41 -04:00
Paul Huliganga 64a1229ff0 feat(import): implement Schema.org Recipe JSON-LD parser and draft normalization for import endpoint 2026-03-24 20:37:46 -04:00
Paul Huliganga 146dc3325a feat(backend): add URL import endpoint foundation 2026-03-24 20:25:35 -04:00