dosc changed

This commit is contained in:
sdarbinyan
2026-02-20 11:01:15 +04:00
parent f7919f6ca7
commit ffde301181
2 changed files with 8 additions and 0 deletions

4
API.md
View File

@@ -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, // 0100 (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.

View File

@@ -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, // 0100 (процент скидки)
"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 мс.