diff --git a/doc/rest-api.md b/doc/rest-api.md index 07824832..0996643c 100644 --- a/doc/rest-api.md +++ b/doc/rest-api.md @@ -186,6 +186,7 @@ You can also try the GET requests with your browser by navigating to the respeci "price": 10.00, "currency": "Euro", "description": "Male haircut trends.", + "availabilitiesType": "flexible", "categoryId": null } ``` @@ -195,6 +196,8 @@ You can also try the GET requests with your browser by navigating to the respeci - `PUT /api/v1/services/:id` Provide the updated service JSON in the request body to update an existing record. The ID in the URI is required. - `DELETLE /api/v1/services/:id` Remove an existing service record. +* The `availabilitiesType` must be either `flexible` or `fixed`. + ### Categories **Resource JSON** diff --git a/src/engine/Api/V1/Parsers/Services.php b/src/engine/Api/V1/Parsers/Services.php index af27cb67..25ab4b60 100644 --- a/src/engine/Api/V1/Parsers/Services.php +++ b/src/engine/Api/V1/Parsers/Services.php @@ -32,6 +32,7 @@ class Services implements ParsersInterface { 'price' => $response['price'], 'currency' => $response['currency'], 'description' => $response['description'], + 'availabilitiesType' => $response['availabilities_type'], 'categoryId' => $response['id_service_categories'] !== null ? (int)$response['id_service_categories'] : null ]; @@ -71,6 +72,10 @@ class Services implements ParsersInterface { $decodedRequest['description'] = $request['description']; } + if (!empty($request['availabilitiesType'])) { + $decodedRequest['availabilities_type'] = $request['availabilitiesType']; + } + if (!empty($request['categoryId'])) { $decodedRequest['id_service_categories'] = $request['categoryId']; }