feat(api): self person claim + profile photo endpoints (spec 057 backend) #1158
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/057-self-person-backend"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Spec 057 backend lane (S057T001-T003).
What
/api/profile/self-person, PUT/GET/api/profile/self-person/photo— 404 invisible instance, 409 CONFLICT with claimedByDisplayName, 422 media not in person occurrences, 400 invalid crop (0..1, x+size<=1, y+size<=1), size clamp {256,512}; photo serve reads derived_assets (derived_type=profile_photo, variant=size) as image/jpeg with ETag + 365d immutable cache + Vary: Cookie.{state: none|self|other, claimedByDisplayName?}attached on the people class-instances read path via batch claimsFor lookup (null = not computed -> client treats as none).profile_photo_crop, payload keys exactlymediaItemId, cropX, cropY, cropSize, generationVersion; enqueue + result ingestion with current-generation gating (stale results dropped) and multi-variant completion.Verification
rtk ./gradlew :apps:api:testfull suite: BUILD SUCCESSFUL, tests=1909 failures=0 errors=0 skipped=9.Notes
getPersonDetail->GET /api/discovery/domains/people/class-instances/{id}has no api mapping (web TODO in DiscoveryInstanceDetail.svelte).- V159__self_persons.sql: self_persons table (PK user_account_id CASCADE, UNIQUE class_instance_id, profile_media_item_id SET NULL, crop 0..1 CHECK) - SelfPersonService: view/claim/unlink/setProfilePhoto/profilePhotoFile/claimsFor - SelfPersonController: GET/PUT/DELETE /api/profile/self-person, PUT/GET /api/profile/self-person/photo (derived_assets profile_photo serve, size clamp 256/512, ETag + immutable cache) - ApiExceptionHandler: 409 SelfPersonClaimedException (claimedByDisplayName), 422 SelfPersonPhotoMediaException - selfPersonClaim {state, claimedByDisplayName?} attached on the people class-instance read path via batch claimsFor lookup - profile_photo_crop job enqueue + worker result ingestion (pinned contract: payload keys mediaItemId/cropX/cropY/cropSize/generationVersion), current generation gating, stale results dropped - tests: migration, service (Postgres), controller, claim attachment, result acceptance