diff --git a/app/Api/V2/Controllers/Model/Budget/ShowController.php b/app/Api/V2/Controllers/Model/Budget/ShowController.php index a451b07662..70a0490b45 100644 --- a/app/Api/V2/Controllers/Model/Budget/ShowController.php +++ b/app/Api/V2/Controllers/Model/Budget/ShowController.php @@ -30,13 +30,17 @@ use FireflyIII\Api\V2\Request\Generic\DateRequest; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Budget; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; +use FireflyIII\Support\Http\Api\ConvertsExchangeRates; use Illuminate\Http\JsonResponse; /** * Class ShowController + * TODO lots of deprecated code here. */ class ShowController extends Controller { + use ConvertsExchangeRates; + private BudgetRepositoryInterface $repository; /** @@ -61,7 +65,6 @@ class ShowController extends Controller */ public function budgeted(DateRequest $request, Budget $budget): JsonResponse { - throw new FireflyException('deprecated use of thing.'); $data = $request->getAll(); $result = $this->repository->budgetedInPeriodForBudget($budget, $data['start'], $data['end']); $converted = $this->cerSum(array_values($result)); @@ -76,7 +79,6 @@ class ShowController extends Controller */ public function spent(DateRequest $request, Budget $budget): JsonResponse { - throw new FireflyException('deprecated use of thing.'); $data = $request->getAll(); $result = $this->repository->spentInPeriodForBudget($budget, $data['start'], $data['end']); $converted = $this->cerSum(array_values($result)); diff --git a/app/Api/V2/Controllers/Model/Budget/SumController.php b/app/Api/V2/Controllers/Model/Budget/SumController.php index e9e178dd7c..394ee1bc00 100644 --- a/app/Api/V2/Controllers/Model/Budget/SumController.php +++ b/app/Api/V2/Controllers/Model/Budget/SumController.php @@ -28,6 +28,7 @@ use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Generic\DateRequest; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; +use FireflyIII\Support\Http\Api\ConvertsExchangeRates; use Illuminate\Http\JsonResponse; /** @@ -35,6 +36,8 @@ use Illuminate\Http\JsonResponse; */ class SumController extends Controller { + use ConvertsExchangeRates; + private BudgetRepositoryInterface $repository; /** @@ -62,7 +65,6 @@ class SumController extends Controller */ public function budgeted(DateRequest $request): JsonResponse { - throw new FireflyException('deprecated use of thing.'); $data = $request->getAll(); $result = $this->repository->budgetedInPeriod($data['start'], $data['end']); $converted = $this->cerSum(array_values($result)); @@ -80,7 +82,6 @@ class SumController extends Controller */ public function spent(DateRequest $request): JsonResponse { - throw new FireflyException('deprecated use of thing.'); $data = $request->getAll(); $result = $this->repository->spentInPeriod($data['start'], $data['end']); $converted = $this->cerSum(array_values($result)); diff --git a/app/Support/Http/Api/ConvertsExchangeRates.php b/app/Support/Http/Api/ConvertsExchangeRates.php index b8372bc44a..6e0f2bfd77 100644 --- a/app/Support/Http/Api/ConvertsExchangeRates.php +++ b/app/Support/Http/Api/ConvertsExchangeRates.php @@ -115,7 +115,6 @@ trait ConvertsExchangeRates */ public function cerSum(array $entries): array { - throw new FireflyException('do not use me, needs refactor'); if (null === $this->enabled) { $this->getPreference(); }