diff --git a/API.md b/API.md index 0feef0f..a4744f7 100644 --- a/API.md +++ b/API.md @@ -229,6 +229,7 @@ Response 200: "priority": 1, "quantity": 50, "price": 1299, + "discount": 10, "currency": "USD", "imgs": ["https://...", "https://..."], "tags": ["new", "featured"], @@ -285,6 +286,7 @@ Body: "priority": 10, "quantity": 100, "price": 999, + "discount": 0, // 0–100 (percentage off price) "currency": "USD", // USD | EUR | RUB | GBP | UAH "imgs": ["https://..."], "tags": ["new"], @@ -318,6 +320,7 @@ Body: (any subset of fields) { "name": "Updated Name", "price": 899, + "discount": 15, "quantity": 80, "visible": false } @@ -389,6 +392,7 @@ Response 201: - `currency` supported values: `USD`, `EUR`, `RUB`, `GBP`, `UAH`. - `badges`: optional string array. Predefined values with UI colors: `new`, `sale`, `exclusive`, `hot`, `limited`, `bestseller`, `featured`. Custom strings are also allowed. - `imgs`: always send the **complete** array on update, not individual images. +- `discount`: integer `0`–`100` representing a percentage discount. `0` means no discount. The discounted price is calculated as `price * (1 - discount / 100)`. - `description`: array of `{ key, value }` pairs - free-form attributes per item. - `translations`: optional object keyed by language code (`"ru"`, `"en"`, etc.) — each value may contain `name`, `simpleDescription`, `description[]`. The marketplace frontend should use these when rendering in the corresponding language, falling back to the default fields if a translation is absent. - Auto-save from the backoffice fires `PATCH` with a single field every ~500 ms. diff --git a/API.ru.md b/API.ru.md index 35b8c07..0467dd3 100644 --- a/API.ru.md +++ b/API.ru.md @@ -238,6 +238,7 @@ Query-параметры: "priority": 1, "quantity": 50, "price": 1299, + "discount": 10, "currency": "USD", "imgs": ["https://...", "https://..."], "tags": ["new", "featured"], @@ -297,6 +298,7 @@ POST /api/subcategories/:subcategoryId/items "priority": 10, "quantity": 100, "price": 999, + "discount": 0, // 0–100 (процент скидки) "currency": "USD", // USD | EUR | RUB | GBP | UAH "imgs": ["https://..."], "tags": ["new"], @@ -330,6 +332,7 @@ PATCH /api/items/:itemId { "name": "Новое название", "price": 899, + "discount": 15, "quantity": 80, "visible": false, "translations": { @@ -446,6 +449,7 @@ GET /api/subcategories/:subcategoryId/items?lang=ru&page=1 - Поддерживаемые значения `currency`: `USD`, `EUR`, `RUB`, `GBP`, `UAH`. - `badges`: необязательный массив строк. Стандартные значения с цветами в интерфейсе: `new`, `sale`, `exclusive`, `hot`, `limited`, `bestseller`, `featured`. Свои строки тоже допустимы. - `imgs`: при обновлении всегда передавай **полный** массив, не отдельные изображения. +- `discount`: целое число `0`–`100` — процент скидки. `0` означает отсутствие скидки. Цена со скидкой вычисляется как `price * (1 - discount / 100)`. - `description`: массив пар `{ key, value }` — свободные атрибуты товара. - Автосохранение из бэкофиса отправляет `PATCH` с одним полем каждые ~500 мс.