afp-backend / docs /api.md
Cyril Dupland
feat(prices): implement price management with date ranges, including creation, retrieval, and history listing; update schemas and API documentation
15f1cb0
|
Raw History Blame Contribute Delete
1.11 kB

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

{
  "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:

{
  "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 (POST /api/v1/quotations/calculate-prices)
    • Calculate best supplier prices for articles
    • Apply pricing rules with optional UI overrides
    • Return full restitution table data
  • Prices (GET/POST /api/v1/prices)
    • Price history and admin creation with date ranges