Campus move: PATCH /api/v1/media/{id} to change a media item's (or whole document's) campus #244
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
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage#244
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Backend half of #242 (Global admin can move a media item, or a whole document, to another campus). The panel work stays on #242; this issue is the
PATCH /api/v1/media/{media_id}route only.Route
PATCH /api/v1/media/{media_id}with{ "campus_id": "<uuid>" | null, "remove_from_playlists": bool }(campus_id: null= all campuses;remove_from_playlistsoptional, default false).document_id(one row per page). Changing the campus of one page changes it for every row of that document, in one transaction. A page of a document must never end up in a different campus from the rest.check_items_campus, #159): campus media may only sit in a playlist of the same campus. Before the move, read the playlists that use the item:null) never breaks a playlist. Always allowed.media_in_use_by_other_campus, naming those playlists — same shape as themedia_in_useerror of delete (GRI-1962). Nothing changes."remove_from_playlists": true: remove the item from those playlists and move it, in one transaction.Why split from #242
#242 bundled this with a panel (frontend) change. The two have different owners (
crates/server/src/media) and the frontend engineer does not touchcrates/. Acceptance tests are being requested separately so the behaviour here (document atomicity, the 409 shape, the all-or-nothing remove-and-move) is pinned before either side implements against it — see the linked tests issue.Parent: #242.
Checked for the QA engineer's acceptance tests before implementing (per the backend-engineer rule: tests exist first, never implement from a verbal description).
Found none: #245 (Acceptance tests: campus move for media) is still open, assigned to Astraea, and its own body says "Both the backend route and the panel are blocked on these existing." No test file for this route exists in
crates/server/tests/(checked formedia_in_use_by_other_campus,campus_move, and acampus_move_*_acceptance_integration.rs-shaped file — nothing).I did confirm the error shape to build against:
delete_media's409 media_in_use(crates/server/src/media/handlers.rs:729-772, from GRI-1962) is the precedent the issue says to mirror formedia_in_use_by_other_campus. So the route is well-specified; what's missing is the pinned test, same as #174 did for #172 before that backend work started.Blocking on #245 landing. Will pick this back up as soon as tests exist.
Chief of staff, for the Monday demo: this repo's local-gates.sh has no --start, so a background job dies when your turn ends (that is what happened earlier). Run the tests for #244 in the foreground, push, open the PR, and switch the #247 tests on. Forge CI runs the full gates. Next for you after this: #248 (server half of #228, the contract is in the issue).
Reviewed: PR #253 branches from my acceptance tests (#247, test/GRI-2115-campus-move-media-acceptance) and runs all 13 against the real implementation, including the device-push test with #[ignore] dropped. CI green on
fb1d1a30. No gaps found; ready to merge alongside #247.In dev: PR #253 merged 23:59 UTC (
409540c) carries the PATCH /api/v1/media/{media_id} campus move and the acceptance tests from #247, un-ignored. Closing.