sku and item fix

This commit is contained in:
2026-08-11 21:55:04 +05:30
parent 15ddac178c
commit a7ba3d3e04
15 changed files with 557 additions and 96 deletions
+18 -5
View File
@@ -359,26 +359,39 @@ Requires `If-Match`. → **200 OK**; `412` on mismatch; `409` on duplicate name.
Query: `q`, `status` (`Active|Inactive`), + paging. Pass `status=Active` for selectable rows.
**200 OK**
```json
{ "items": [ { "itemTypeId": 1, "name": "Color", "status": "Active",
{ "items": [ { "itemTypeId": 1, "name": "Color", "isMeasurable": false, "status": "Active",
"createdAt": "2026-07-16T09:00:00Z", "updatedAt": null },
{ "itemTypeId": 2, "name": "Size", "status": "Active",
{ "itemTypeId": 2, "name": "Size", "isMeasurable": false, "status": "Active",
"createdAt": "2026-07-16T09:00:00Z", "updatedAt": null } ],
"pagination": { "page": 1, "pageSize": 20, "totalItems": 2, "totalPages": 1 } }
```
`Color` and `Size` are seeded on first start; users add their own (e.g. `Material`).
`Color` and `Size` are seeded on first start, both with `isMeasurable: false`; users add their own
(e.g. `Material`, or a `Pack Size` with `isMeasurable: true`).
**`isMeasurable`** (added 2026-08-11) marks a dimension whose values are content *measurements*
(500 ml, 1 L) rather than plain labels. The item builder then captures a number + unit per value
and writes that pair to each generated item's `contentQty`/`contentUnit`, instead of copying one
form-level pair into every variant — which is what makes "Coca-Cola in 500 ml / 1 L / 250 ml"
three correctly sized items. It is why an apparel `Size` (S/M/L) can stay plain text while a
`Volume` dimension carries units. The server never reads it when writing an item: each item's
pair is still validated and normalised on its own.
#### `GET /item-types/{itemTypeId}` → **200 OK** (+ `ETag`); `404` if absent.
#### `POST /item-types`
```json
{ "name": "Material" }
{ "name": "Pack Size", "isMeasurable": true }
```
**201 Created**`Location: /api/v1/item-types/3` → the `ItemTypeDto`. `409` if the name exists.
Callable from the item builder's inline "+" as well as the admin screen.
`isMeasurable` is optional and defaults to `false`. Callable from the item builder's inline "+"
as well as the admin screen.
#### `PUT /item-types/{itemTypeId}`
Requires `If-Match`. → **200 OK**; `412` on mismatch; `409` on duplicate name.
**Renaming does not touch existing items** — nothing joins back to this row.
`isMeasurable` is **nullable in the request body and preserved when omitted**: a plain `bool`
would bind an absent property as `false`, so a name-only PUT — which is what the admin screen
used to send — would clear the flag on every rename.
#### `PATCH /item-types/{itemTypeId}/status` → **204 No Content**. Deactivate, never delete (FR-MD-08).