| 1 |
// Shared types between server and client |
| 2 |
|
| 3 |
export interface FileItem { |
| 4 |
id: string; |
| 5 |
name: string; |
| 6 |
size: number; |
| 7 |
type: 'file' | 'directory'; |
| 8 |
lastModified: Date; |
| 9 |
path: string; |
| 10 |
encrypted: boolean; |
| 11 |
mimeType?: string; |
| 12 |
checksum?: string; |
| 13 |
} |
| 14 |
|
| 15 |
export interface DirectoryListing { |
| 16 |
path: string; |
| 17 |
files: FileItem[]; |
| 18 |
totalSize: number; |
| 19 |
totalFiles: number; |
| 20 |
} |
| 21 |
|
| 22 |
export interface UploadRequest { |
| 23 |
filename: string; |
| 24 |
size: number; |
| 25 |
path: string; |
| 26 |
encrypted?: boolean; |
| 27 |
mimeType?: string; |
| 28 |
} |
| 29 |
|
| 30 |
export interface UploadResponse { |
| 31 |
fileId: string; |
| 32 |
uploadUrl: string; |
| 33 |
chunkSize: number; |
| 34 |
totalChunks: number; |
| 35 |
} |
| 36 |
|
| 37 |
export interface DownloadRequest { |
| 38 |
fileId: string; |
| 39 |
path: string; |
| 40 |
} |
| 41 |
|
| 42 |
export interface DownloadResponse { |
| 43 |
downloadUrl: string; |
| 44 |
filename: string; |
| 45 |
size: number; |
| 46 |
mimeType?: string; |
| 47 |
} |
| 48 |
|
| 49 |
export interface NodeStatus { |
| 50 |
id: string; |
| 51 |
status: 'online' | 'offline' | 'degraded'; |
| 52 |
uptime: number; |
| 53 |
storageUsed: number; |
| 54 |
storageTotal: number; |
| 55 |
peersConnected: number; |
| 56 |
lastSeen: Date; |
| 57 |
} |
| 58 |
|
| 59 |
export interface NetworkStatus { |
| 60 |
nodes: NodeStatus[]; |
| 61 |
totalStorage: number; |
| 62 |
usedStorage: number; |
| 63 |
redundancyLevel: number; |
| 64 |
healthScore: number; |
| 65 |
} |
| 66 |
|
| 67 |
export interface AuthRequest { |
| 68 |
username?: string; |
| 69 |
password?: string; |
| 70 |
token?: string; |
| 71 |
} |
| 72 |
|
| 73 |
export interface AuthResponse { |
| 74 |
token: string; |
| 75 |
refreshToken: string; |
| 76 |
expiresIn: number; |
| 77 |
user: { |
| 78 |
id: string; |
| 79 |
username: string; |
| 80 |
}; |
| 81 |
} |
| 82 |
|
| 83 |
export interface ApiError { |
| 84 |
error: string; |
| 85 |
message: string; |
| 86 |
code: number; |
| 87 |
timestamp: Date; |
| 88 |
} |