File sharing
This commit is contained in:
@@ -21,15 +21,27 @@ export interface StoredFile extends Record<string, unknown> {
|
||||
metadata: string;
|
||||
}
|
||||
|
||||
export interface StoredShare extends Record<string, unknown> {
|
||||
user_id: string;
|
||||
file_id: string;
|
||||
// The file metadata encrypted with the secret in the share link
|
||||
metadata: string;
|
||||
// The link secret encrypted with the owner's master key
|
||||
secret: string;
|
||||
}
|
||||
|
||||
// boksy's partial entry types lose the field types
|
||||
export type FileRow = Model & StoredFile;
|
||||
export type ShareRow = Model & StoredShare;
|
||||
|
||||
type Schema = {
|
||||
users: User;
|
||||
files: StoredFile;
|
||||
shares: StoredShare;
|
||||
};
|
||||
|
||||
export const db = await Database.open<Schema>(DATABASE_PATH ?? ":memory:", {
|
||||
users: ["code"],
|
||||
files: ["user_id"],
|
||||
shares: ["user_id", "file_id"],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user