Skip to content

feat: implement subscription limit for users - #2231

Merged
jcscottiii merged 1 commit into
mainfrom
jcscottiii/subscriptions-limit
Feb 5, 2026
Merged

feat: implement subscription limit for users#2231
jcscottiii merged 1 commit into
mainfrom
jcscottiii/subscriptions-limit

Conversation

@jcscottiii

Copy link
Copy Markdown
Collaborator
  • Add ErrUserMaxSubscriptions to lib/backendtypes/types.go to signal when a user has reached their subscription limit.
  • Add ErrSubscriptionLimitExceeded to lib/gcpspanner/saved_search_subscription.go for the database layer.
  • Update searchConfig in lib/gcpspanner/client.go to include maxSubscriptionsPerUser, defaulting to 25.
  • Update createSavedSearchSubscription in lib/gcpspanner/saved_search_subscription.go to enforce the subscription limit before creation.
  • Update CreateSavedSearchSubscription adapter in lib/gcpspanner/spanneradapters/backend.go to map the database limit error to the backend type error.
  • Update CreateSubscription handler in backend/pkg/httpserver/create_subscription.go to return a 403 Forbidden status when the limit is exceeded similar to the error and status for the limit for CreateSavedSearch.
  • Update frontend component ManageSubscriptionsDialog in frontend/src/static/js/components/webstatus-manage-subscriptions-dialog.ts to gracefully handle the error and display a user-friendly message.
  • Add tests covering the limit logic in:
    • backend/pkg/httpserver/create_subscription_test.go
    • lib/gcpspanner/saved_search_subscription_test.go
    • lib/gcpspanner/spanneradapters/backend_test.go
    • frontend/src/static/js/components/test/webstatus-manage-subscriptions-dialog.test.ts

- Add `ErrUserMaxSubscriptions` to `lib/backendtypes/types.go` to signal when a user has reached their subscription limit.
- Add `ErrSubscriptionLimitExceeded` to `lib/gcpspanner/saved_search_subscription.go` for the database layer.
- Update `searchConfig` in `lib/gcpspanner/client.go` to include `maxSubscriptionsPerUser`, defaulting to 25.
- Update `createSavedSearchSubscription` in `lib/gcpspanner/saved_search_subscription.go` to enforce the subscription limit before creation.
- Update `CreateSavedSearchSubscription` adapter in `lib/gcpspanner/spanneradapters/backend.go` to map the database limit error to the backend type error.
- Update `CreateSubscription` handler in `backend/pkg/httpserver/create_subscription.go` to return a 403 Forbidden status when the limit is exceeded similar to the error and status for the limit for CreateSavedSearch.
- Update frontend component `ManageSubscriptionsDialog` in `frontend/src/static/js/components/webstatus-manage-subscriptions-dialog.ts` to gracefully handle the error and display a user-friendly message.
- Add tests covering the limit logic in:
  - `backend/pkg/httpserver/create_subscription_test.go`
  - `lib/gcpspanner/saved_search_subscription_test.go`
  - `lib/gcpspanner/spanneradapters/backend_test.go`
  - `frontend/src/static/js/components/test/webstatus-manage-subscriptions-dialog.test.ts`

@DanielRyanSmith DanielRyanSmith left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'll have to use my 25 subscriptions wisely! 😉

@jcscottiii
jcscottiii added this pull request to the merge queue Feb 5, 2026
Merged via the queue into main with commit 0b4dbb3 Feb 5, 2026
8 checks passed
@jcscottiii
jcscottiii deleted the jcscottiii/subscriptions-limit branch February 5, 2026 18:54
@jrobbins jrobbins mentioned this pull request Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants