Repository navigation
feat: add signed photo uploads and a per-space quota - #13
Merged
Merged
Conversation
ChargingCrystal
force-pushed
the
feat/b1-b3-signed-photos
branch
from
November 28, 2026 14:01
555a31a to
d9dfe65
Compare
ChargingCrystal
marked this pull request as ready for review
November 28, 2026 14:03
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.
B1 and B3 / F3
Adds migration
005_signed_gallery.sqlfor confirmed photo metadata and a 50 MiB per-space quota. Photo bytes go directly from the browser to private Supabase Storage.Quota accounting now counts a 5 MiB hold only while the reservation is open, unexpired, and unconfirmed. Confirmation closes the reservation and the stored object counts by size. Deleting that object frees its quota immediately. An expired hold gives way to any stored object left behind. The app keeps the existing signing window and transfer grace period.
Frontend impact
POST /api/photos/upload-urlwith{"mime":"image/png","size":5242880}. The response includesuploadId,path,signedUrl, andtoken.gallerybucket withuploadToSignedUrl(path, token, file).POST /api/photos/confirmwith{"uploadId":"<uuid>"}to register the photo. Confirmation remains safe to retry.The old binary POST returns 405.
GET /api/photoslists confirmed metadata and five-minute signed URLs. Deleting a missing or foreign photo returns404 not_found. Issuing a new 5 MiB hold that would exceed the quota returns409 quota_exceeded. The three frontend translations are on main via #12.Verification
aef3871. Verified all unrelated README API rows and all pre-existing isolation tests survived. The README has 20 API rows.9ddf947reproduced three quota failures. Five PGlite cases cover 12 sequential small uploads, exact stored-byte accounting, immediate release after deletion, expiry and abandoned files, and the full-space limit.npm testpassed with 515 tests.npm run buildpassed.Review note
Quota checks run when issuing a new reservation. Closing an app reservation does not revoke an already-issued Supabase upload token, so a signed upload can still succeed against its deleted path until the token expires. The accounting includes such stored bytes on subsequent checks. Live Storage replay was not tested here. Supabase signed-upload handler