GRI-1937: a whole PDF can be added to a playlist #153

Merged
vivy merged 1 commit from fix/GRI-1937-playlist-document into dev 2026-11-13 13:57:08 +00:00
Owner

Board issue GRI-1937. The product owner hit item 0: "document" is not a known item kind when saving a playlist with a PDF from the library.

Cause: the library lists an uploaded PDF as one document row, which the playlist API never accepted. Its pages could not be saved correctly either, because the panel sent no page and the server stored no page number or parent link on page rows.

Change

  • Migration 0004: media.document_id and media.page on document_page rows, plus a backfill for existing pages. A PDF is linked only when the number of attributed pages equals pdf_pages. If it does not match, the pages stay unlinked rather than being linked wrongly.
  • Upload sets both fields and gives each page the PDF's file name. Deleting a PDF deletes its pages and their files.
  • PUT /playlists/{id}/items: kind: "document" expands into one document_page per page, in page order. A document_page without page takes its page number from the media row.
  • Panel: sends document for a whole PDF and page for a single page, and labels library entries "(all pages)" / "— page N".

Tested locally: clippy -D warnings, the media and playlist integration suites against Postgres (33 tests, including the backfill and the cascade delete), and npm run check (32 tests).

Board issue GRI-1937. The product owner hit `item 0: "document" is not a known item kind` when saving a playlist with a PDF from the library. **Cause:** the library lists an uploaded PDF as one `document` row, which the playlist API never accepted. Its pages could not be saved correctly either, because the panel sent no `page` and the server stored no page number or parent link on page rows. **Change** - Migration 0004: `media.document_id` and `media.page` on `document_page` rows, plus a backfill for existing pages. A PDF is linked only when the number of attributed pages equals `pdf_pages`. If it does not match, the pages stay unlinked rather than being linked wrongly. - Upload sets both fields and gives each page the PDF's file name. Deleting a PDF deletes its pages and their files. - `PUT /playlists/{id}/items`: `kind: "document"` expands into one `document_page` per page, in page order. A `document_page` without `page` takes its page number from the media row. - Panel: sends `document` for a whole PDF and `page` for a single page, and labels library entries "(all pages)" / "— page N". **Tested locally:** clippy `-D warnings`, the media and playlist integration suites against Postgres (33 tests, including the backfill and the cascade delete), and `npm run check` (32 tests).
GRI-1937: a whole PDF can be added to a playlist
Some checks failed
CI / the pre-push hook (pull_request) Successful in 10s
CI / cargo fmt (pull_request) Successful in 10s
CI / cargo deny (pull_request) Successful in 1m26s
CI / cargo deny advisories (pull_request) Failing after 1m39s
CI / cargo clippy (pull_request) Successful in 1m56s
CI / repository boundary (pull_request) Successful in 29s
CI / frontend-web (pull_request) Successful in 2m2s
CI / cargo test (pull_request) Successful in 5m26s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 28s
cc94fd19d2
The panel library lists an uploaded PDF as one 'document' entry, and saving
a playlist with it failed: 'item 0: "document" is not a known item kind'.
A page could not be saved either, because the panel sent no page number and
the server stored none for it.

- media: pages carry document_id and page (migration 0004, with a backfill
  for existing pages that links a PDF only when the page count matches);
  deleting a PDF deletes its pages and their files.
- playlists: kind 'document' expands into one document_page item per page,
  in page order; a document_page without page takes it from its media row.
- panel: sends 'document' for a whole PDF and the page number for a page;
  labels PDF entries 'all pages' / 'page N'.
vivy merged commit 5fa3ecfa0e into dev 2026-11-13 13:57:08 +00:00
vivy deleted branch fix/GRI-1937-playlist-document 2026-11-13 13:57:08 +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!153
No description provided.