[PB-6473]: feat/mail-bucket-provisioning#221
Open
jzunigax2 wants to merge 2 commits into
Open
Conversation
…h corresponding API endpoints and tests
sg-gs
reviewed
Jun 11, 2026
| expect(findUser.calledOnce).toBeTruthy(); | ||
| }); | ||
|
|
||
| it('When no bucket with that name exists, then it creates one', async () => { |
sg-gs
reviewed
Jun 11, 2026
| expect(result).toStrictEqual({ id: createdBucket.id, name: createdBucket.name }); | ||
| }); | ||
|
|
||
| it('When a bucket with that name already exists, then it returns the existing one without creating', async () => { |
sg-gs
previously approved these changes
Jun 11, 2026
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.
What
Gateway endpoints for provisioning and removing network buckets for a user:
POST /v2/gateway/users/:uuid/bucketsWhy
Mail needs a network bucket per mail account: each Stalwart account has its own independent usage, and relating that content to a bucket keeps the network agnostic of the product. The per-account bucket also enables follow-up work and gives the gateway a generic provisioning primitive any service-to-service consumer can use.
How
UsersUsecase.findOrCreateBucket(uuid, name): verifies the user exists, returns the existing bucket matching(userId, name)or creates one with default fields.UsersUsecase.deleteBucket(uuid, bucketId): verifies the user, then removes the bucket scoped to that owner (removeByIdAndUser).