Files
WebApp/src/app/governance/api/risk-batches.api.ts
T
Roberto Treviño Cervantes dc37c54938 wording fixes
2026-11-17 02:17:24 -06:00

30 lines
1.3 KiB
TypeScript

import { HttpClient } from '@angular/common/http';
import { Injectable, inject } from '@angular/core';
import { Observable } from 'rxjs';
import { PendingRiskBatch } from './risk-batches.types';
/** `/<domain>/riesgos/lotes`: risk batches a model produced and nobody has reviewed yet (ADR-MD-008). Only `cacu`
* is served today. */
@Injectable({ providedIn: 'root' })
export class RiskBatchesApi {
private readonly http = inject(HttpClient);
listPending(domain: string): Observable<PendingRiskBatch[]> {
return this.http.get<PendingRiskBatch[]>(`/${domain}/riesgos/lotes`);
}
/** Moves every current evaluation of the batch to `final`: it becomes the one patient records read. */
confirm(domain: string, loteId: number, reason: string): Observable<{ lote_id: number; evaluaciones_cambiadas: number }> {
return this.http.post<{ lote_id: number; evaluaciones_cambiadas: number }>(
`/${domain}/riesgos/lotes/${loteId}/confirmar`, { reason },
);
}
/** Moves every current evaluation of the batch to `entered-in-error` instead. */
void(domain: string, loteId: number, reason: string): Observable<{ lote_id: number; evaluaciones_cambiadas: number }> {
return this.http.post<{ lote_id: number; evaluaciones_cambiadas: number }>(
`/${domain}/riesgos/lotes/${loteId}/anular`, { reason },
);
}
}