Add bundle sales backend implementation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 14 · BACKEND — Sales API Reference
|
||||
|
||||
> **Authoritative for:** sales API contracts for invoices, slips, free issues, and sales reports.
|
||||
> **Authoritative for:** sales API contracts for invoices, slips, bundle sales, free issues, and sales reports.
|
||||
> **Navigation:** start from `00-CORE.md`. Sales business rules live in `docs/SALES_MODULE_PLAN.md` and the sales-related backend progress is tracked in `Backend/PROGRESS.md`.
|
||||
> **Scope:** this document covers the sales endpoints currently implemented in ERPCore. Free issue is modeled as a sales-slip alias, not a separate table.
|
||||
|
||||
@@ -132,9 +132,62 @@ Before posting, the UI calls `GET /api/v1/sales-slips/{salesSlipId}/posting-chec
|
||||
### `POST /api/v1/sales-slips/{salesSlipId}/cancel`
|
||||
Cancels a draft slip.
|
||||
|
||||
---
|
||||
|
||||
## 4. Bundle Sales
|
||||
|
||||
Bundle sales are a separate sales document family for fixed bundle compositions.
|
||||
|
||||
### `GET /api/v1/bundle-sales`
|
||||
Query:
|
||||
- `page`
|
||||
- `pageSize`
|
||||
- `q`
|
||||
- `customerId`
|
||||
- `warehouseId`
|
||||
|
||||
Returns a paged list of `BundleSaleSummaryDto`.
|
||||
|
||||
### `GET /api/v1/bundle-sales/{bundleSaleId}`
|
||||
Returns `BundleSaleDto`.
|
||||
|
||||
### `GET /api/v1/bundle-sales/{bundleSaleId}/posting-check`
|
||||
Validates component stock before posting.
|
||||
|
||||
### `POST /api/v1/bundle-sales`
|
||||
Creates a draft bundle sale from a fixed template.
|
||||
|
||||
Request:
|
||||
```json
|
||||
{
|
||||
"customerId": 2,
|
||||
"warehouseId": 1,
|
||||
"cashierUserId": 1,
|
||||
"bundleSaleTemplateId": 1,
|
||||
"bundleName": "Summer Promo Pack",
|
||||
"bundleCode": "BND-001",
|
||||
"bundlePrice": 2500,
|
||||
"allowPriceOverride": true
|
||||
}
|
||||
```
|
||||
|
||||
### `PUT /api/v1/bundle-sales/{bundleSaleId}`
|
||||
Updates a draft bundle sale. Requires `If-Match`.
|
||||
|
||||
### `POST /api/v1/bundle-sales/{bundleSaleId}/post`
|
||||
Posts the bundle and consumes stock from the included component lines.
|
||||
|
||||
### `POST /api/v1/bundle-sales/{bundleSaleId}/cancel`
|
||||
Cancels a draft bundle sale.
|
||||
|
||||
Business rule:
|
||||
- bundle composition is fixed by template lines
|
||||
- posting consumes component stock, not a synthetic bundle stock item
|
||||
- print pages should show both the bundle summary and the component breakdown
|
||||
|
||||
---
|
||||
|
||||
## 4. Free Issues
|
||||
## 5. Free Issues
|
||||
|
||||
Free issue is a business alias over sales slips.
|
||||
There is no separate free-issue table in the current schema.
|
||||
@@ -165,7 +218,7 @@ Business rule:
|
||||
|
||||
---
|
||||
|
||||
## 5. Sales Reports
|
||||
## 6. Sales Reports
|
||||
|
||||
### `GET /api/v1/reports/sales`
|
||||
Returns the report catalog.
|
||||
@@ -217,8 +270,9 @@ Validation rule:
|
||||
|
||||
---
|
||||
|
||||
## 6. Notes
|
||||
## 7. Notes
|
||||
|
||||
- The sales report service reads both invoices and slips where relevant.
|
||||
- Free issue reporting is derived from the same sales document lines.
|
||||
- Bundle sales are treated as a separate fixed-composition document family.
|
||||
- There is no separate free-issue table in the current schema.
|
||||
|
||||
Reference in New Issue
Block a user