File uploading
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Database } from "@paulaboks/boksy";
|
||||
import { Database, type Model } from "@paulaboks/boksy";
|
||||
|
||||
import { DATABASE_PATH } from "@/src/server_constants.ts";
|
||||
import type { PassphraseBackup } from "@/src/keys.ts";
|
||||
@@ -11,10 +11,25 @@ export interface User extends Record<string, unknown> {
|
||||
passphrase_backup?: PassphraseBackup;
|
||||
}
|
||||
|
||||
export interface StoredFile extends Record<string, unknown> {
|
||||
user_id: string;
|
||||
// Name of the encrypted file inside FILE_UPLOAD_PATH
|
||||
storage_id: string;
|
||||
// Size of the encrypted file
|
||||
size: number;
|
||||
// Encrypted by the client, holds the name, type and file key
|
||||
metadata: string;
|
||||
}
|
||||
|
||||
// boksy's partial entry types lose the field types
|
||||
export type FileRow = Model & StoredFile;
|
||||
|
||||
type Schema = {
|
||||
users: User;
|
||||
files: StoredFile;
|
||||
};
|
||||
|
||||
export const db = await Database.open<Schema>(DATABASE_PATH ?? ":memory:", {
|
||||
users: ["code"],
|
||||
files: ["user_id"],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user