mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 08:06:56 +00:00
Kysely 및 PostgreSQL 도입 (WiP)
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
foreignKey,
|
||||
unique,
|
||||
} from "drizzle-orm/sqlite-core";
|
||||
import type { ColumnType, Generated } from "kysely";
|
||||
import { user } from "./user";
|
||||
|
||||
export const client = sqliteTable(
|
||||
@@ -59,3 +60,32 @@ export const userClientChallenge = sqliteTable(
|
||||
}),
|
||||
}),
|
||||
);
|
||||
|
||||
interface ClientTable {
|
||||
id: Generated<number>;
|
||||
encryption_public_key: string; // Base64
|
||||
signature_public_key: string; // Base64
|
||||
}
|
||||
|
||||
interface UserClientTable {
|
||||
user_id: number;
|
||||
client_id: number;
|
||||
state: "challenging" | "pending" | "active";
|
||||
}
|
||||
|
||||
interface UserClientChallengeTable {
|
||||
id: Generated<number>;
|
||||
user_id: number;
|
||||
client_id: number;
|
||||
answer: string; // Base64
|
||||
allowed_ip: string;
|
||||
expires_at: ColumnType<Date, Date, never>;
|
||||
}
|
||||
|
||||
declare module "./index" {
|
||||
interface Database {
|
||||
client: ClientTable;
|
||||
user_client: UserClientTable;
|
||||
user_client_challenge: UserClientChallengeTable;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user