Files
roaauto/docs/api-contract.json
Marius Mutu 9db4e746e3 feat: add clients nomenclator, order edit/delete/devalidate, invoice types, dashboard redesign
- New clients table with PF/PJ support, fiscal data (CUI, IBAN, eFactura fields)
- Full CRUD API for clients with search, sync integration
- Order lifecycle: edit header (DRAFT), devalidate (VALIDAT→DRAFT), delete order/invoice
- Invoice types: FACTURA (B2B) vs BON_FISCAL (B2C) with different nr formats
- OrderCreateView redesigned as multi-step flow (client→vehicle→details)
- Autocomplete from catalog_norme/catalog_preturi in OrderLineForm
- Dashboard now combines stats + full orders table with filter tabs and search
- ClientPicker and VehiclePicker with inline creation capability
- Frontend schema aligned with backend (missing columns causing sync errors)
- Mobile responsive fixes for OrderDetailView buttons

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 00:36:40 +02:00

99 lines
5.5 KiB
JSON

{
"version": "1.0",
"note": "Contract shared intre backend-agent si frontend-agent. Nu modificati fara notificarea ambilor agenti.",
"base_url": "/api",
"auth": {
"POST /auth/register": {
"body": {"email": "str", "password": "str", "tenant_name": "str", "telefon": "str"},
"response": {"access_token": "str", "token_type": "bearer", "tenant_id": "str", "plan": "str"}
},
"POST /auth/login": {
"body": {"email": "str", "password": "str"},
"response": {"access_token": "str", "token_type": "bearer", "tenant_id": "str", "plan": "str"}
},
"GET /auth/me": {
"headers": {"Authorization": "Bearer <token>"},
"response": {"id": "str", "email": "str", "tenant_id": "str", "plan": "str", "rol": "str"}
}
},
"sync": {
"GET /sync/full": {
"headers": {"Authorization": "Bearer <token>"},
"response": {
"tables": {
"clients": [], "vehicles": [], "orders": [], "order_lines": [],
"invoices": [], "appointments": [],
"catalog_marci": [], "catalog_modele": [],
"catalog_ansamble": [], "catalog_norme": [],
"catalog_preturi": [], "catalog_tipuri_deviz": [],
"catalog_tipuri_motoare": [], "mecanici": []
},
"synced_at": "ISO8601"
}
},
"GET /sync/changes": {
"params": {"since": "ISO8601"},
"response": {"tables": {}, "synced_at": "str"}
},
"POST /sync/push": {
"body": {"operations": [{"table": "str", "id": "uuid", "operation": "INSERT|UPDATE|DELETE", "data": {}, "timestamp": "str"}]},
"response": {"applied": 0, "conflicts": []}
}
},
"orders": {
"GET /orders": {"response": [{"id": "str", "status": "str", "nr_auto": "str", "total_general": 0}]},
"POST /orders": {"body": {"vehicle_id": "str", "client_id": "str", "tip_deviz_id": "str", "km_intrare": 0, "observatii": "str"}, "response": {"id": "str"}},
"GET /orders/{id}": {"response": {"id": "str", "status": "str", "lines": []}},
"PUT /orders/{id}": {"body": {"vehicle_id": "str", "client_id": "str", "tip_deviz_id": "str", "km_intrare": 0, "observatii": "str"}, "note": "Edit header - doar in DRAFT"},
"DELETE /orders/{id}": {"response": {"ok": true}, "note": "Stergere - orice nefacturat; FACTURAT = sterge factura intai"},
"POST /orders/{id}/lines": {"body": {"tip": "manopera|material", "descriere": "str", "ore": 0, "pret_ora": 0, "cantitate": 0, "pret_unitar": 0, "um": "str"}},
"POST /orders/{id}/validate": {"response": {"status": "VALIDAT"}},
"POST /orders/{id}/devalidate": {"response": {"status": "DRAFT"}, "note": "VALIDAT → DRAFT"},
"GET /orders/{id}/pdf/deviz": {"response": "application/pdf"}
},
"clients": {
"GET /clients": {"response": [{"id": "str", "tip_persoana": "PF|PJ", "denumire": "str", "cod_fiscal": "str", "telefon": "str", "email": "str", "activ": true}]},
"POST /clients": {"body": {"tip_persoana": "PF|PJ", "denumire": "str", "cod_fiscal": "str", "reg_com": "str", "adresa": "str", "judet": "str", "oras": "str", "cod_postal": "str", "tara": "str", "telefon": "str", "email": "str", "cont_iban": "str", "banca": "str", "observatii": "str"}, "response": {"id": "str"}},
"GET /clients/{id}": {"response": {"id": "str", "tip_persoana": "str", "denumire": "str", "cod_fiscal": "str", "vehicles": []}},
"PUT /clients/{id}": {"body": {"denumire": "str", "cod_fiscal": "str", "adresa": "str"}, "response": {"id": "str"}},
"DELETE /clients/{id}": {"response": {"ok": true}}
},
"vehicles": {
"GET /vehicles": {"response": [{"id": "str", "nr_auto": "str", "marca": "str", "model": "str", "an": 0}]},
"POST /vehicles": {"body": {"nr_auto": "str", "marca_id": "str", "model_id": "str", "an_fabricatie": 0, "vin": "str", "proprietar_nume": "str", "proprietar_telefon": "str"}},
"GET /vehicles/{id}": {"response": {"id": "str", "nr_auto": "str", "orders": []}},
"PUT /vehicles/{id}": {"body": {}}
},
"client_portal": {
"GET /p/{token}": {"response": {"order": {}, "tenant": {}, "lines": []}},
"POST /p/{token}/accept": {"response": {"ok": true}},
"POST /p/{token}/reject": {"response": {"ok": true}}
},
"invoices": {
"POST /invoices": {"body": {"order_id": "str", "client_id": "str", "tip_document": "FACTURA|BON_FISCAL"}, "response": {"id": "str", "nr_factura": "str"}},
"GET /invoices/{id}/pdf": {"response": "application/pdf"},
"DELETE /invoices/{id}": {"response": {"ok": true}, "note": "Sterge factura, comanda revine la VALIDAT"}
},
"users": {
"GET /users": {"response": [{"id": "str", "email": "str", "rol": "str"}]},
"POST /users/invite": {"body": {"email": "str", "rol": "admin|mecanic"}},
"DELETE /users/{id}": {"response": {"ok": true}},
"POST /auth/accept-invite": {"body": {"token": "str", "password": "str"}}
},
"appointments": {
"GET /appointments": {"response": [{"id": "str", "data": "str", "vehicle_id": "str", "descriere": "str"}]},
"POST /appointments": {"body": {"vehicle_id": "str", "data": "ISO8601", "descriere": "str"}},
"PUT /appointments/{id}": {"body": {}},
"DELETE /appointments/{id}": {"response": {"ok": true}}
},
"catalog": {
"GET /catalog/marci": {"response": [{"id": "str", "nume": "str"}]},
"GET /catalog/modele": {"params": {"marca_id": "str"}, "response": [{"id": "str", "nume": "str"}]},
"GET /catalog/norme": {"params": {"ansamblu_id": "str"}, "response": [{"id": "str", "descriere": "str", "ore": 0}]},
"GET /catalog/preturi": {"response": [{"id": "str", "tip": "str", "valoare": 0}]}
},
"health": {
"GET /health": {"response": {"status": "ok", "version": "str"}}
}
}