Expand action and clean up code.

This commit is contained in:
James Cole
2023-11-04 14:09:51 +01:00
parent 6eabe5fa8c
commit 5a35960434
23 changed files with 119 additions and 93 deletions

View File

@@ -38,19 +38,19 @@ use Illuminate\Pagination\LengthAwarePaginator;
*/
class ListController extends Controller
{
// private BudgetLimitRepositoryInterface $repository;
//
// public function __construct()
// {
// parent::__construct();
// $this->middleware(
// function ($request, $next) {
// $this->repository = app(BudgetLimitRepositoryInterface::class);
//
// return $next($request);
// }
// );
// }
// private BudgetLimitRepositoryInterface $repository;
//
// public function __construct()
// {
// parent::__construct();
// $this->middleware(
// function ($request, $next) {
// $this->repository = app(BudgetLimitRepositoryInterface::class);
//
// return $next($request);
// }
// );
// }
/**
* This endpoint is documented at:
@@ -59,18 +59,18 @@ class ListController extends Controller
public function index(DateRequest $request, Budget $budget): JsonResponse
{
return response()->json([]);
// throw new FireflyException('Needs refactoring, move to IndexController.');
// $pageSize = $this->parameters->get('limit');
// $dates = $request->getAll();
// $collection = $this->repository->getBudgetLimits($budget, $dates['start'], $dates['end']);
// $total = $collection->count();
// $collection->slice($pageSize * $this->parameters->get('page'), $pageSize);
//
// $paginator = new LengthAwarePaginator($collection, $total, $pageSize, $this->parameters->get('page'));
// $transformer = new BudgetLimitTransformer();
//
// return response()
// ->api($this->jsonApiList('budget-limits', $paginator, $transformer))
// ->header('Content-Type', self::CONTENT_TYPE);
// throw new FireflyException('Needs refactoring, move to IndexController.');
// $pageSize = $this->parameters->get('limit');
// $dates = $request->getAll();
// $collection = $this->repository->getBudgetLimits($budget, $dates['start'], $dates['end']);
// $total = $collection->count();
// $collection->slice($pageSize * $this->parameters->get('page'), $pageSize);
//
// $paginator = new LengthAwarePaginator($collection, $total, $pageSize, $this->parameters->get('page'));
// $transformer = new BudgetLimitTransformer();
//
// return response()
// ->api($this->jsonApiList('budget-limits', $paginator, $transformer))
// ->header('Content-Type', self::CONTENT_TYPE);
}
}