refactor: restructure frontend and backend by domain services
PR — Ouverture automatique / create-pr (push) Successful in 3s

Split the monolithic backend (lib/, routes/, access.ts, storage.ts, media.ts)
into a layered structure inspired by JeanXXIII-CRM:
- config/: appConfig, db
- middleware/: auth (session, roles, cookies)
- models/: shared types
- routes/: *Routes.ts (thin HTTP handlers)
- services/: *Service.ts (business logic, one per domain)
- utils/: errors, http, migrate, ratelimit, validators, service bootstrap

Frontend likewise: services/*Service.ts + apiClient, contexts/, types/, utils/format.
Route files now carry the "Routes" suffix; service files are named
authService.ts, ratelimit.ts, etc. and live in their own files, frontend and
backend separated.

Updated docs and READMEs to reflect the new layout. Typecheck and builds pass.
This commit is contained in:
2026-11-13 09:45:21 +01:00
parent d837817bcb
commit 68d4d5dea0
103 changed files with 5415 additions and 4711 deletions
+196
View File
@@ -0,0 +1,196 @@
export type Theme = "system" | "light" | "dark";
export type Language = "fr" | "en";
export interface User {
id: string;
email: string;
first_name: string;
last_name: string;
role_slug: string;
role_name: string;
quota_bytes: number;
used_bytes: number;
max_file_bytes: number;
must_change_password: boolean;
theme: Theme;
language: Language;
has_avatar: boolean;
avatar_updated_at: string | null;
}
export interface Folder {
id: string;
parent_id: string | null;
name: string;
owner_id: string | null;
access_type: string;
is_system: boolean;
created_at: string;
updated_at: string;
}
export interface UploadedFile {
id: string;
folder_id: string | null;
name: string;
mime_type: string | null;
size_bytes: number;
checksum_sha256: string | null;
owner_id: string | null;
is_starred: boolean;
download_count: number;
created_at: string;
updated_at: string;
}
export interface UploadSession {
uploadId: string;
name: string;
folderId: string | null;
size: number;
chunkSize: number;
uploadedBytes: number;
expiresAt: string;
}
export interface FavoriteFile extends UploadedFile {
folder_name: string | null;
}
export interface FolderPermission {
user_id: string;
email: string;
first_name: string;
last_name: string;
level: string;
expires_at: string | null;
created_at: string;
}
export interface SessionInfo {
id: string;
ip_address: string | null;
user_agent: string | null;
created_at: string;
last_seen_at: string;
expires_at: string;
current: boolean;
}
export interface TrashFolder {
id: string;
parent_id: string | null;
name: string;
owner_id: string | null;
access_type: string;
created_at: string;
updated_at: string;
deleted_at: string;
}
export interface TrashFile {
id: string;
folder_id: string | null;
name: string;
mime_type: string | null;
size_bytes: number;
owner_id: string | null;
created_at: string;
updated_at: string;
deleted_at: string;
}
export interface MediaItem {
id: string;
folder_id: string | null;
name: string;
mime_type: string | null;
size_bytes: number;
owner_id: string | null;
is_starred: boolean;
kind: string | null;
width: number | null;
height: number | null;
created_at: string;
has_thumbnail: boolean;
}
export interface AdminUser {
id: string;
email: string;
first_name: string;
last_name: string;
role_slug: string;
quota_bytes: number;
used_bytes: number;
max_file_bytes: number;
is_active: boolean;
must_change_password: boolean;
last_login_at: string | null;
created_at: string;
}
export interface StorageLocation {
id: number;
name: string;
slug: string;
mount_path: string;
quota_bytes: number | null;
used_bytes: number;
is_active: boolean;
created_at: string;
}
export interface AdminStats {
users: number;
folders: number;
files: number;
usedBytes: number;
trashFiles: number;
locations: { id: number; name: string; used_bytes: number; quota_bytes: number | null }[];
}
export interface AuditEntry {
id: number;
user_id: string | null;
user_email: string | null;
action: string;
resource: string;
resource_id: string | null;
details: string | null;
ip_address: string | null;
created_at: string;
}
export interface ChatMember {
id: string;
first_name: string;
last_name: string;
role_slug: string;
has_avatar: boolean;
avatar_updated_at: string | null;
last_login_at: string | null;
is_self: boolean;
}
export interface ChatMessage {
id: number;
user_id: string | null;
first_name: string | null;
last_name: string | null;
body: string;
created_at: string;
edited_at: string | null;
is_pinned: boolean;
has_avatar: boolean;
avatar_updated_at: string | null;
}
export interface DirectoryUser {
id: string;
first_name: string;
last_name: string;
email: string;
has_avatar: boolean;
avatar_updated_at: string | null;
}