mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-11-04 08:10:28 +09:00
DB 접근 시 Executor를 명시적으로 전달하고 서비스에서 트랜잭션 경계를 관리하도록 인증 및 키 관련 코드를 개선하고 직렬화 실패 시 트랜잭션을 재시도하도록 변경
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5b8621e524
commit
73b2d29b2c
18 files changed
+564
-385
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import type { Insertable } from "kysely";
|
||||
import type { Executor } from "../executor.ts";
|
||||
import type {
|
||||
CategoryLogTable,
|
||||
DirectoryLogTable,
|
||||
FileLogTable,
|
||||
HskLogTable,
|
||||
MekLogTable,
|
||||
} from "../schema/index.ts";
|
||||
|
||||
// Audit logs of changes, timestamped when appended
|
||||
|
||||
type NewLog<T> = Omit<Insertable<T>, "id" | "timestamp">;
|
||||
|
||||
export const appendDirectoryLog = async (executor: Executor, log: NewLog<DirectoryLogTable>) => {
|
||||
await executor
|
||||
.insertInto("directory_log")
|
||||
.values({ ...log, timestamp: new Date() })
|
||||
.execute();
|
||||
};
|
||||
|
||||
export const appendFileLog = async (executor: Executor, log: NewLog<FileLogTable>) => {
|
||||
await executor
|
||||
.insertInto("file_log")
|
||||
.values({ ...log, timestamp: new Date() })
|
||||
.execute();
|
||||
};
|
||||
|
||||
export const appendCategoryLog = async (executor: Executor, log: NewLog<CategoryLogTable>) => {
|
||||
await executor
|
||||
.insertInto("category_log")
|
||||
.values({ ...log, timestamp: new Date() })
|
||||
.execute();
|
||||
};
|
||||
|
||||
export const appendMekLog = async (executor: Executor, log: NewLog<MekLogTable>) => {
|
||||
await executor
|
||||
.insertInto("master_encryption_key_log")
|
||||
.values({ ...log, timestamp: new Date() })
|
||||
.execute();
|
||||
};
|
||||
|
||||
export const appendHskLog = async (executor: Executor, log: NewLog<HskLogTable>) => {
|
||||
await executor
|
||||
.insertInto("hmac_secret_key_log")
|
||||
.values({ ...log, timestamp: new Date() })
|
||||
.execute();
|
||||
};
|
||||
Reference in new issue
Block a user