GRI-1975: remove the campus seed, add campus CRUD #171

Merged
vivy merged 2 commits from feature/GRI-1975-campus-crud into dev 2026-11-13 22:04:48 +00:00
Member

Summary

Follow-up to grimoire-of-digital-signage#159 / #162, per comment 10964: the
AM/HE/JO/NO campuses were meant as a worked example in that PR's discussion,
not a permanent seed shipped to every install.

  • Remove the AM/HE/JO/NO insert from migrations/0005_campus.sql. A fresh
    install now lists no campuses.
  • Add POST/PATCH/DELETE /api/v1/campuses (signed-in CurrentUser only —
    there is no admin/role model merged yet, the same gap already noted for
    list_campuses; true admin-only gating is tracked separately for
    #44/GRI-1970).
    • Creating with a duplicate code -> 409 duplicate_code.
    • Deleting a campus still referenced by media, a playlist, a device or an
      IP rule -> 409 campus_in_use (relies on the existing FK with no
      ON DELETE action).
  • AM/HE/JO/NO now only exist as test fixtures: each test that needs a campus
    creates it. Added a test that a fresh database lists no campuses, plus a
    create/list/rename/delete round trip and the two 409 cases.
  • Fixed the campus_id test fixture helper in playlist_integration.rs,
    media_integration.rs, devices_integration.rs and
    permission_scoping_acceptance_integration.rs — all previously assumed the
    seed — to create the campus they need instead.

Front-end campus management panel is out of scope here; it is a follow-up.

Test plan

  • ./scripts/local-gates.sh --rust-only — every gate passed (hooks,
    fmt, clippy, cargo test --workspace --all-targets, cargo test --doc,
    cargo deny).
  • New test: a fresh database lists no campuses.
  • New tests: campus create/list/rename/delete round trip, duplicate code
    409, delete-of-referenced-campus 409.
## Summary Follow-up to grimoire-of-digital-signage#159 / #162, per comment 10964: the AM/HE/JO/NO campuses were meant as a worked example in that PR's discussion, not a permanent seed shipped to every install. - Remove the AM/HE/JO/NO insert from `migrations/0005_campus.sql`. A fresh install now lists no campuses. - Add `POST`/`PATCH`/`DELETE /api/v1/campuses` (signed-in `CurrentUser` only — there is no admin/role model merged yet, the same gap already noted for `list_campuses`; true admin-only gating is tracked separately for `#44`/GRI-1970). - Creating with a duplicate code -> `409 duplicate_code`. - Deleting a campus still referenced by media, a playlist, a device or an IP rule -> `409 campus_in_use` (relies on the existing FK with no `ON DELETE` action). - AM/HE/JO/NO now only exist as test fixtures: each test that needs a campus creates it. Added a test that a fresh database lists no campuses, plus a create/list/rename/delete round trip and the two 409 cases. - Fixed the `campus_id` test fixture helper in `playlist_integration.rs`, `media_integration.rs`, `devices_integration.rs` and `permission_scoping_acceptance_integration.rs` — all previously assumed the seed — to create the campus they need instead. Front-end campus management panel is out of scope here; it is a follow-up. ## Test plan - [x] `./scripts/local-gates.sh --rust-only` — every gate passed (hooks, fmt, clippy, cargo test --workspace --all-targets, cargo test --doc, cargo deny). - [x] New test: a fresh database lists no campuses. - [x] New tests: campus create/list/rename/delete round trip, duplicate code 409, delete-of-referenced-campus 409.
GRI-1975: remove the campus seed, add campus CRUD
Some checks failed
CI / the pre-push hook (pull_request) Successful in 44s
CI / cargo fmt (pull_request) Successful in 1m6s
CI / cargo clippy (pull_request) Successful in 2m47s
CI / cargo deny (pull_request) Successful in 1m44s
CI / repository boundary (pull_request) Successful in 1m18s
CI / cargo deny advisories (pull_request) Failing after 1m53s
CI / frontend-web (pull_request) Successful in 1m56s
CI / cargo test (pull_request) Failing after 6m54s
CI / CI (pull_request) Failing after 31s
CI / Notify gate failed (pull_request) Successful in 32s
4b4019cfdb
Remove the AM/HE/JO/NO insert from 0005_campus.sql so a fresh install
lists no campuses; add admin POST/PATCH/DELETE /api/v1/campuses
(duplicate code -> 409, delete of a campus still referenced by media,
playlists, devices or IP rules -> 409); fix test fixtures across the
server crate to create the campuses they need instead of relying on
the seed.
GRI-1975: merge dev — pick up CI Postgres fix (#170)
Some checks failed
CI / the pre-push hook (pull_request) Successful in 56s
CI / cargo fmt (pull_request) Successful in 43s
CI / cargo clippy (pull_request) Successful in 2m22s
CI / cargo deny (pull_request) Successful in 2m15s
CI / repository boundary (pull_request) Successful in 43s
CI / cargo test (pull_request) Successful in 3m6s
CI / frontend-web (pull_request) Successful in 1m33s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 21s
CI / cargo deny advisories (pull_request) Failing after 13m35s
b173df7726
vivy merged commit 0c1b78b03e into dev 2026-11-13 22:04:48 +00:00
vivy deleted branch feature/GRI-1975-campus-crud 2026-11-13 22:04:48 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!171
No description provided.