feat(domain,application,infrastructure,backend,web-server,app-tauri,frontend): bibliothèque d'icônes projet personnalisées importées par l'utilisateur — #358 (QA verte)

domain: variante ProjectIconSet::Custom, métadonnées CustomProjectIconAsset (id opaque, media type png/jpeg/webp, byte_size, dimensions décodées, sha256, nom de fichier original sans chemin, created_at), CustomProjectIconContent et port CustomProjectIconAssetStore (list/read/exists/create/delete) avec CustomProjectIconStoreError dédiée.
application: use case project_icon_assets — import validé png/jpeg/webp avec rejet du contenu SVG, dimensionnement et digest sha256, bibliothèque partagée à l'instance indépendante de tout projet, suppression refusée tant que l'asset est référencé par un projet.
infrastructure: store fichier store/project_icon_asset.rs — index canonique + octets, création atomique sous extension validée.
backend/web-server: contrat HTTP /api/project-icon-assets (GET liste, POST import, GET lecture, GET /usage, DELETE) avec prévol OPTIONS et tests contrat incluant le rejet SVG.
app-tauri: commandes import/list/read/get_usage/delete_custom_project_icon_asset exposées au frontend.
frontend: port ProjectIconAssetGateway (list/import/delete/getUrl sans exposer de chemin filesystem), gateways http+mock avec tests, DI, section Icônes personnalisées du ProjectIconPicker (import fichier accept png/jpeg/webp, sélection role=option, suppression avec retrait de sélection, erreurs lisibles i18n FR/EN), tests projectIcons étendus.

QA verte: contrats HTTP et Tauri identiques, suites cargo et npm ciblées vertes.
This commit is contained in:
2026-09-15 07:57:51 +02:00
parent a082b55c75
commit 0f01d1f9b1
32 changed files with 2002 additions and 151 deletions

View File

@ -495,13 +495,35 @@ export interface UserSettingsGateway {
updateUserSettings(settings: Partial<UserSettings>): Promise<UserSettings>;
}
export type ProjectIconSet = "emoji" | "devicon" | "simple-icons" | "lucide" | "idea";
export type ProjectIconSet = "emoji" | "devicon" | "simple-icons" | "lucide" | "idea" | "custom";
export interface ProjectIconRef {
set: ProjectIconSet;
name: string;
}
/** One user-imported raster icon in the instance-wide project icon library. */
export interface CustomProjectIconAsset {
id: string;
mediaType: "image/png" | "image/jpeg" | "image/webp";
byteSize: number;
width: number;
height: number;
sha256: string;
originalFilename: string;
createdAt: number | string;
usedByProjectCount: number;
}
/** Shared custom-project-icon library, independent from any single project. */
export interface ProjectIconAssetGateway {
list(): Promise<CustomProjectIconAsset[]>;
import(file: File): Promise<CustomProjectIconAsset>;
delete(assetId: string): Promise<void>;
/** Returns a browser-loadable URL without exposing a local filesystem path. */
getUrl(assetId: string): Promise<string>;
}
export interface ProjectSettings {
themeColor: string | null;
/** Absent only when talking to a pre-#325 backend. */
@ -1892,6 +1914,7 @@ export interface Gateways {
input: InputGateway;
terminal: TerminalGateway;
project: ProjectGateway;
projectIconAsset: ProjectIconAssetGateway;
layout: LayoutGateway;
git: GitGateway;
remote: RemoteGateway;