mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-11-04 08:10:28 +09:00
서버 코드를 Router, Service, Repository 계층으로 분리하고 오류 처리 및 파일 삭제 로직 개선
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ed732be999
commit
6a6aa1765b
72 files changed
+1928
-1509
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import db from "../kysely";
|
||||
|
||||
export const enqueueFileDeletions = async (
|
||||
trx: typeof db,
|
||||
paths: (string | null | undefined)[],
|
||||
) => {
|
||||
const values = paths
|
||||
.filter((path) => !!path)
|
||||
.map((path) => ({ path: path!, enqueued_at: new Date() }));
|
||||
if (values.length > 0) {
|
||||
await trx.insertInto("file_deletion_queue").values(values).execute();
|
||||
}
|
||||
};
|
||||
|
||||
export const getPendingFileDeletions = async (limit: number) => {
|
||||
return await db
|
||||
.selectFrom("file_deletion_queue")
|
||||
.select(["id", "path"])
|
||||
.orderBy("id")
|
||||
.limit(limit)
|
||||
.execute();
|
||||
};
|
||||
|
||||
export const completeFileDeletions = async (ids: number[]) => {
|
||||
if (ids.length > 0) {
|
||||
await db.deleteFrom("file_deletion_queue").where("id", "in", ids).execute();
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user