feat(api): batch add-to-album endpoint (Spec 064) #1278

Merged
chris merged 2 commits from spec/064-api into main 2026-10-17 09:10:57 +02:00
Owner

Summary

Spec 064 (Add Photos to Existing Album, Web + Android) — Backend-Lane.

  • Neuer Endpunkt POST /api/albums/{albumId}/items/batch
  • Request { "mediaItemId": [uuid,...] } (minItems: 1), Response { added, skipped }
  • @Transactional (1 Transaktion pro Batch, Rollback bei Fehler), Owner-/Active-Check 1× pro Batch
  • Idempotent via ON CONFLICT DO NOTHING (kein Umsortieren vorhandener Items bei Wiederholung)
  • recordAcceptedGeneratedAlbumEdit(..., "add_item") nur für neu eingefügte Items
  • Fehler normalisiert: 400 (leer/null), 403 (fremdes Album), 404 (unbekannt/gelöscht) — Single-Endpunkt unverändert
  • OpenAPI-Vertrag specs/001-v1-baseline/contracts/core-api.openapi.yaml ergänzt
  • Tests: AlbumServiceAddItemsBatchTest (Testcontainers), AlbumControllerAddItemsBatchTest (MockMvc)

Verification

rtk ./gradlew :apps:api:test --tests '*AddItemsBatch*' --tests '*AlbumServiceTest'* → BUILD SUCCESSFUL. Voller Modul-Lauf: 2179 tests, 1 unrelated People-Flake (Re-Run grün, $\{ISSUE-169\}).

Refs: spec 064, S064T001

## Summary Spec 064 (Add Photos to Existing Album, Web + Android) — Backend-Lane. - Neuer Endpunkt `POST /api/albums/{albumId}/items/batch` - Request `{ "mediaItemId": [uuid,...] }` (`minItems: 1`), Response `{ added, skipped }` - `@Transactional` (1 Transaktion pro Batch, Rollback bei Fehler), Owner-/Active-Check 1× pro Batch - Idempotent via `ON CONFLICT DO NOTHING` (kein Umsortieren vorhandener Items bei Wiederholung) - `recordAcceptedGeneratedAlbumEdit(..., "add_item")` nur für neu eingefügte Items - Fehler normalisiert: 400 (leer/null), 403 (fremdes Album), 404 (unbekannt/gelöscht) — Single-Endpunkt unverändert - OpenAPI-Vertrag `specs/001-v1-baseline/contracts/core-api.openapi.yaml` ergänzt - Tests: `AlbumServiceAddItemsBatchTest` (Testcontainers), `AlbumControllerAddItemsBatchTest` (MockMvc) ## Verification `rtk ./gradlew :apps:api:test --tests '*AddItemsBatch*' --tests '*AlbumServiceTest'*` → BUILD SUCCESSFUL. Voller Modul-Lauf: 2179 tests, 1 unrelated People-Flake (Re-Run grün, `$\{ISSUE-169\}`). Refs: spec 064, S064T001
feat(api): add batch add-to-album endpoint
Some checks failed
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 3s
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build Android CI image (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Failing after 8m14s
0c7cd3b1ee
POST /api/albums/{albumId}/items/batch (spec 064 S2) takes
{"mediaItemId": ["<uuid>", ...]} and answers {"added": n, "skipped": n}
in one transaction: album ownership/active check once per batch, then the
same album_items uniqueness (album_event_id, media_item_id) per id via
ON CONFLICT DO NOTHING — already-present ids keep their sort_order and
count as skipped, so repeating a batch changes nothing. Empty/missing list
is 400 (@NotEmpty + service guard), foreign album 403, unknown/deleted
album or unknown/inactive/foreign media item 404 with a full rollback;
recordAcceptedGeneratedAlbumEdit("add_item") runs per newly added item.
The single-item endpoint stays unchanged; contract extended in
specs/001-v1-baseline/contracts/core-api.openapi.yaml.
ci: retrigger scoped PR tests after flaky PersonRelationServicePostgresTest ([ISSUE-169])
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 3s
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build Android CI image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 8m10s
fbdaa103b4
chris merged commit 7f903d2b17 into main 2026-10-17 09:10:57 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
chris/memories!1278
No description provided.