feat(api): add S3-backed gallery photos v1#26
Merged
Conversation
# Conflicts: # api/src/casl/ability.factory.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the photos v1 architecture (
api/docs/photos-architecture.md): photos live in S3, metadata in Postgres, and clients talk to S3 directly via short-lived presigned URLs — the API never proxies image bytes.What's included
Photomodel reshaped (s3Key,contentType,sizeBytes,PhotoStatusPENDING/READY) with composite list index; keptaddedByIdfor attributionPhotoCASL subject — read: any event member; upload: organizer/participant; delete: organizer any photo, uploader their ownPOST /galleries/:id/photos/upload-urls— batch presigned PUT slots (1h TTL), PENDING rows, contentType/size/batch capsPOST /galleries/:id/photos/confirm— HeadObject verification, per-photoREADY/MISSING/MISMATCHED/NOT_FOUND, idempotentGET /galleries/:id/photos— cursor-paginated READY photos, newest first, 15m presigned GET URLsGET /photos/:id+DELETE /photos/:id— detail view and retry-safe delete (S3 object first, row second)S3Service.headObject;AbilityFactory.createForCalleradopted (from refactor(api): centralize caller ability creation in AbilityFactory #29)Not in this PR (intentional)
Test plan
format:check,eslint,openapi:check,npm test(265),test:e2e(101),build