fix(ApiController): use argument param in updateSettings

This commit is contained in:
2025-05-29 00:17:14 +03:00
parent 5910320b90
commit aba72a13f2
2 changed files with 31 additions and 2 deletions

View File

@@ -104,14 +104,15 @@ class ApiController extends OCSController {
/**
* Update auto currency settings
*
* @param array{interval: int} $data Data to update
* @return DataResponse<Http::STATUS_OK, array{status:non-empty-string}, array{}>
*
* 200: Data returned
*/
// #[NoAdminRequired]
#[ApiRoute(verb: 'PUT', url: '/api/cron')]
public function updateSettings(): DataResponse {
$interval = $this->request->getParam('data')['interval'];
public function updateSettings(mixed $data): DataResponse {
$interval = $data['interval'];
$this->config->setValueInt(AppInfo\Application::APP_ID, 'cron_interval', $interval);
return new DataResponse(
['status' => 'OK']

View File

@@ -158,6 +158,34 @@
"basic_auth": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"data"
],
"properties": {
"data": {
"type": "object",
"description": "Data to update",
"required": [
"interval"
],
"properties": {
"interval": {
"type": "integer",
"format": "int64"
}
}
}
}
}
}
}
},
"parameters": [
{
"name": "OCS-APIRequest",