Use FilteredApiResponse for current chores

This commit is contained in:
fipwmaqzufheoxq92ebc 2020-09-01 15:49:50 +02:00
parent 076e8df7d3
commit 30516e472b
No known key found for this signature in database
GPG Key ID: F4DF989490C2ADB7
3 changed files with 6 additions and 3 deletions

View File

@ -58,7 +58,7 @@ class ChoresApiController extends BaseApiController
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
{
return $this->ApiResponse($response, $this->getChoresService()->GetCurrent());
return $this->FilteredApiResponse($response, $this->getChoresService()->GetCurrent(), $request->getQueryParams());
}
public function TrackChoreExecution(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)

View File

@ -13,3 +13,7 @@ SELECT id,
END
) AS display_name
FROM users;
CREATE VIEW uihelper_chores_current AS
SELECT chores_current.*, chores.name AS chore_name
from chores_current
join chores on chores_current.chore_id = chores.id;

View File

@ -152,8 +152,7 @@ class ChoresService extends BaseService
public function GetCurrent()
{
$sql = 'SELECT chores_current.*, chores.name AS chore_name from chores_current join chores on chores_current.chore_id = chores.id';
return $this->getDatabaseService()->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ);
return $this->getDatabase()->uihelper_chores_current();
}
public function TrackChore(int $choreId, string $trackedTime, $doneBy = GROCY_USER_ID)