change stock_row_id to id

This commit is contained in:
Kurt Riddlesperger 2020-01-15 17:52:28 -06:00
parent 94e35ef9fd
commit 3cc5e31794
3 changed files with 6 additions and 6 deletions

View File

@ -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)'); 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'); throw new \Exception('A stock row id is required');
} }
@ -152,7 +152,7 @@ class StockApiController extends BaseApiController
$locationId = $requestBody['location_id']; $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)); return $this->ApiResponse($this->Database->stock_log($bookingId));
} }
catch (\Exception $ex) catch (\Exception $ex)

View File

@ -1063,10 +1063,10 @@
"schema": { "schema": {
"type": "object", "type": "object",
"properties": { "properties": {
"stock_row_id": { "id": {
"type": "number", "type": "number",
"format": "number", "format": "number",
"description": "The Stock Row Id" "description": "The stock table id"
}, },
"amount": { "amount": {
"type": "number", "type": "number",
@ -1090,7 +1090,7 @@
} }
}, },
"example": { "example": {
"stock_row_id": 2, "id": 2,
"amount": 1, "amount": 1,
"best_before_date": "2019-01-19", "best_before_date": "2019-01-19",
"location_id": 2, "location_id": 2,

View File

@ -79,7 +79,7 @@ $('#save-stockedit-button').on('click', function(e)
var bookingResponse = null; var bookingResponse = null;
var stockRowId = GetUriParam('stockRowId'); var stockRowId = GetUriParam('stockRowId');
jsonData.stock_row_id = stockRowId; jsonData.id = stockRowId;
Grocy.Api.Put("stock", jsonData, Grocy.Api.Put("stock", jsonData,
function(result) function(result)