move files into folders

This commit is contained in:
m
2026-07-13 17:07:00 +02:00
parent 07b03562b1
commit 04b6dfc6d4
8 changed files with 204 additions and 4 deletions
+6 -1
View File
@@ -5,7 +5,7 @@ WHERE id = $1 LIMIT 1;
-- name: ListFiles :many
SELECT * FROM files
WHERE parent_file_id IS NULL
ORDER BY created_at DESC;
ORDER BY is_folder DESC, created_at DESC;
-- name: ListFolders :many
SELECT * FROM files
@@ -32,6 +32,11 @@ SELECT * FROM files
WHERE parent_file_id = $1
ORDER BY is_folder DESC, created_at DESC;
-- name: MoveFiles :exec
UPDATE files
SET parent_file_id = $1, updated_at = CURRENT_TIMESTAMP
WHERE id = ANY($2::text[]);
-- name: UpdateFile :exec
UPDATE files
SET name = $1, mime_type = $2, ocr_text = $3, updated_at = CURRENT_TIMESTAMP