Пример #1
0
        $rows["message"] = "User information updated successfully.";
    }
    echoResponse(200, $rows);
});
$app->delete('/users/:role/:id', 'authenticateToken', function ($role, $id) use($app) {
    global $db;
    $rows = Users_model::delete_user($db, $id, $role);
    if ($rows["status"] == "success") {
        $rows["message"] = "User information updated successfully.";
    }
    echoResponse(200, $rows);
});
$app->post('/host', 'authenticateToken', function () use($app) {
    global $db;
    $data = json_decode($app->request->getBody());
    $rows = Users_model::create_hostQualifier($db, $data);
    echoResponse(200, $rows);
});
$app->get('/host/qualifiers/:user_id', 'authenticateToken', function ($user_id) use($app) {
    global $db;
    $data = json_decode($app->request->getBody());
    $rows = Users_model::get_hostedQualifiers($db, $user_id);
    echoResponse(200, $rows);
});
$app->get('/host/admins/:qual_id', 'authenticateToken', function ($qual_id) use($app) {
    global $db;
    $data = json_decode($app->request->getBody());
    $rows = Users_model::get_hostsForQualifier($db, $qual_id);
    echoResponse(200, $rows);
});
$app->delete('/host/:qual_id/:user_id', 'authenticateToken', function ($qual_id, $user_id) use($app) {