feat(historique): page /historique — liste paginée des productions + gating plan (Sprint 3.7)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hermann_Kitio 2026-04-22 21:29:32 +03:00
parent da4e465125
commit a752029c19
12 changed files with 762 additions and 1 deletions

View file

@ -13,6 +13,7 @@ import type {
CreateSimulationPayload,
Production,
SimulationState,
SimulationsListResponse,
SujetData,
Tache,
} from './types'
@ -27,6 +28,19 @@ export function getSimulation(id: string): Promise<Production> {
return apiFetch<Production>(`/simulations/${id}`)
}
/**
* Sprint 3.7 liste paginée des simulations de l'utilisateur connecté.
* Endpoint : `GET /simulations?page=X&limit=Y`. Tri `created_at DESC` côté backend.
* Champs lourds exclus (contenu, rapport, exercices, modele) cf. SimulationListItem.
*/
export function listSimulations(
page: number,
limit: number,
): Promise<SimulationsListResponse> {
const qs = new URLSearchParams({ page: String(page), limit: String(limit) })
return apiFetch<SimulationsListResponse>(`/simulations?${qs.toString()}`)
}
/**
* FTD-21 récupère l'état complet d'une simulation (contenu + sujet + rapport).
* Utilisé par `SimulationFlowProvider` pour restaurer une session depuis

View file

@ -89,6 +89,30 @@ export interface SimulationState {
export type SimulationJobStatus = 'pending' | 'ready' | 'error'
/**
* Sprint 3.7 Item léger pour la liste /historique.
* Miroir de `ListItem` côté backend (GET /simulations pagination).
* Les champs lourds (contenu, rapport, exercices, modele) sont **exclus**.
*/
export interface SimulationListItem {
id: string
tache: Tache
mode: Mode
score: number | null
nclc: number | null
nclc_cible: 9 | 10 | null
created_at: string
}
export interface SimulationsListResponse {
data: SimulationListItem[]
pagination: {
page: number
limit: number
total: number
}
}
/**
* Rapport tel que stocké par le backend (sans `simulation_id`, `exercices`, `modele`
* qui sont portés par SimulationState). Miroir de `CorrectionRapport` côté backend