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
+17
View File
@@ -36,6 +36,23 @@
<div><label>Группа</label><select id="groupFilter"><option value="">Все группы</option></select></div>
<div><label>С</label><input type="date" id="dateFrom"></div>
<div><label>По</label><input type="date" id="dateTo"></div>
<div><label>Размер</label>
<select id="sizeFilter">
<option value="">Любой размер</option>
<option value="0-1048576">до 1 МБ</option>
<option value="1048576-10485760">1–10 МБ</option>
<option value="10485760-52428800">10–50 МБ</option>
<option value="52428800-">больше 50 МБ</option>
</select>
</div>
<div><label>Сортировка</label>
<select id="sortOrder">
<option value="new">Сначала новые</option>
<option value="old">Сначала старые</option>
<option value="size_desc">Сначала крупные</option>
<option value="size_asc">Сначала мелкие</option>
</select>
</div>
<div><label>Тип</label>
<div class="view-toggle" id="tabToggle">
<button data-mode="attached" type="button">Прикреплённые</button>