feat: per-pool automatic file sorting
deploy / deploy (push) Successful in 2s

Pools now store a sort setting (sort_key + sort_order). "manual" keeps the
user-arranged order in file_pool.position and allows drag-to-reorder; any
other key (content_datetime, created, original_name) sorts the pool's files
automatically server-side, in which case reordering is rejected. Manual
order is always ascending by position — direction does not apply.

Backend: add the columns (sort_key defaults to 'manual'), generalise the
pool-files keyset cursor to page by the active sort, persist the setting on
create/update, and guard reorder against non-manual pools.

Frontend: a sort dropdown (+ direction toggle) on the pool page that PATCHes
the pool and reloads; drag-to-reorder is disabled unless the pool is manual.

Closes the "automatic sorting in pools" requirement (REQUIREMENTS.md §4.6.5).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 08:36:12 +03:00
parent 28f5b5d150
commit 4b6db84afc
9 changed files with 445 additions and 33 deletions
+16
View File
@@ -2281,6 +2281,16 @@ components:
type: string
is_public:
type: boolean
sort_key:
type: string
enum: [manual, content_datetime, created, original_name]
description: >-
How the pool's files are ordered. "manual" keeps the user-defined
order (drag-to-reorder); any other key sorts the files automatically
by that file field and disables manual reordering.
sort_order:
type: string
enum: [asc, desc]
file_count:
type: integer
created_at:
@@ -2312,6 +2322,12 @@ components:
type: object
is_public:
type: boolean
sort_key:
type: string
enum: [manual, content_datetime, created, original_name]
sort_order:
type: string
enum: [asc, desc]
PoolOffsetPage:
type: object