feat(files): store file sizes, add size range filter and sorting

Adds project_files.size (schema, idempotent migration, ensureFileSizesColumn), records multer size on both upload paths, backfills legacy rows from storage at startup and after restore (lib/file-sizes.js) with a lazy per-row update on read. GET /api/files and /api/files/detached accept min_size/max_size and a whitelisted sort (new/old/size_desc/size_asc); files page gets size and sort selects. size is carried through backup normalize/restore.
This commit is contained in:
dev
2026-10-23 10:25:16 +03:00
parent 621067a880
commit 7d610c549e
7 changed files with 101 additions and 16 deletions
+1
View File
@@ -188,6 +188,7 @@ CREATE TABLE IF NOT EXISTS project_files (
token VARCHAR(64) UNIQUE NOT NULL,
path VARCHAR(255) NOT NULL,
name VARCHAR(255) NOT NULL,
size BIGINT,
created_at TIMESTAMPTZ DEFAULT now(),
detached_at TIMESTAMPTZ
);