# Data Exports 📖 Exports de données utilisateur (portabilité RGPD Article 20) ## Diagramme ```kroki-dbml Table users { id uuid [primary key] } Table data_exports { id uuid [primary key] user_id uuid [not null, ref: > users.id] status export_status_enum [not null, default: 'pending'] export_url varchar(512) [note: 'S3/CDN signed URL (NULL until generated)'] size_bytes bigint [note: 'File size in bytes (NULL until generated)'] format export_format_enum [not null, default: 'json'] requested_at timestamp [not null, default: `now()`] generated_at timestamp [note: 'When export file was created (NULL if pending/generating)'] expires_at timestamp [note: 'Auto-calculated: generated_at + 7 days'] downloaded_at timestamp [note: 'First download timestamp (NULL if not yet downloaded)'] indexes { (user_id, requested_at) [note: 'User export history'] (status, requested_at) [note: 'Background worker queue (WHERE status = pending)'] (expires_at) [note: 'Daily cleanup job (DELETE WHERE expires_at < NOW())'] } } Enum export_status_enum { pending [note: 'Demande en file d attente'] generating [note: 'Génération en cours (worker background)'] ready [note: 'Export disponible au téléchargement'] downloaded [note: 'Export téléchargé par l utilisateur'] expired [note: 'Export expiré (supprimé automatiquement)'] } Enum export_format_enum { json [note: 'Machine-readable (données brutes)'] html [note: 'Human-readable (page web stylée)'] zip [note: 'Archive complète (JSON + HTML + audio files)'] } ``` ## Légende **Formats d'export** : - `json` : Machine-readable (données brutes) - `html` : Human-readable (page web stylée) - `zip` : Archive complète (JSON + HTML + audio files) **Contenu de l'export** : - Profil utilisateur (email, pseudo, date inscription, bio) - Historique d'écoute (titres, dates, durées) - Contenus créés (audio + métadonnées) - Abonnements et likes - Centres d'intérêt (jauges) - Historique consentements RGPD **Statuts** : - `pending` : Demande en file d'attente - `generating` : Génération en cours (worker background) - `ready` : Export disponible au téléchargement - `downloaded` : Export téléchargé par l'utilisateur - `expired` : Export expiré (supprimé automatiquement) **Règles** : - Génération asynchrone (worker background) - Délai max : **48h** (conformité RGPD) - Conservation : **7 jours** après génération - Limite : **1 export/mois** (anti-abus) - Notification par email avec lien de téléchargement