feat(landing): persist per-tenant LandingTheme + branding endpoint (Phase 2)#202
Merged
Conversation
…hase 2) Phase 1 shipped the template + palette engine with no persistence, so every tenant rendered Rift defaults. Phase 2 adds the tenant-level branding layer. - TenantDoc gains `landing_theme: Option<LandingTheme>` (mirrors the default_redirect_mode precedent); old docs deserialize to None. - TenantsRepository::set_landing_theme ($set) + mock impls. - TenantsService::update_landing_theme / get_landing_theme, with validation in the service layer (reuses core::validation hex/url/cta validators + length caps) so both transports share one enforcement path. New TenantError enum. - GET/PUT /v1/tenant/branding behind SESSION|SECRET auth (api/auth/tenants), registered in the OpenAPI spec along with LandingTheme + its enums. - Resolve path now loads the tenant's theme (resolve_landing_theme), falling back to defaults; the cascade is Tenant.landing_theme -> Rift default. - tenants_service wired onto AppState (already constructed in main.rs). Tests: branding integration (PUT -> resolve renders the brand; GET defaults; invalid color -> 400). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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 & why
Phase 1 (#201) shipped the
Defaulttemplate + palette engine but with no persistence — every tenant rendered Rift defaults (teal). Phase 2 adds the missing tenant-level branding layer so a tenant's landing pages can match their brand. Cascade is nowTenant.landing_theme → Rift default(per-linksocial_previewcontent still overlays in the renderer).This is what unblocks making e.g. the
orangerocktenant orange.Changes
TenantDoc.landing_theme: Option<LandingTheme>— mirrors thedefault_redirect_modeprecedent; old docs deserialize toNone.TenantsRepository::set_landing_theme($set) + mock impls.TenantsService—update_landing_theme/get_landing_theme, with validation in the service layer (reusescore::validationhex/url/cta validators + brand_name/tagline length caps) so REST and a future MCP tool share one enforcement path. NewTenantErrorenum (Invalid→400, Storage→500).GET/PUT /v1/tenant/branding(api/auth/tenants) behindSESSION | SECRETauth; thin handlers,#[tracing::instrument]. Registered in OpenAPI withLandingTheme+ its enums.resolve_landing_theme), resilient to missing repo/None → defaults.tenants_servicewired ontoAppState(it was already constructed inmain.rs).API
Tests
--accent); GET returns defaults when unset; invalid hex → 400.fmt+clippy -D warningsclean. Fullcargo testrunning post-push per the CI-ordering rule in CLAUDE.md.Notes / open
App.{app_name,icon_url,theme_color}removal; optional MCPtenant.set_brandingtool (LandingTheme is already MCP-schema-ready).🤖 Generated with Claude Code