feat(entities): production + report — types, lib, api, tests floutage (Sprint 3 étape 13)

This commit is contained in:
Hermann_Kitio 2026-04-19 03:37:41 +03:00
parent ca4291d7eb
commit b31e8666a5
8 changed files with 301 additions and 0 deletions

View file

@ -0,0 +1,22 @@
/**
* Appels API du domaine `production`.
*
* Toutes les requêtes passent par `apiFetch` (Règle J / Règle F).
* - `POST /simulations` : timeout 5s (défaut), retry désactivé (POST non-idempotent).
* - `GET /simulations/:id` : timeout 5s, retry activé (GET idempotent).
*
* Erreurs notables : `QUOTA_REACHED` (Free 5/5), `PLAN_INSUFFICIENT` (exam_mode).
*/
import { apiFetch } from '@/shared/lib/api-client'
import type { CreateSimulationPayload, Production } from './types'
/** Crée une nouvelle simulation. Endpoint : `POST /simulations` (HTTP 201). */
export function createSimulation(payload: CreateSimulationPayload): Promise<Production> {
return apiFetch<Production>('/simulations', { method: 'POST', body: payload })
}
/** Récupère une simulation existante. Endpoint : `GET /simulations/:id`. */
export function getSimulation(id: string): Promise<Production> {
return apiFetch<Production>(`/simulations/${id}`)
}