admin: uploads list view with search, sort, and delete
Add /admin/uploads HTML page and JSON API backed by the upload_files DB index. The page lists file_id, name, size (KB), uploaded_at, and sha256 with client-side search by name, column sort, and per-row delete. DELETE /admin/uploads/:id removes the DB index row and the on-disk data file plus .meta.json sidecar. Admin deletes are written to the audit log. Wire the new dependencies through admin.Mount and main.go, and run the backfill step on startup so pre-existing sidecars are indexed. Tests cover auth, HTML rendering, JSON search, delete removing all artifacts, and audit entry creation. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -14,11 +14,11 @@ import (
|
||||
// The .meta.json sidecar remains the source of truth; this struct is the
|
||||
// queryable mirror used by the admin UI.
|
||||
type UploadMeta struct {
|
||||
FileID string
|
||||
Name string
|
||||
Size int64
|
||||
SHA256 string
|
||||
UploadedAt time.Time
|
||||
FileID string `json:"file_id"`
|
||||
Name string `json:"name"`
|
||||
Size int64 `json:"size"`
|
||||
SHA256 string `json:"sha256"`
|
||||
UploadedAt time.Time `json:"uploaded_at"`
|
||||
}
|
||||
|
||||
// UploadRepo provides CRUD operations for upload file index records.
|
||||
|
||||
Reference in New Issue
Block a user