afp-backend / docs /api.md
AFP-PROJECT-2024
feat(quotations): route and calcul workflow
c4b0f63
# API conventions
## Versioning
- All endpoints are under `/api/v1`.
## Resource pattern
- `POST /resource`
- `GET /resource`
- `GET /resource/{id}`
- `PATCH /resource/{id}`
- `DELETE /resource/{id}`
## Error format
```json
{
"detail": "human readable message"
}
```
Validation errors return `detail` as an array of field error objects.
## Naming
- API payloads use `snake_case`.
- Legacy DB naming mismatches (e.g. `customer.Id`) are normalized in schemas.
## Pagination
List responses use:
```json
{
"items": [],
"total": 0,
"skip": 0,
"take": 50
}
```
## Decimal values
`Decimal` fields should be exposed as strings to avoid float precision drift.
---
## Endpoints
API endpoints are documented in the `endpoints/` folder:
- **[Quotations: Calculate Prices](endpoints/quotations.md)** (`POST /api/v1/quotations/calculate-prices`)
- Calculate best supplier prices for articles
- Apply pricing rules with optional UI overrides
- Return full restitution table data