GRI-2116: PATCH /api/v1/media/{media_id} campus move #253
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!253
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-2116-media-campus-move"
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?
Implements
PATCH /api/v1/media/{media_id}for moving a media item (or whole document) between campuses, per forge #244.document_id) moves as one, in a single transaction.campus_id: null) is always allowed.media_in_use_by_other_campus, naming those playlists. Nothing changes.remove_from_playlists: trueremoves the item from those playlists and moves it, in one transaction; devices whose playlist lost the item get the push.Branched from
test/GRI-2115-campus-move-media-acceptance(forge #247, not yet merged) to run the 13 acceptance tests locally; also drops#[ignore]on the device-push acceptance test now that the route exists. The chief of staff is merging #247 and this PR together.Verified:
./scripts/local-gates.sh --rust-only(incl. ignored DB-backed acceptance tests) — every gate passed, commitfb1d1a3.The implementation looks right, but the tests do not run. 13 tests in media_campus_move_acceptance_integration.rs still carry #[ignore = "requires SIGNAGE_TEST_DATABASE_URL"]. CI sets SIGNAGE_TEST_DATABASE_URL and runs cargo test without --include-ignored, so these 13 are never executed, and the green CI proves nothing about this endpoint. Each test already returns early when there is no URL, like every other DB test here, so the #[ignore] lines are not needed. Please remove all 13 and let CI run them.
Also, please fix: MoveMediaRequest.campus_id is Option without a required marker, so PATCH with an empty body {} moves the media to every campus. Make the field required (e.g. a double Option or a custom deserializer) so that a missing field is 400, and only an explicit null means every campus. Add a test for {}.
This PR contains all of #247's commits, so #247 will be closed when this merges.
Drop the #[ignore] guard from the 13 acceptance tests so CI runs them (they already return early without SIGNAGE_TEST_DATABASE_URL set). campus_id was Option<Uuid>, so an omitted field and an explicit null both deserialized to None, silently defaulting PATCH {} to 'move to every campus'. Switch to Option<Option<Uuid>> so only an explicit null means every campus and a missing field is 400 campus_id_required, with a test covering the omitted-field case.Re-reviewed
1cc50b18. Both points are fixed:campus_idis now required.Option<Option<Uuid>>with the explicit-option deserializer is the right way to tell an omitted field fromnull, and the new test checks that{}gives 400 and does not move the media.#[ignore]. Thecargo testjob setsSIGNAGE_TEST_DATABASE_URL, so CI now runs them against Postgres. CI is green.Approved. It merges after the PRs ahead of it in the queue, and #254 merges after it.
New commits pushed, approval review dismissed automatically according to repository settings