diff --git a/controllers/StockApiController.php b/controllers/StockApiController.php index 0ece5ab2..133e5cd9 100644 --- a/controllers/StockApiController.php +++ b/controllers/StockApiController.php @@ -124,7 +124,7 @@ class StockApiController extends BaseApiController throw new \Exception('Request body could not be parsed (probably invalid JSON format or missing/wrong Content-Type header)'); } - if (!array_key_exists('stock_row_id', $requestBody)) + if (!array_key_exists('id', $requestBody)) { throw new \Exception('A stock row id is required'); } @@ -152,7 +152,7 @@ class StockApiController extends BaseApiController $locationId = $requestBody['location_id']; } - $bookingId = $this->StockService->EditStock($requestBody['stock_row_id'], $requestBody['amount'], $bestBeforeDate, $locationId, $price); + $bookingId = $this->StockService->EditStock($requestBody['id'], $requestBody['amount'], $bestBeforeDate, $locationId, $price); return $this->ApiResponse($this->Database->stock_log($bookingId)); } catch (\Exception $ex) diff --git a/grocy.openapi.json b/grocy.openapi.json index bce3ef34..82480d78 100644 --- a/grocy.openapi.json +++ b/grocy.openapi.json @@ -1063,10 +1063,10 @@ "schema": { "type": "object", "properties": { - "stock_row_id": { + "id": { "type": "number", "format": "number", - "description": "The Stock Row Id" + "description": "The stock table id" }, "amount": { "type": "number", @@ -1090,7 +1090,7 @@ } }, "example": { - "stock_row_id": 2, + "id": 2, "amount": 1, "best_before_date": "2019-01-19", "location_id": 2, diff --git a/public/viewjs/stockedit.js b/public/viewjs/stockedit.js index 8932b687..c320a40c 100644 --- a/public/viewjs/stockedit.js +++ b/public/viewjs/stockedit.js @@ -79,7 +79,7 @@ $('#save-stockedit-button').on('click', function(e) var bookingResponse = null; var stockRowId = GetUriParam('stockRowId'); - jsonData.stock_row_id = stockRowId; + jsonData.id = stockRowId; Grocy.Api.Put("stock", jsonData, function(result)