diff --git a/openapi.yaml b/openapi.yaml index bb23b252..763abc5f 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -6552,6 +6552,20 @@ paths: responses: '200': {description: Success} + /bird/config: + get: + tags: [Config] + summary: Get Bird config + operationId: getBirdConfig + responses: + '200': {description: Success} + post: + tags: [Config] + summary: Update Bird config + operationId: updateBirdConfig + responses: + '200': {description: Success} + /motorapi/config: get: tags: [Config] diff --git a/services/nginx/app/routes/moduleConfigRoute.php b/services/nginx/app/routes/moduleConfigRoute.php index 94936561..20b94322 100644 --- a/services/nginx/app/routes/moduleConfigRoute.php +++ b/services/nginx/app/routes/moduleConfigRoute.php @@ -215,6 +215,46 @@ class moduleConfigRoute ] ); + /** Bird config > GET */ + $this->get('/bird/config', function () { + global $response; + $this->requirePermission('modules_bird_config'); + $user = (new authentication())->get_user(); + if ($user) { + (new logs_o())->add('bird_config', 'global', 1, $user->id, 'BIRD_CONFIG', 'Successfully fetched bird config'); + $response->success( + (new \classes\bird())->config->getConfigRequest() + ); + } else { + (new logs_o())->add('bird_config', 'global', 1, 0, 'BIRD_CONFIG', 'No user found, or invalid session'); + $response->error('Invalid session', 400); + } + }, + [ + 'modules_bird_config' => 'Get bird config' + ] + ); + + /** Bird config > POST */ + $this->post('/bird/config', function () { + global $response; + $this->requirePermission('modules_bird_config'); + $user = (new authentication())->get_user(); + if ($user) { + (new logs_o())->add('bird_config', 'global', 1, $user->id, 'BIRD_CONFIG', 'Successfully updated bird config'); + $response->success( + (new \classes\bird())->config->postConfigRequest() + ); + } else { + (new logs_o())->add('bird_config', 'global', 1, 0, 'BIRD_CONFIG', 'No user found, or invalid session'); + $response->error('Invalid session', 400); + } + }, + [ + 'modules_bird_config' => 'Update bird config' + ] + ); + /** MotorAPI config > GET */ $this->get('/motorapi/config', function () { global $response; @@ -701,4 +741,4 @@ class moduleConfigRoute } }); } -} \ No newline at end of file +}