Skip to content

[PB-6473]: feat/mail-bucket-provisioning#221

Merged
jzunigax2 merged 3 commits into
masterfrom
feat/mail-bucket-provisioning
Jul 7, 2026
Merged

[PB-6473]: feat/mail-bucket-provisioning#221
jzunigax2 merged 3 commits into
masterfrom
feat/mail-bucket-provisioning

Conversation

@jzunigax2

@jzunigax2 jzunigax2 commented Jun 5, 2026

Copy link
Copy Markdown

What

Gateway endpoints for provisioning and removing network buckets for a user: POST /v2/gateway/users/:uuid/buckets

Why

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).
  • Routes wired into the existing gateway router behind the same JWT middleware, with error handling mirroring the other gateway endpoints.

@jzunigax2 jzunigax2 self-assigned this Jun 11, 2026
@jzunigax2 jzunigax2 added the enhancement New feature or request label Jun 11, 2026
@jzunigax2 jzunigax2 marked this pull request as ready for review June 11, 2026 03:37
@jzunigax2 jzunigax2 requested a review from sg-gs as a code owner June 11, 2026 03:37
Comment thread tests/lib/core/users/usecase.test.ts Outdated
expect(findUser.calledOnce).toBeTruthy();
});

it('When no bucket with that name exists, then it creates one', async () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with that name and for that user

Comment thread tests/lib/core/users/usecase.test.ts Outdated
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 () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with that name and for that user

sg-gs
sg-gs previously approved these changes Jun 11, 2026
@jzunigax2 jzunigax2 requested a review from sg-gs June 17, 2026 04:36
@jzunigax2 jzunigax2 merged commit 03aed54 into master Jul 7, 2026
6 of 7 checks passed
@jzunigax2 jzunigax2 deleted the feat/mail-bucket-provisioning branch July 7, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ready-for-preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants