From 72545126c42a616c2e31dfa0a9372d8fea92970b Mon Sep 17 00:00:00 2001 From: Zac Date: Sun, 17 May 2026 12:55:36 -0400 Subject: [PATCH] fix: delete asset actually deletes Trash icon in the library was firing PATCH /assets/:id with {status:"deleted"}. The PATCH route only accepts display_name/tags/notes so it returned "No fields to update" and the asset stayed put. * api.js: add deleteAsset(id, {hard}) helper hitting the real DELETE route. * index.html: deleteAssetPrompt now calls deleteAsset (soft archive). Confirm dialog reworded to match. * mam-api/routes/assets.js: list endpoint hides status=archived by default. Pass ?include_archived=true to see them in a future restore-from-trash view. Filtering by ?status=archived still works for power users. * All HTML: bump api.js cache-buster v=4 -> v=5 so the new helper is fetched. --- services/mam-api/src/routes/assets.js | 7 +++++++ services/web-ui/public/capture.html | 2 +- services/web-ui/public/index.html | 6 +++--- services/web-ui/public/js/api.js | 5 +++++ services/web-ui/public/player.html | 2 +- services/web-ui/public/recorders.html | 2 +- services/web-ui/public/upload.html | 2 +- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/services/mam-api/src/routes/assets.js b/services/mam-api/src/routes/assets.js index 0459e72..890a03e 100644 --- a/services/mam-api/src/routes/assets.js +++ b/services/mam-api/src/routes/assets.js @@ -30,6 +30,7 @@ router.get('/', async (req, res, next) => { media_type, limit = 50, offset = 0, + include_archived, } = req.query; let query = ` @@ -41,6 +42,12 @@ router.get('/', async (req, res, next) => { const params = []; let paramCount = 1; + // Hide archived rows unless explicitly asked for, or unless the caller is + // already filtering by status=archived. + if (!status && include_archived !== 'true') { + query += ` AND a.status <> 'archived'`; + } + if (project_id) { query += ` AND a.project_id = $${paramCount++}`; params.push(project_id); diff --git a/services/web-ui/public/capture.html b/services/web-ui/public/capture.html index eb3c9ea..b61892c 100644 --- a/services/web-ui/public/capture.html +++ b/services/web-ui/public/capture.html @@ -312,7 +312,7 @@
- + + + + +