ver. 0.320: API słowniki — ensure_producer; ProductRepository — producer_name w odpowiedzi
- DictionariesApiController: nowy endpoint POST ensure_producer (znajdź lub utwórz producenta) - ProducerRepository: metoda ensureProducerForApi() - ProductRepository: pole producer_name w odpowiedzi GET product - ApiRouter: wstrzyknięto ProducerRepository do DictionariesApiController - Zaktualizowano docs/API.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
28
docs/API.md
28
docs/API.md
@@ -219,6 +219,7 @@ Odpowiedz:
|
||||
"set_id": null,
|
||||
"product_unit_id": 1,
|
||||
"producer_id": 3,
|
||||
"producer_name": "Nike",
|
||||
"date_add": "2026-01-15 10:00:00",
|
||||
"date_modify": "2026-02-19 12:00:00",
|
||||
"languages": {
|
||||
@@ -472,6 +473,31 @@ GET api.php?endpoint=dictionaries&action=attributes
|
||||
|
||||
Zwraca aktywne atrybuty z wartosciami i wielojezycznymi nazwami.
|
||||
|
||||
#### Znajdz lub utworz producenta
|
||||
```
|
||||
POST api.php?endpoint=dictionaries&action=ensure_producer
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "Nike"
|
||||
}
|
||||
```
|
||||
|
||||
Zwraca istniejacego producenta po nazwie lub tworzy nowego. Uzyc przed tworzeniem produktu, jesli producent moze nie istniec.
|
||||
|
||||
Odpowiedz:
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"data": {
|
||||
"id": 5,
|
||||
"created": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`created: true` gdy producent zostal nowo dodany, `false` gdy juz istnial.
|
||||
|
||||
Odpowiedz:
|
||||
```json
|
||||
{
|
||||
@@ -518,4 +544,4 @@ UPDATE pp_settings SET value = 'twoj-klucz-api' WHERE param = 'api_key';
|
||||
- Kontrolery: `autoload/api/Controllers/`
|
||||
- `OrdersApiController` — zamowienia (5 akcji)
|
||||
- `ProductsApiController` — produkty (8 akcji: list, get, create, update, variants, create_variant, update_variant, delete_variant)
|
||||
- `DictionariesApiController` — slowniki (4 akcje: statuses, transports, payment_methods, attributes)
|
||||
- `DictionariesApiController` — slowniki (5 akcji: statuses, transports, payment_methods, attributes, ensure_producer)
|
||||
|
||||
Reference in New Issue
Block a user