Browse Source

Automation Endpoints Create

remastering
GamerClassN7 1 year ago
parent
commit
a3eaf16fd6
3 changed files with 23 additions and 1 deletions
  1. +11
    -1
      app/Routes.php
  2. +11
    -0
      app/api/AutomationsApi.php
  3. +1
    -0
      app/models/managers/AutomationManager.php

+ 11
- 1
app/Routes.php View File

@ -24,24 +24,34 @@ $router->any('/plugins', 'Plugins');
$router->any('/ajax', 'Ajax');
$router->any('/oauth', 'Oauth');
//Vue APP
//Vue APP - Authentication
$router->post('/api/login', 'AuthApi@login');
$router->post('/api/logout', 'AuthApi@logout');
//Vue APP - Rooms
$router->get('/api/rooms', 'RoomsApi@default');
$router->get('/api/rooms/{roomId}/update', 'RoomsApi@update');
$router->get('/api/devices', 'DevicesApi@default');
$router->get('/api/plugins', 'PluginsApi@default');
$router->get('/api/users', 'UsersApi@default');
//Vue APP - Server Info
$router->get('/api/server', 'ServerApi@default');
$router->get('/api/server/log', 'ServerApi@logStatus');
//Vue APP - Widgets
$router->post('/api/widgets/{widgetId}/run', 'WidgetApi@run');
$router->get('/api/widgets/{widgetId}/detail', 'WidgetApi@detail');
$router->get('/api/widgets/{widgetId}/detail/{period}', 'WidgetApi@detail');
//Vue APP - Automations Endpoints
$router->get('/api/automations', 'AutomationsApi@default');
$router->get('/api/automations/{automationId}/detail', 'AutomationsApi@detail');
$router->post('/api/automations/create', 'AutomationsApi@create');
//cron

+ 11
- 0
app/api/AutomationsApi.php View File

@ -20,4 +20,15 @@ class AutomationsApi extends ApiController
$this->response($response);
}
public function create()
{
//$this->requireAuth();
$obj = $this->input;
$response = [];
$response = AutomationManager::create($obj['name'],$obj['days'], $obj['tasks'], $obj['conditions']);
$this->response(['value'=>'OK']);
}
}

+ 1
- 0
app/models/managers/AutomationManager.php View File

@ -34,6 +34,7 @@ class AutomationManager{
}
} catch(PDOException $error) {
echo $error->getMessage();
return false;
die();
}
}

Loading…
Cancel
Save