mirror of
https://github.com/docmost/docmost.git
synced 2025-11-17 02:51:09 +10:00
Refactoring
* Refactor workspace membership system * Create setup endpoint * Use Passport.js * Several updates and fixes
This commit is contained in:
2
apps/server/src/integrations/storage/interfaces/index.ts
Normal file
2
apps/server/src/integrations/storage/interfaces/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './storage-driver.interface';
|
||||
export * from './storage.interface';
|
||||
@ -0,0 +1,19 @@
|
||||
export interface StorageDriver {
|
||||
upload(filePath: string, file: Buffer): Promise<void>;
|
||||
|
||||
read(filePath: string): Promise<Buffer>;
|
||||
|
||||
exists(filePath: string): Promise<boolean>;
|
||||
|
||||
getUrl(filePath: string): string;
|
||||
|
||||
getSignedUrl(filePath: string, expireIn: number): Promise<string>;
|
||||
|
||||
delete(filePath: string): Promise<void>;
|
||||
|
||||
getDriver(): any;
|
||||
|
||||
getDriverName(): string;
|
||||
|
||||
getConfig(): Record<string, any>;
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
import { S3ClientConfig } from '@aws-sdk/client-s3';
|
||||
|
||||
export enum StorageOption {
|
||||
LOCAL = 'local',
|
||||
S3 = 's3',
|
||||
}
|
||||
|
||||
export type StorageConfig =
|
||||
| { driver: StorageOption.LOCAL; config: LocalStorageConfig }
|
||||
| { driver: StorageOption.S3; config: S3StorageConfig };
|
||||
|
||||
export interface LocalStorageConfig {
|
||||
storagePath: string;
|
||||
}
|
||||
|
||||
export interface S3StorageConfig
|
||||
extends Omit<S3ClientConfig, 'endpoint' | 'bucket'> {
|
||||
endpoint: string; // Enforce endpoint
|
||||
bucket: string; // Enforce bucket
|
||||
baseUrl?: string; // Optional CDN URL for assets
|
||||
}
|
||||
|
||||
export interface StorageOptions {
|
||||
disk: StorageConfig;
|
||||
}
|
||||
|
||||
export interface StorageOptionsFactory {
|
||||
createStorageOptions(): Promise<StorageConfig> | StorageConfig;
|
||||
}
|
||||
|
||||
export interface StorageModuleOptions {
|
||||
imports?: any[];
|
||||
}
|
||||
Reference in New Issue
Block a user