Compare commits

...

2 Commits

Author SHA1 Message Date
44ac25b063 ver. 0.321: API produkty — obsługa custom_fields w create/update
- ProductsApiController: parsowanie custom_fields z body (name, type, is_required)
- Zaktualizowano docs/API.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 13:54:33 +01:00
ee8459ca2a build: update package v0.320
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 13:35:13 +01:00
6 changed files with 57 additions and 9 deletions

View File

@@ -497,6 +497,21 @@ class ProductsApiController
$d['products_related'] = $body['products_related'];
}
// Custom fields (Dodatkowe pola)
if (isset($body['custom_fields']) && is_array($body['custom_fields'])) {
$d['custom_field_name'] = [];
$d['custom_field_type'] = [];
$d['custom_field_required'] = [];
foreach ($body['custom_fields'] as $cf) {
if (!is_array($cf) || empty($cf['name'])) {
continue;
}
$d['custom_field_name'][] = (string)$cf['name'];
$d['custom_field_type'][] = isset($cf['type']) ? (string)$cf['type'] : 'text';
$d['custom_field_required'][] = !empty($cf['is_required']) ? 1 : 0;
}
}
return $d;
}
}

View File

@@ -302,11 +302,15 @@ Content-Type: application/json
}
},
"categories": [1, 5],
"products_related": [10, 20]
"products_related": [10, 20],
"custom_fields": [
{"name": "Napis na koszulce", "type": "text", "is_required": 1}
]
}
```
Wymagane: `languages` (min. 1 jezyk z `name`) oraz `price_brutto`.
`custom_fields` — opcjonalne; kazdy element wymaga `name`, `type` (domyslnie `text`), `is_required` (0/1).
Odpowiedz (HTTP 201):
```json

BIN
updates/0.30/ver_0.320.zip Normal file

Binary file not shown.

View File

@@ -0,0 +1,26 @@
{
"changelog": "NEW - API: endpoint ensure_producer (znajdź lub utwórz producenta); GET product zwraca producer_name",
"version": "0.320",
"files": {
"added": [
],
"deleted": [
],
"modified": [
"autoload/Domain/Producer/ProducerRepository.php",
"autoload/Domain/Product/ProductRepository.php",
"autoload/api/ApiRouter.php",
"autoload/api/Controllers/DictionariesApiController.php"
]
},
"checksum_zip": "sha256:eb38b6f260768c25d331de60098eba647a897972c211b37b39314c8a3f954bf3",
"sql": [
],
"date": "2026-02-24",
"directories_deleted": [
]
}

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
<?
$current_ver = 320;
$current_ver = 321;
for ($i = 1; $i <= $current_ver; $i++)
{