mirror of
https://github.com/grocy/grocy.git
synced 2026-04-07 05:16:15 +02:00
Use FilteredApiResponse for batteries-current
This commit is contained in:
parent
30516e472b
commit
6505470ecc
|
|
@ -21,7 +21,7 @@ class BatteriesApiController extends BaseApiController
|
||||||
|
|
||||||
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function Current(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||||
{
|
{
|
||||||
return $this->ApiResponse($response, $this->getBatteriesService()->GetCurrent());
|
return $this->FilteredApiResponse($response, $this->getBatteriesService()->GetCurrent(), $request->getQueryParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TrackChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
public function TrackChargeCycle(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,6 @@ CREATE VIEW uihelper_chores_current AS
|
||||||
SELECT chores_current.*, chores.name AS chore_name
|
SELECT chores_current.*, chores.name AS chore_name
|
||||||
from chores_current
|
from chores_current
|
||||||
join chores on chores_current.chore_id = chores.id;
|
join chores on chores_current.chore_id = chores.id;
|
||||||
|
|
||||||
|
CREATE VIEW uihelper_batteries_current AS
|
||||||
|
SELECT battery_id AS id, * FROM batteries_current;
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,7 @@ class BatteriesService extends BaseService
|
||||||
|
|
||||||
public function GetCurrent()
|
public function GetCurrent()
|
||||||
{
|
{
|
||||||
$sql = 'SELECT * from batteries_current';
|
return $this->getDatabase()->uihelper_batteries_current();
|
||||||
return $this->getDatabaseService()->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function TrackChargeCycle(int $batteryId, string $trackedTime)
|
public function TrackChargeCycle(int $batteryId, string $trackedTime)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user