fix(report): aligner payloads corrections/ee et eo sur contrat backend réel
This commit is contained in:
parent
d7b084d05a
commit
1dbca24c35
3 changed files with 17 additions and 8 deletions
|
|
@ -13,9 +13,16 @@
|
|||
import { apiFetch } from '@/shared/lib/api-client'
|
||||
import type { CorrectEePayload, CorrectEoPayload, Report } from './types'
|
||||
|
||||
/** Récupère un rapport existant. Endpoint : `GET /simulations/:id`. */
|
||||
export function getReport(id: string): Promise<Report> {
|
||||
return apiFetch<Report>(`/simulations/${id}`)
|
||||
}
|
||||
|
||||
const CORRECTION_TIMEOUT_MS = 30_000
|
||||
|
||||
/** Soumet une production écrite pour correction. Endpoint : `POST /corrections/ee`. */
|
||||
/** Soumet une production écrite pour correction. Endpoint : `POST /corrections/ee`.
|
||||
* Payload : { simulationId, contenu, tache }
|
||||
*/
|
||||
export function correctEe(payload: CorrectEePayload): Promise<Report> {
|
||||
return apiFetch<Report>('/corrections/ee', {
|
||||
method: 'POST',
|
||||
|
|
@ -26,7 +33,7 @@ export function correctEe(payload: CorrectEePayload): Promise<Report> {
|
|||
|
||||
/**
|
||||
* Soumet une production orale pour correction. Endpoint : `POST /corrections/eo`.
|
||||
* audio_url : URL pré-signée après upload Supabase Storage (implémenté Sprint 4).
|
||||
* Payload : { simulationId, transcript, tache } — transcript implémenté Sprint 4.
|
||||
*/
|
||||
export function correctEo(payload: CorrectEoPayload): Promise<Report> {
|
||||
return apiFetch<Report>('/corrections/eo', {
|
||||
|
|
|
|||
|
|
@ -45,17 +45,19 @@ export interface Report {
|
|||
|
||||
/** Corps de `POST /corrections/ee`. */
|
||||
export interface CorrectEePayload {
|
||||
simulation_id: string
|
||||
texte: string
|
||||
simulationId: string
|
||||
contenu: string
|
||||
tache: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Corps de `POST /corrections/eo`.
|
||||
* audio_url : URL pré-signée après upload vers Supabase Storage (Sprint 4).
|
||||
* transcript : transcription audio envoyée au backend (implémenté Sprint 4).
|
||||
*/
|
||||
export interface CorrectEoPayload {
|
||||
simulation_id: string
|
||||
audio_url: string
|
||||
simulationId: string
|
||||
transcript: string
|
||||
tache: string
|
||||
}
|
||||
|
||||
/** Sections du rapport dont la visibilité dépend du plan. */
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export function useSimulation() {
|
|||
|
||||
function submitText(texte: string): void {
|
||||
if (!production) return
|
||||
correctMutation.mutate({ simulation_id: production.id, texte })
|
||||
correctMutation.mutate({ simulationId: production.id, contenu: texte, tache: production.tache })
|
||||
}
|
||||
|
||||
function reset(): void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue