mirror of
https://github.com/grocy/grocy.git
synced 2026-04-07 05:16:15 +02:00
Fixes #956. Return 404 for missing objects in GenericEntityApiController.php
This commit is contained in:
parent
cf9bb87f6e
commit
68f214ff29
|
|
@ -50,6 +50,10 @@ class GenericEntityApiController extends BaseApiController
|
||||||
}
|
}
|
||||||
|
|
||||||
$object = $this->getDatabase()->{$args['entity']}($args['objectId']);
|
$object = $this->getDatabase()->{$args['entity']}($args['objectId']);
|
||||||
|
if ($object == null) {
|
||||||
|
return $this->GenericErrorResponse($response, 'Object not found', 404);
|
||||||
|
}
|
||||||
|
|
||||||
$object['userfields'] = $userfields;
|
$object['userfields'] = $userfields;
|
||||||
|
|
||||||
return $this->ApiResponse($response, $object);
|
return $this->ApiResponse($response, $object);
|
||||||
|
|
|
||||||
|
|
@ -395,6 +395,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Object not found",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/GenericErrorResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user