chore: project structure + API contract
This commit is contained in:
6
.env.example
Normal file
6
.env.example
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
SECRET_KEY=change-me-in-production
|
||||||
|
DATABASE_URL=sqlite+aiosqlite:///./data/roaauto.db
|
||||||
|
ACCESS_TOKEN_EXPIRE_DAYS=30
|
||||||
|
TRIAL_DAYS=30
|
||||||
|
SMSAPI_TOKEN=
|
||||||
|
CORS_ORIGINS=http://localhost:5173
|
||||||
0
backend/data/.gitkeep
Normal file
0
backend/data/.gitkeep
Normal file
87
docs/api-contract.json
Normal file
87
docs/api-contract.json
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
{
|
||||||
|
"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": {
|
||||||
|
"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", "tip_deviz_id": "str", "km_intrare": 0, "observatii": "str"}, "response": {"id": "str"}},
|
||||||
|
"GET /orders/{id}": {"response": {"id": "str", "status": "str", "lines": []}},
|
||||||
|
"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"}},
|
||||||
|
"GET /orders/{id}/pdf/deviz": {"response": "application/pdf"}
|
||||||
|
},
|
||||||
|
"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"}, "response": {"id": "str", "nr_factura": "str"}},
|
||||||
|
"GET /invoices/{id}/pdf": {"response": "application/pdf"}
|
||||||
|
},
|
||||||
|
"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"}}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user