## Summary
- Adds full fruit CRUD: list (paginated), create, view, update, delete
- Synonyms managed as a flat `[]string` replaced atomically on each PUT
- Images stored as BYTEA in Postgres; served via content-type sniffing; uploaded via multipart (5 MB cap)
- Consumer-defined `FruitRepository` interface in handler package; pg impl injected at router startup
- 25 Go handler unit tests (in-memory fake repo, no DB) + opt-in integration test; 18 frontend Vitest tests
- Code review findings fixed: `io.ReadAll` for image upload, whitespace trim in validation, offset reset on create, cleanup error logging
## Test plan
- [ ] `make test` — all Go handler + integration tests and frontend Vitest tests pass
- [ ] `make dev-db && make migrate-up && make run-backend && make run-frontend` — dev stack starts
- [ ] Navigate to `/fruits` — empty list shows, "Neue Frucht" button present
- [ ] Create a fruit with synonyms — appears at top of list without reload
- [ ] Open detail — view/edit mode, synonyms editable, image upload works, image visible
- [ ] Upload > 5 MB file — rejected with 413
- [ ] POST blank name — rejected with 422
- [ ] POST duplicate osdb_number — rejected with 409
- [ ] Delete fruit — cascades synonyms and images, redirects to list
🤖 Generated with [Claude Code](https://claude.com/claude-code)
- Makefile: -include .env (soft) so fresh clone doesn't hard-fail
- main.go: replace log.Fatalf-in-goroutine with error channel; startup
failures now reach main goroutine so defer pool.Close() always runs
- main.go: context.WithTimeout(30s) on database.Connect to fail fast
instead of hanging indefinitely on unreachable Postgres
- router.go: store pool on Echo context via middleware so future story
handlers can retrieve it with c.Get("pool")
- config.go: require DATABASE_URL explicitly (log.Fatal if missing)
instead of falling back to hardcoded credentials
- HelloWorld.test.ts: URL-aware fetch stub + afterEach restoreAllMocks;
add flushPromises test verifying backend status renders
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
golang-migrate, pgx/v5, and echo/v4 are all imported directly;
go mod tidy correctly marks them as direct dependencies.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace src.Read(data) with io.ReadAll(src) to prevent silent truncation on large uploads
- Reject zero-byte file uploads with 400 rather than storing empty BYTEA
- Add strings.TrimSpace to validateFruit so whitespace-only name/osdb_number returns 422
- Reset offset to 0 in fruitStore.create() so navigating back to list after create shows page 1
- Log t.Cleanup DELETE error in integration test to surface constraint failures clearly
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a repeatable Python import script that populates fruits, fruit_synonyms,
and fruit_images from 03-data/obstsorten.xml and the three image directories.
Idempotent: deletes synonyms and images per fruit before re-inserting; upserts
fruit row by osdb_number. Reads DATABASE_URL from env.
- map_typ: 23 XML typ codes → 17-value fruit_type enum; aggregate types coerced
with logged warning; typ='p' (2 entries) mapped to Pfirsiche
- parse_synonyms: comma-split with whitespace/newline strip, empty filter
- parse_date: YYYYMMDD → date, fallback None → DB default NOW()
- find_images: globs {id}_*_s0.* across einzelfruechte/blueten/baume dirs
- 42 unit tests (no DB required) cover all mapping, parsing, and glob logic
- Makefile test target extended to include Python test suite
- 03-data/ and obstsorten.zip added to .gitignore (large binary data)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
[]stringreplaced atomically on each PUTFruitRepositoryinterface in handler package; pg impl injected at router startupio.ReadAllfor image upload, whitespace trim in validation, offset reset on create, cleanup error loggingTest plan
make test— all Go handler + integration tests and frontend Vitest tests passmake dev-db && make migrate-up && make run-backend && make run-frontend— dev stack starts/fruits— empty list shows, "Neue Frucht" button present🤖 Generated with Claude Code
- Makefile: -include .env (soft) so fresh clone doesn't hard-fail - main.go: replace log.Fatalf-in-goroutine with error channel; startup failures now reach main goroutine so defer pool.Close() always runs - main.go: context.WithTimeout(30s) on database.Connect to fail fast instead of hanging indefinitely on unreachable Postgres - router.go: store pool on Echo context via middleware so future story handlers can retrieve it with c.Get("pool") - config.go: require DATABASE_URL explicitly (log.Fatal if missing) instead of falling back to hardcoded credentials - HelloWorld.test.ts: URL-aware fetch stub + afterEach restoreAllMocks; add flushPromises test verifying backend status renders Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Backend: domain structs, FruitRepository interface + pg implementation, 9 Echo v4 handlers (list/get/create/update/delete, image sub-resources), migration 000002 (fruit_type ENUM, fruits, fruit_synonyms, fruit_images), route-scoped BodyLimit("5M") for uploads, http.DetectContentType for serving. Frontend: typed fetch API layer, Pinia setup-style fruitStore, FruitList (paginated), FruitCreate, and FruitDetail (edit + synonyms editor + image gallery). 25 backend unit tests + integration test; 18 frontend tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Adds a repeatable Python import script that populates fruits, fruit_synonyms, and fruit_images from 03-data/obstsorten.xml and the three image directories. Idempotent: deletes synonyms and images per fruit before re-inserting; upserts fruit row by osdb_number. Reads DATABASE_URL from env. - map_typ: 23 XML typ codes → 17-value fruit_type enum; aggregate types coerced with logged warning; typ='p' (2 entries) mapped to Pfirsiche - parse_synonyms: comma-split with whitespace/newline strip, empty filter - parse_date: YYYYMMDD → date, fallback None → DB default NOW() - find_images: globs {id}_*_s0.* across einzelfruechte/blueten/baume dirs - 42 unit tests (no DB required) cover all mapping, parsing, and glob logic - Makefile test target extended to include Python test suite - 03-data/ and obstsorten.zip added to .gitignore (large binary data) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>