feat(entities): production + report — types, lib, api, tests floutage (Sprint 3 étape 13)
This commit is contained in:
parent
ca4291d7eb
commit
b31e8666a5
8 changed files with 301 additions and 0 deletions
22
src/entities/production/api.ts
Normal file
22
src/entities/production/api.ts
Normal 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}`)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue