feat: endpoint istruttore (queue + review + soccorso istruttorio)
- 4 nuove colonne su remission_practice: assigned_instructor_id, reviewed_at,
reviewed_by, rejection_reason, approved_remission
- Nuova tabella remission_amendment_request con cascade delete, scope JSONB,
stati AWAITING -> RESPONSE_RECEIVED -> CLOSED / EXPIRED / REJECTED
- Router instructor.py (287 righe) con 8 endpoint:
/queue, /{id}, /{id}/claim, /{id}/approve, /{id}/reject,
/{id}/amendment, /{id}/amendment/{aid}/close,
/{id}/amendment/{aid}/respond-beneficiary
- GET /{id} (router practices) ora include amendments nel payload
- Manager manager_view flag per ROLE_INSTRUCTOR_MANAGER + SUPER_ADMIN
(vede tutto il pool vs solo le proprie assegnazioni)
- Logica status transitions verificata:
SUBMITTED -> UNDER_REVIEW (claim)
UNDER_REVIEW <-> AWAITING_AMENDMENT (amendment open/close)
UNDER_REVIEW | AWAITING_AMENDMENT -> APPROVED | REJECTED
- _compute_gate_check riusato anche dal router istruttore per calcolo
remission_due in coda e nel dettaglio
Test end-to-end verde: ciclo completo benef -> istruttore -> soccorso ->
risposta -> chiusura -> approvazione funzionante su NAPOLI SAS.
This commit is contained in:
@@ -268,7 +268,10 @@ def start_practice(body: PracticeStartRequest, db: Session = Depends(get_db),
|
||||
@router.get("/{practice_id}", response_model=ApiResponse)
|
||||
def get_practice(practice_id: UUID, db: Session = Depends(get_db), user: AuthUser = Depends(get_current_user)):
|
||||
p = _get_practice_or_404(db, practice_id, user)
|
||||
return ApiResponse(data=PracticeOut.model_validate(p).model_dump(mode="json"))
|
||||
from ..schemas import AmendmentRequestOut
|
||||
payload = PracticeOut.model_validate(p).model_dump(mode="json")
|
||||
payload["amendments"] = [AmendmentRequestOut.model_validate(a).model_dump(mode="json") for a in p.amendment_requests]
|
||||
return ApiResponse(data=payload)
|
||||
|
||||
|
||||
@router.put("/{practice_id}", response_model=ApiResponse)
|
||||
|
||||
Reference in New Issue
Block a user