mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Clean up v2 api points.
This commit is contained in:
@@ -45,23 +45,6 @@ class BalanceController extends Controller
|
||||
{
|
||||
use CleansChartData;
|
||||
|
||||
private AccountRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The code is practically a duplicate of ReportController::operations.
|
||||
*
|
||||
|
@@ -33,9 +33,9 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
|
||||
/**
|
||||
* Class ListController
|
||||
* Class IndexController
|
||||
*/
|
||||
class ListController extends Controller
|
||||
class IndexController extends Controller
|
||||
{
|
||||
private BudgetRepositoryInterface $repository;
|
||||
|
||||
@@ -61,13 +61,12 @@ class ListController extends Controller
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
echo 'this needs move to Administration';
|
||||
throw new FireflyException('Needs migration to IndexController');
|
||||
$pageSize = $this->parameters->get('limit');
|
||||
$collection = $this->repository->getActiveBudgets();
|
||||
$total = $collection->count();
|
||||
$collection->slice($this->pageXSize * $this->parameters->get('page'), $this->pXageSize);
|
||||
$collection->slice($pageSize * $this->parameters->get('page'), $pageSize);
|
||||
|
||||
$paginator = new LengthAwarePaginator($collection, $total, $this->pagXeSize, $this->parameters->get('page'));
|
||||
$paginator = new LengthAwarePaginator($collection, $total, $pageSize, $this->parameters->get('page'));
|
||||
$transformer = new BudgetTransformer();
|
||||
|
||||
return response()
|
@@ -59,18 +59,20 @@ class ShowController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* 2023-10-29 removed the cerSum reference, not sure where this is used atm
|
||||
* so removed from api.php. Also applies to "spent" method.
|
||||
*
|
||||
* This endpoint is documented at:
|
||||
* TODO add URL
|
||||
*
|
||||
*/
|
||||
public function budgeted(DateRequest $request, Budget $budget): JsonResponse
|
||||
{
|
||||
throw new FireflyException('Needs refactoring, uses deprecated method.');
|
||||
$data = $request->getAll();
|
||||
$result = $this->repository->budgetedInPeriodForBudget($budget, $data['start'], $data['end']);
|
||||
$converted = $this->cerSum(array_values($result));
|
||||
//$converted = $this->cerSum(array_values($result));
|
||||
|
||||
return response()->json($converted);
|
||||
return response()->json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,11 +82,10 @@ class ShowController extends Controller
|
||||
*/
|
||||
public function spent(DateRequest $request, Budget $budget): JsonResponse
|
||||
{
|
||||
throw new FireflyException('Needs refactoring, uses deprecated method.');
|
||||
$data = $request->getAll();
|
||||
$result = $this->repository->spentInPeriodForBudget($budget, $data['start'], $data['end']);
|
||||
$converted = $this->cerSum(array_values($result));
|
||||
// $converted = $this->cerSum(array_values($result));
|
||||
|
||||
return response()->json($converted);
|
||||
return response()->json($result);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user