45 public function getUsers($request, $response, $args)
48 if (isset($args[
'id'])) {
49 $id = intval($args[
'id']);
50 if (! $this->dbHelper->doesIdExist(
"users",
"user_pk", $id)) {
51 $returnVal =
new Info(404,
"UserId doesn't exist", InfoType::ERROR);
52 return $response->withJson($returnVal->getArray(), $returnVal->getCode());
55 $users = $this->dbHelper->getUsers($id);
59 return $response->withJson($users, 200);
72 $id = intval($args[
'id']);
74 if ($this->dbHelper->doesIdExist(
"users",
"user_pk", $id)) {
75 $this->dbHelper->deleteUser($id);
76 $returnVal =
new Info(202,
"User will be deleted", InfoType::INFO);
78 $returnVal =
new Info(404,
"UserId doesn't exist", InfoType::ERROR);
80 return $response->withJson($returnVal->getArray(), $returnVal->getCode());
Base controller for REST calls.
deleteUser($request, $response, $args)
getUsers($request, $response, $args)
Info model to contain general error and return values.
Controller for User model.