src/Controller/Task/Delete.php 1 location
|
@@ 10-21 (lines=12) @@
|
| 7 |
|
use Slim\Http\Request; |
| 8 |
|
use Slim\Http\Response; |
| 9 |
|
|
| 10 |
|
class Delete extends Base |
| 11 |
|
{ |
| 12 |
|
public function __invoke(Request $request, Response $response, array $args): Response |
| 13 |
|
{ |
| 14 |
|
$input = $request->getParsedBody(); |
| 15 |
|
$taskId = (int) $args['id']; |
| 16 |
|
$userId = (int) $input['decoded']->sub; |
| 17 |
|
$task = $this->getTaskService()->delete($taskId, $userId); |
| 18 |
|
|
| 19 |
|
return $this->jsonResponse($response, 'success', $task, 204); |
| 20 |
|
} |
| 21 |
|
} |
| 22 |
|
|
src/Controller/Task/GetOne.php 1 location
|
@@ 10-21 (lines=12) @@
|
| 7 |
|
use Slim\Http\Request; |
| 8 |
|
use Slim\Http\Response; |
| 9 |
|
|
| 10 |
|
class GetOne extends Base |
| 11 |
|
{ |
| 12 |
|
public function __invoke(Request $request, Response $response, array $args): Response |
| 13 |
|
{ |
| 14 |
|
$input = $request->getParsedBody(); |
| 15 |
|
$taskId = (int) $args['id']; |
| 16 |
|
$userId = (int) $input['decoded']->sub; |
| 17 |
|
$task = $this->getTaskService()->getOne($taskId, $userId); |
| 18 |
|
|
| 19 |
|
return $this->jsonResponse($response, 'success', $task, 200); |
| 20 |
|
} |
| 21 |
|
} |
| 22 |
|
|
src/Controller/User/Delete.php 1 location
|
@@ 10-21 (lines=12) @@
|
| 7 |
|
use Slim\Http\Request; |
| 8 |
|
use Slim\Http\Response; |
| 9 |
|
|
| 10 |
|
class Delete extends Base |
| 11 |
|
{ |
| 12 |
|
public function __invoke(Request $request, Response $response, array $args): Response |
| 13 |
|
{ |
| 14 |
|
$input = $request->getParsedBody(); |
| 15 |
|
$userIdLogged = $input['decoded']->sub; |
| 16 |
|
$this->checkUserPermissions($args['id'], $userIdLogged); |
| 17 |
|
$user = $this->getUserService()->delete((int) $args['id']); |
| 18 |
|
|
| 19 |
|
return $this->jsonResponse($response, 'success', $user, 204); |
| 20 |
|
} |
| 21 |
|
} |
| 22 |
|
|
src/Controller/User/Update.php 1 location
|
@@ 10-21 (lines=12) @@
|
| 7 |
|
use Slim\Http\Request; |
| 8 |
|
use Slim\Http\Response; |
| 9 |
|
|
| 10 |
|
class Update extends Base |
| 11 |
|
{ |
| 12 |
|
public function __invoke(Request $request, Response $response, array $args): Response |
| 13 |
|
{ |
| 14 |
|
$input = $request->getParsedBody(); |
| 15 |
|
$userIdLogged = $input['decoded']->sub; |
| 16 |
|
$this->checkUserPermissions($args['id'], $userIdLogged); |
| 17 |
|
$user = $this->getUserService()->update($input, (int) $args['id']); |
| 18 |
|
|
| 19 |
|
return $this->jsonResponse($response, 'success', $user, 200); |
| 20 |
|
} |
| 21 |
|
} |
| 22 |
|
|