Merge pull request #641 from EdouardVanbelle/refactor/front-resource-list

feat(fileDto, folderDto): add is_favorite + is_shared
This commit is contained in:
Dionisio Pozo
2026-07-22 06:51:28 +02:00
committed by GitHub
50 changed files with 1140 additions and 287 deletions
+5
View File
@@ -94,6 +94,11 @@ jsonpath "$.items" count == 1
jsonpath "$.items[0].resource.id" == {{file_id}}
jsonpath "$.items[0].resource_type" == "file"
jsonpath "$.items[0].resource.name" == "hello-renamed.txt"
# Caller-flag contract — every row on /api/favorites/resources IS
# favorited by construction (the listing SQL hardcodes
# `TRUE AS is_favorite`). `is_shared` is a real per-row EXISTS.
jsonpath "$.items[0].resource.is_favorite" == true
jsonpath "$.items[0].resource.is_shared" == false
# ─────────────────────────────────────────────────────────────
+7
View File
@@ -107,6 +107,10 @@ jsonpath "$.parent_id" == {{home_folder_id}}
# D0 §14 provenance — self-creation: both fields stamp the caller.
jsonpath "$.created_by" == "{{admin_user_id}}"
jsonpath "$.updated_by" == "{{admin_user_id}}"
# Caller-flag contract — fresh folder: not favorited, no grants on it.
# Wire contract is "always present bool" — never null, never absent.
jsonpath "$.is_favorite" == false
jsonpath "$.is_shared" == false
# ─────────────────────────────────────────────────────────────
@@ -176,6 +180,9 @@ jsonpath "$.size" == 32
jsonpath "$.mime_type" == "text/plain"
# D0 §14 provenance — uploader's id stamps both fields on a fresh upload.
jsonpath "$.created_by" == "{{admin_user_id}}"
# Caller-flag contract — fresh upload: not favorited, no grants on it.
jsonpath "$.is_favorite" == false
jsonpath "$.is_shared" == false
jsonpath "$.updated_by" == "{{admin_user_id}}"
+10
View File
@@ -738,6 +738,16 @@ jsonpath "$.items[0].resource.updated_by" == "{{alice_user_id}}"
jsonpath "$.items[1].resource.name" == "adam-renamed-logo.jpg"
jsonpath "$.items[1].resource.created_by" == "{{alice_user_id}}"
jsonpath "$.items[1].resource.updated_by" == "{{adam_user_id}}"
# Caller-flag contract on the listing endpoint. Neither row
# favorited by Alice → is_favorite = false. The `perm_folder_id`
# tree carries a role_grant on the FOLDER (Adam as Editor), not
# on `perm-test-child` or `adam-renamed-logo.jpg` — so both
# child rows should carry is_shared = false; the grant on the
# parent doesn't cascade to per-child EXISTS.
jsonpath "$.items[0].resource.is_favorite" == false
jsonpath "$.items[0].resource.is_shared" == false
jsonpath "$.items[1].resource.is_favorite" == false
jsonpath "$.items[1].resource.is_shared" == false
# ── Thumbnail push (Update) succeeds ────────────────────────
PUT {{base_url}}/api/files/{{perm_file_id}}/thumbnail/preview