feat(history): add energy price history feature
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Features\History\Services;
|
||||
|
||||
use App\Contracts\PriceRepository;
|
||||
use App\Data\ElectricityData;
|
||||
use App\Data\GasData;
|
||||
use App\Features\History\Data\HistoryData;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class HistoryService
|
||||
{
|
||||
public function __construct(
|
||||
public PriceRepository $repository
|
||||
) {}
|
||||
|
||||
public function getHistoryData(Carbon $date): HistoryData
|
||||
{
|
||||
$electricity = ElectricityData::collect($this->repository->retrieveElectricityForDate($date));
|
||||
$gas = GasData::collect($this->repository->retrieveGasForDate($date));
|
||||
|
||||
return new HistoryData($electricity, $gas);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user