feat: add database backed membership tiers
All checks were successful
deploy-socialize / image (push) Successful in 1m9s
deploy-socialize / deploy (push) Successful in 19s

This commit is contained in:
2026-05-07 20:29:53 -04:00
parent db16e79d9f
commit 6d92119c9c
23 changed files with 3512 additions and 30 deletions

View File

@@ -0,0 +1,51 @@
# Task: Database-backed organization membership tiers
## Feature Spec
`docs/FEATURES/organizations.md`
## Goal
Move organization membership tiers and usage limits out of frontend/static logic and into the database so an organization owner can select a tier immediately, before payment-provider integration exists.
## Scope
- Add a persisted membership tier model with seeded tiers and limits.
- Add an active membership tier relationship on `Organization`.
- Add backend APIs to list available tiers and change an organization's active tier.
- Let organization creation select an initial tier, defaulting to Free.
- Show the current tier and tier selector on organization usage settings.
- Regenerate OpenAPI contracts after backend changes.
## Likely Files
- `backend/src/Socialize.Api/Modules/Organizations/Data/*`
- `backend/src/Socialize.Api/Modules/Organizations/Handlers/*`
- `backend/src/Socialize.Api/Migrations/*`
- `frontend/src/features/organizations/stores/organizationStore.js`
- `frontend/src/features/organizations/views/OrganizationOnboardingView.vue`
- `frontend/src/features/organizations/views/OrganizationSettingsView.vue`
- `frontend/src/locales/en.json`
- `frontend/src/locales/fr.json`
- `shared/openapi/openapi.json`
- `frontend/src/api/schema.d.ts`
## Validation
```bash
dotnet ef migrations add AddOrganizationMembershipTiers --project backend/src/Socialize.Api/Socialize.Api.csproj --startup-project backend/src/Socialize.Api/Socialize.Api.csproj
dotnet build backend/Socialize.slnx
dotnet test backend/Socialize.slnx
cd frontend && npm run build
./scripts/update-openapi.sh
```
## Done When
- [x] Membership tiers and limits are database-backed.
- [x] Organizations persist their selected membership tier.
- [x] Organization owners/billing managers can change tiers from the usage settings page.
- [x] New organizations can choose an initial tier.
- [x] Usage limits come from the selected tier, not organization name or frontend constants.
- [x] EF migration is generated with `dotnet ef migrations add`.
- [x] OpenAPI and frontend schema are regenerated.