mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Clean up v2 api points.
This commit is contained in:
parent
4bb171128e
commit
aa1a521cf0
@ -66,5 +66,5 @@ parameters:
|
|||||||
- ../bootstrap/app.php
|
- ../bootstrap/app.php
|
||||||
|
|
||||||
# The level 8 is the highest level. original was 5
|
# The level 8 is the highest level. original was 5
|
||||||
level: 4
|
level: 1
|
||||||
|
|
||||||
|
@ -45,23 +45,6 @@ class BalanceController extends Controller
|
|||||||
{
|
{
|
||||||
use CleansChartData;
|
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.
|
* The code is practically a duplicate of ReportController::operations.
|
||||||
*
|
*
|
||||||
|
@ -33,9 +33,9 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ListController
|
* Class IndexController
|
||||||
*/
|
*/
|
||||||
class ListController extends Controller
|
class IndexController extends Controller
|
||||||
{
|
{
|
||||||
private BudgetRepositoryInterface $repository;
|
private BudgetRepositoryInterface $repository;
|
||||||
|
|
||||||
@ -61,13 +61,12 @@ class ListController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request): JsonResponse
|
public function index(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
echo 'this needs move to Administration';
|
$pageSize = $this->parameters->get('limit');
|
||||||
throw new FireflyException('Needs migration to IndexController');
|
|
||||||
$collection = $this->repository->getActiveBudgets();
|
$collection = $this->repository->getActiveBudgets();
|
||||||
$total = $collection->count();
|
$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();
|
$transformer = new BudgetTransformer();
|
||||||
|
|
||||||
return response()
|
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:
|
* This endpoint is documented at:
|
||||||
* TODO add URL
|
* TODO add URL
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function budgeted(DateRequest $request, Budget $budget): JsonResponse
|
public function budgeted(DateRequest $request, Budget $budget): JsonResponse
|
||||||
{
|
{
|
||||||
throw new FireflyException('Needs refactoring, uses deprecated method.');
|
|
||||||
$data = $request->getAll();
|
$data = $request->getAll();
|
||||||
$result = $this->repository->budgetedInPeriodForBudget($budget, $data['start'], $data['end']);
|
$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
|
public function spent(DateRequest $request, Budget $budget): JsonResponse
|
||||||
{
|
{
|
||||||
throw new FireflyException('Needs refactoring, uses deprecated method.');
|
|
||||||
$data = $request->getAll();
|
$data = $request->getAll();
|
||||||
$result = $this->repository->spentInPeriodForBudget($budget, $data['start'], $data['end']);
|
$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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,6 +186,7 @@ class NetWorth implements NetWorthInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function sumNetWorthByCurrency(Carbon $date): array
|
public function sumNetWorthByCurrency(Carbon $date): array
|
||||||
{
|
{
|
||||||
|
@ -68,6 +68,7 @@ interface NetWorthInterface
|
|||||||
* @param Carbon $date
|
* @param Carbon $date
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function sumNetWorthByCurrency(Carbon $date): array;
|
public function sumNetWorthByCurrency(Carbon $date): array;
|
||||||
}
|
}
|
||||||
|
@ -186,8 +186,8 @@ Route::group(
|
|||||||
Route::get('{budget}/limits', ['uses' => 'BudgetLimit\IndexController@index', 'as' => 'budget-limits.index']);
|
Route::get('{budget}/limits', ['uses' => 'BudgetLimit\IndexController@index', 'as' => 'budget-limits.index']);
|
||||||
Route::get('sum/budgeted', ['uses' => 'Budget\IndexController@budgeted', 'as' => 'sum.budgeted']);
|
Route::get('sum/budgeted', ['uses' => 'Budget\IndexController@budgeted', 'as' => 'sum.budgeted']);
|
||||||
Route::get('sum/spent', ['uses' => 'Budget\IndexController@spent', 'as' => 'sum.spent']);
|
Route::get('sum/spent', ['uses' => 'Budget\IndexController@spent', 'as' => 'sum.spent']);
|
||||||
Route::get('{budget}/budgeted', ['uses' => 'Budget\ShowController@budgeted', 'as' => 'budget.budgeted']);
|
//Route::get('{budget}/budgeted', ['uses' => 'Budget\ShowController@budgeted', 'as' => 'budget.budgeted']);
|
||||||
Route::get('{budget}/spent', ['uses' => 'Budget\ShowController@spent', 'as' => 'budget.spent']);
|
//Route::get('{budget}/spent', ['uses' => 'Budget\ShowController@spent', 'as' => 'budget.spent']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user