BaryoDev / BaryoDev/barakoCMS

Tenants: move the club profile to the site singleton, and keep Tenant to routing

Open
#885 0 comments 0 reactions 0 assignees View on GitHub
core design migration
Dominant language
C#
Stars
6
Forks
7
Avg merge
4h 42m
Merged PRs (30d)
307

Description

`Tenant` carries a fixed public profile made for one kind of site, a club: `LogoUrl`, `About`, `Location`, `LocationUrl`, `SocialHandle`, `Email`, `ContactUrl` ("typically a Facebook page") and `Branding`, `barakoCMS/Models/Tenant.cs:15-35`. `GET /api/tenants/{handle}/public` serves it anonymously, `barakoCMS/Features/Tenants/Endpoints.cs:9-33`. Meanwhile the `site` singleton (`barakoCMS/Blueprints/site.json`, from #793) already holds `Name`, `Logo`, `SocialLinks` and the theme, so a site is described in two places.

### Why it is too specific

A bakery wants opening hours, a clinic wants several branches, an agency's client wants three social links rather than one handle. None of that fits fixed columns on the tenant, and each new need means a model change, a migration and a contract change. The same information also drifts apart: a logo on the tenant and another on the site entry.

### The general concept

The `site` singleton owns identity and public profile, and it grows by adding fields, not code. `Tenant` keeps what routing and administration need: `Slug`, `Name`, `Domains`, `IsActive`.

### Where it lives

Core: the `Tenant` model, the tenants endpoints and the `site` blueprint.

### Compatibility

Released and stored. Existing profile values are copied into each tenant's `site` entry by a migration. Removing fields from `GET /api/tenants/{handle}/public` and the tenant write requests breaks the HTTP contract, so this rides the contract bump to 4 already in flight in #867 and #861 and is called out in that release. For one release the public route can keep answering with values read from the `site` entry, so a caller keeps working while it moves to `/api/public/site`.

### Done when

- A tenant's About, contact and social values are readable from its `site` entry after the migration, with a test.
- `Tenant` no longer carries profile fields, and tenant create and update no longer accept them.
- The changelog calls out the contract change and where each old field went.

Found in the too specific sweep of 15 September 2026.

Contributor guide

Open the contributing guide

Research direction

Read barakoCMS/Models/Tenant.cs:15-35, barakoCMS/Features/Tenants/Endpoints.cs:9-33, and barakoCMS/Blueprints/site.json first. Trace the tenant migration and the public tenant and site API paths, then inspect existing tests around them. Done means profile values survive migration in each site entry, Tenant and tenant requests contain only routing and administration data, and the contract change is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design, databases, release
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.