feat(api): add internal storage limit grant for billing - #44
Open
MehrshadFb wants to merge 1 commit into
Open
Conversation
MehrshadFb
force-pushed
the
feat/per-user-storage-limit
branch
from
September 3, 2026 01:57
2ab0194 to
57d886c
Compare
MehrshadFb
force-pushed
the
feat/add-storage-limit
branch
from
September 3, 2026 02:02
36b1ae2 to
fe0c29a
Compare
MehrshadFb
force-pushed
the
feat/per-user-storage-limit
branch
from
September 4, 2026 16:24
57d886c to
cdf85ad
Compare
MehrshadFb
force-pushed
the
feat/add-storage-limit
branch
from
September 4, 2026 16:30
fe0c29a to
cf528f7
Compare
MehrshadFb
force-pushed
the
feat/add-storage-limit
branch
from
September 4, 2026 16:40
cf528f7 to
8d5ce11
Compare
API unit-test coverage
Unit suite only; controllers are exercised by the e2e suite. |
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
PhotoStorageService.addStorageLimit(userId, additionalBytes): one PrismaincrementonUser.storageLimitBytes, returning the new limit as abigintP2025to 404 for an unknown useruser.storage_limit.increasedwithaudit: trueand both byte counts as strings, since bigints are not JSON-serializablesomeCause()helper, now backing bothisSerializationFailureand the newisRecordNotFoundphotos-architecture.md§9 in place of the raw Prisma snippet, and split the billing checklist into the part that now exists and the part that does notWhy
The per-user ceiling landed in #42, but raising one was still a hand-written
UPDATEdocumented as a snippet. This turns that snippet into the single call a future payment webhook makes, so the billing layer never has to know the column exists.Additive rather than absolute is the load-bearing choice. A purchase grants capacity instead of declaring a total, so two overlapping grants accumulate, and
incrementcompiles to one statement, leaving no read-modify-write window for a grant to be lost in.Notes
feat/per-user-storage-limit(feat(api): store photo storage limit per user #42), which must merge first; retarget tomainonce it doesTest plan
npx jest --watchman=false(279 tests, 16 suites)npx jest --config ./test/jest-e2e.json --watchman=false(98 tests)npm run typechecknpm run openapi:checknpx eslinton changed files,npm run format:check