feat(seed): embedded template library + import-by-name (PSA-57 part 1) #346
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PSA-57-template-library"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The API half of Yousif's first-run setup choices: an embedded template library and load-by-name. The web setup panel + the empty-instance dashboard prompt land in part 2.
What's here
SeedTemplateregistry (SEED_TEMPLATES): each template's JSON is compiled in viainclude_str!, so a template is always available without a filesystem path. Shipsdemo-msp(PSA-51) and a newminimaltemplate (the app catalog + a few users, no bulk volume).find_template(name)resolves one.GET /v1/admin/seed/templates(AdminUser): each template's name, description, and section counts, for the setup picker. A malformed embedded template is skipped rather than 500-ing the list; a test asserts every one parses.POST /v1/admin/seed/import?template=<name>loads the named embedded template through the shared loader instead of the request body; an unknown name is a 400. The body path is unchanged.Tests
Every embedded template parses + validates;
find_templateresolves known names and rejects unknown; theminimaltemplate is a small baseline (3 users, 2 groups, 3 apps, no feedback/entitlements, 1 admin).Verification
just check-containergreen (fmt + clippy-D warnings+cargo test --workspace --all-targets; seed lib 57 tests incl. the 3 new). Endpoint wiring is compile/clippy-checked; the DB load path runs against a dev database.AC status (this PR)
Covered: embedded
demo-msp+minimaltemplates,GET /templates, import-by-name with unknown-name 400, theminimaltemplate + its validation, template-list test (ACs 1-3 + part of 6). Open in part 2: the/admin/seedsetup panel (start empty / load template / custom) and the empty-catalog dashboard prompt (ACs 4-5).Part 2 (follow-up)
The
/admin/seedsetup panel and the dashboard prompt linking to it when the app catalog is empty.#PSA-57
Review follow-ups on PSA-57 part 1, aligning with PSA-56 (now merged). - The `minimal` template now declares `owns: {domains: ["demo.psa-systems.test"]}` explicitly, matching demo-msp and the PSA-56 convention that every seed file declares its own reclaim scope, instead of leaning on the effective_owns() default. - Dropped `restricted: true` on the `vault` app. With no entitlements in the minimal template, a restricted app is invisible to every seeded user; a baseline should not ship an app nobody can open. It is now a plain add-on visible to all. Verified: just check-container green (seed lib 64 tests; the minimal-template shape test still holds - owns and restricted do not change the section counts). #PSA-57