feat(admin): purge-archived endpoint with an archived-items banner
Bulk escape hatch for archived rows (files missing from disk for 2+ scans) so a mass external deletion never has to wait out the retention window or be clicked away row by row: - POST /api/media-items/purge-archived (admin only) hard-deletes all archived items and returns the purged count; reading history goes with the rows, so the call is confirmed in the UI first. - The library admin page shows an 'Archived items: N' card (only when non-zero) with a Purge Archived Now button that calls the endpoint, toasts the result, and reloads. - Frontend admin JS exposes window.purgeArchivedItems following the existing localStorage-bearer-token pattern.
This commit is contained in:
@@ -884,7 +884,8 @@ func registerFrontendRoutes(cfg *Config) {
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
err = templates.AdminLibrary(user, libData, userData).Render(c.Request().Context(), &buf)
|
||||
archivedCount, _ := cfg.Queries.CountArchivedMediaItems(c.Request().Context())
|
||||
err = templates.AdminLibrary(user, libData, userData, archivedCount).Render(c.Request().Context(), &buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user