mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Export data in API.
This commit is contained in:
209
app/Api/V1/Controllers/Data/Export/ExportController.php
Normal file
209
app/Api/V1/Controllers/Data/Export/ExportController.php
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* AccountController.php
|
||||||
|
* Copyright (c) 2021 james@firefly-iii.org
|
||||||
|
*
|
||||||
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace FireflyIII\Api\V1\Controllers\Data\Export;
|
||||||
|
|
||||||
|
|
||||||
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
|
use FireflyIII\Api\V1\Requests\Data\Export\ExportRequest;
|
||||||
|
use FireflyIII\Support\Export\ExportDataGenerator;
|
||||||
|
use FireflyIII\User;
|
||||||
|
use Illuminate\Http\Response as LaravelResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ExportController
|
||||||
|
*/
|
||||||
|
class ExportController extends Controller
|
||||||
|
{
|
||||||
|
private ExportDataGenerator $exporter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ExportController constructor.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->middleware(
|
||||||
|
function ($request, $next) {
|
||||||
|
/** @var User $user */
|
||||||
|
$user = auth()->user();
|
||||||
|
/** @var ExportDataGenerator $exporter */
|
||||||
|
$this->exporter = app(ExportDataGenerator::class);
|
||||||
|
$this->exporter->setUser($user);
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportRequest $request
|
||||||
|
*
|
||||||
|
* @return LaravelResponse
|
||||||
|
* @throws \League\Csv\CannotInsertRecord
|
||||||
|
*/
|
||||||
|
public function accounts(ExportRequest $request): LaravelResponse
|
||||||
|
{
|
||||||
|
$this->exporter->setExportAccounts(true);
|
||||||
|
|
||||||
|
return $this->returnExport('accounts');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportRequest $request
|
||||||
|
*
|
||||||
|
* @return LaravelResponse
|
||||||
|
* @throws \League\Csv\CannotInsertRecord
|
||||||
|
*/
|
||||||
|
public function bills(ExportRequest $request): LaravelResponse
|
||||||
|
{
|
||||||
|
$this->exporter->setExportBills(true);
|
||||||
|
|
||||||
|
return $this->returnExport('bills');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportRequest $request
|
||||||
|
*
|
||||||
|
* @return LaravelResponse
|
||||||
|
* @throws \League\Csv\CannotInsertRecord
|
||||||
|
*/
|
||||||
|
public function budgets(ExportRequest $request): LaravelResponse
|
||||||
|
{
|
||||||
|
$this->exporter->setExportBudgets(true);
|
||||||
|
|
||||||
|
return $this->returnExport('budgets');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportRequest $request
|
||||||
|
*
|
||||||
|
* @return LaravelResponse
|
||||||
|
* @throws \League\Csv\CannotInsertRecord
|
||||||
|
*/
|
||||||
|
public function categories(ExportRequest $request): LaravelResponse
|
||||||
|
{
|
||||||
|
$this->exporter->setExportCategories(true);
|
||||||
|
|
||||||
|
return $this->returnExport('categories');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportRequest $request
|
||||||
|
*
|
||||||
|
* @return LaravelResponse
|
||||||
|
* @throws \League\Csv\CannotInsertRecord
|
||||||
|
*/
|
||||||
|
public function piggyBanks(ExportRequest $request): LaravelResponse
|
||||||
|
{
|
||||||
|
$this->exporter->setExportPiggies(true);
|
||||||
|
|
||||||
|
return $this->returnExport('piggies');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportRequest $request
|
||||||
|
*
|
||||||
|
* @return LaravelResponse
|
||||||
|
* @throws \League\Csv\CannotInsertRecord
|
||||||
|
*/
|
||||||
|
public function recurring(ExportRequest $request): LaravelResponse
|
||||||
|
{
|
||||||
|
$this->exporter->setExportRecurring(true);
|
||||||
|
|
||||||
|
return $this->returnExport('recurrences');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportRequest $request
|
||||||
|
*
|
||||||
|
* @return LaravelResponse
|
||||||
|
* @throws \League\Csv\CannotInsertRecord
|
||||||
|
*/
|
||||||
|
public function rules(ExportRequest $request): LaravelResponse
|
||||||
|
{
|
||||||
|
$this->exporter->setExportRules(true);
|
||||||
|
|
||||||
|
return $this->returnExport('rules');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportRequest $request
|
||||||
|
*
|
||||||
|
* @return LaravelResponse
|
||||||
|
* @throws \League\Csv\CannotInsertRecord
|
||||||
|
*/
|
||||||
|
public function tags(ExportRequest $request): LaravelResponse
|
||||||
|
{
|
||||||
|
$this->exporter->setExportTags(true);
|
||||||
|
|
||||||
|
return $this->returnExport('tags');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportRequest $request
|
||||||
|
*
|
||||||
|
* @return LaravelResponse
|
||||||
|
* @throws \League\Csv\CannotInsertRecord
|
||||||
|
*/
|
||||||
|
public function transactions(ExportRequest $request): LaravelResponse
|
||||||
|
{
|
||||||
|
$params = $request->getAll();
|
||||||
|
$this->exporter->setStart($params['start']);
|
||||||
|
$this->exporter->setEnd($params['end']);
|
||||||
|
$this->exporter->setAccounts($params['accounts']);
|
||||||
|
$this->exporter->setExportTransactions(true);
|
||||||
|
|
||||||
|
return $this->returnExport('transactions');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $key
|
||||||
|
*
|
||||||
|
* @return LaravelResponse
|
||||||
|
* @throws \League\Csv\CannotInsertRecord
|
||||||
|
*/
|
||||||
|
private function returnExport(string $key): LaravelResponse
|
||||||
|
{
|
||||||
|
$date = date('Y-m-d-H-i-s');
|
||||||
|
$fileName = sprintf('%s-export-%s.csv', $date, $key);
|
||||||
|
$data = $this->exporter->export();
|
||||||
|
|
||||||
|
/** @var LaravelResponse $response */
|
||||||
|
$response = response($data[$key]);
|
||||||
|
$response
|
||||||
|
->header('Content-Description', 'File Transfer')
|
||||||
|
->header('Content-Type', 'application/octet-stream')
|
||||||
|
->header('Content-Disposition', 'attachment; filename=' . $fileName)
|
||||||
|
->header('Content-Transfer-Encoding', 'binary')
|
||||||
|
->header('Connection', 'Keep-Alive')
|
||||||
|
->header('Expires', '0')
|
||||||
|
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
|
||||||
|
->header('Pragma', 'public')
|
||||||
|
->header('Content-Length', strlen($data[$key]));
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -135,7 +135,7 @@ class AccountController extends Controller
|
|||||||
'name' => $accountNames[$accountId],
|
'name' => $accountNames[$accountId],
|
||||||
'difference' => bcmul($diff, '-1'),
|
'difference' => bcmul($diff, '-1'),
|
||||||
'difference_float' => ((float)$diff) * -1,
|
'difference_float' => ((float)$diff) * -1,
|
||||||
'currency_id' => $currencyId,
|
'currency_id' => (string) $currencyId,
|
||||||
'currency_code' => $currencies[$currencyId]->code,
|
'currency_code' => $currencies[$currencyId]->code,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@@ -35,12 +35,9 @@ use FireflyIII\User;
|
|||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DateController
|
* Class AccountController
|
||||||
*
|
|
||||||
* Shows income information grouped or limited by date.
|
|
||||||
* Ie. all income grouped by revenue + currency.
|
|
||||||
*/
|
*/
|
||||||
class DateController extends Controller
|
class AccountController extends Controller
|
||||||
{
|
{
|
||||||
use ApiSupport;
|
use ApiSupport;
|
||||||
|
|
||||||
@@ -72,9 +69,11 @@ class DateController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param DateRequest $request
|
||||||
*
|
*
|
||||||
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function basic(DateRequest $request): JsonResponse
|
public function revenue(DateRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
// parameters for chart:
|
// parameters for chart:
|
||||||
$dates = $request->getAll();
|
$dates = $request->getAll();
|
80
app/Api/V1/Requests/Data/Export/ExportRequest.php
Normal file
80
app/Api/V1/Requests/Data/Export/ExportRequest.php
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* ExportRequest.php
|
||||||
|
* Copyright (c) 2021 james@firefly-iii.org
|
||||||
|
*
|
||||||
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace FireflyIII\Api\V1\Requests\Data\Export;
|
||||||
|
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Models\AccountType;
|
||||||
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
|
use FireflyIII\Support\Request\ChecksLogin;
|
||||||
|
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ExportRequest
|
||||||
|
*/
|
||||||
|
class ExportRequest extends FormRequest
|
||||||
|
{
|
||||||
|
use ChecksLogin, ConvertsDataTypes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The rules that the incoming request must be matched against.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'type' => 'in:csv',
|
||||||
|
'accounts' => 'min:1',
|
||||||
|
'start' => 'date|before:end',
|
||||||
|
'end' => 'date|after:start',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAll(): array
|
||||||
|
{
|
||||||
|
$result = [
|
||||||
|
'start' => $this->date('start') ?? Carbon::now()->subYear(),
|
||||||
|
'end' => $this->date('end') ?? Carbon::now(),
|
||||||
|
'type' => $this->string('type'),
|
||||||
|
];
|
||||||
|
$parts = explode(',', $this->string('accounts'));
|
||||||
|
$repository = app(AccountRepositoryInterface::class);
|
||||||
|
$repository->setUser(auth()->user());
|
||||||
|
|
||||||
|
$accounts = new Collection;
|
||||||
|
foreach ($parts as $part) {
|
||||||
|
$accountId = (int)$part;
|
||||||
|
if (0 !== $accountId) {
|
||||||
|
$account = $repository->findNull($accountId);
|
||||||
|
if (null !== $account && AccountType::ASSET === $account->accountType->type) {
|
||||||
|
$accounts->push($account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result['accounts'] = $accounts;
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
@@ -111,8 +111,12 @@ class ExportData extends Command
|
|||||||
/** @var ExportDataGenerator $exporter */
|
/** @var ExportDataGenerator $exporter */
|
||||||
$exporter = app(ExportDataGenerator::class);
|
$exporter = app(ExportDataGenerator::class);
|
||||||
$exporter->setUser($this->user);
|
$exporter->setUser($this->user);
|
||||||
|
|
||||||
$exporter->setStart($options['start']);
|
$exporter->setStart($options['start']);
|
||||||
$exporter->setEnd($options['end']);
|
$exporter->setEnd($options['end']);
|
||||||
|
$exporter->setAccounts($options['accounts']);
|
||||||
|
|
||||||
|
|
||||||
$exporter->setExportTransactions($options['export']['transactions']);
|
$exporter->setExportTransactions($options['export']['transactions']);
|
||||||
$exporter->setExportAccounts($options['export']['accounts']);
|
$exporter->setExportAccounts($options['export']['accounts']);
|
||||||
$exporter->setExportBudgets($options['export']['budgets']);
|
$exporter->setExportBudgets($options['export']['budgets']);
|
||||||
|
@@ -50,6 +50,7 @@ use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
|
|||||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||||
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
|
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
use League\Csv\Writer;
|
use League\Csv\Writer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,35 +58,24 @@ use League\Csv\Writer;
|
|||||||
*/
|
*/
|
||||||
class ExportDataGenerator
|
class ExportDataGenerator
|
||||||
{
|
{
|
||||||
/** @var Carbon */
|
private Carbon $end;
|
||||||
private $end;
|
private bool $exportTransactions;
|
||||||
/** @var bool */
|
private Carbon $start;
|
||||||
private $exportTransactions;
|
private bool $exportAccounts;
|
||||||
/** @var Carbon */
|
private bool $exportBudgets;
|
||||||
private $start;
|
private bool $exportCategories;
|
||||||
/** @var bool */
|
private bool $exportTags;
|
||||||
private $exportAccounts;
|
private bool $exportRecurring;
|
||||||
/** @var bool */
|
private bool $exportRules;
|
||||||
private $exportBudgets;
|
private bool $exportBills;
|
||||||
/** @var bool */
|
private bool $exportPiggies;
|
||||||
private $exportCategories;
|
private User $user;
|
||||||
/** @var bool */
|
private Collection $accounts;
|
||||||
private $exportTags;
|
|
||||||
/** @var bool */
|
|
||||||
private $exportRecurring;
|
|
||||||
/** @var bool */
|
|
||||||
private $exportRules;
|
|
||||||
/** @var bool */
|
|
||||||
private $exportBills;
|
|
||||||
/** @var bool */
|
|
||||||
private $exportPiggies;
|
|
||||||
|
|
||||||
/** @var User */
|
|
||||||
private $user;
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->start = today(config('app.timezone'));
|
$this->accounts = new Collection;
|
||||||
|
$this->start = today(config('app.timezone'));
|
||||||
$this->start->subYear();
|
$this->start->subYear();
|
||||||
$this->end = today(config('app.timezone'));
|
$this->end = today(config('app.timezone'));
|
||||||
$this->exportTransactions = false;
|
$this->exportTransactions = false;
|
||||||
@@ -107,6 +97,14 @@ class ExportDataGenerator
|
|||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Collection $accounts
|
||||||
|
*/
|
||||||
|
public function setAccounts(Collection $accounts): void
|
||||||
|
{
|
||||||
|
$this->accounts = $accounts;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \League\Csv\CannotInsertRecord
|
* @throws \League\Csv\CannotInsertRecord
|
||||||
@@ -506,7 +504,7 @@ class ExportDataGenerator
|
|||||||
$currency ? $currency->code : null,
|
$currency ? $currency->code : null,
|
||||||
$piggy->targetamount,
|
$piggy->targetamount,
|
||||||
$repetition ? $repetition->currentamount : null,
|
$repetition ? $repetition->currentamount : null,
|
||||||
$piggy->startdate->format('Y-m-d'),
|
$piggy->startdate ? $piggy->startdate->format('Y-m-d') : null,
|
||||||
$piggy->targetdate ? $piggy->targetdate->format('Y-m-d') : null,
|
$piggy->targetdate ? $piggy->targetdate->format('Y-m-d') : null,
|
||||||
$piggy->order,
|
$piggy->order,
|
||||||
$piggy->active,
|
$piggy->active,
|
||||||
@@ -670,6 +668,10 @@ class ExportDataGenerator
|
|||||||
$collector->setUser($this->user);
|
$collector->setUser($this->user);
|
||||||
$collector->setRange($this->start, $this->end)->withAccountInformation()->withCategoryInformation()->withBillInformation()
|
$collector->setRange($this->start, $this->end)->withAccountInformation()->withCategoryInformation()->withBillInformation()
|
||||||
->withBudgetInformation()->withTagInformation()->withNotes();
|
->withBudgetInformation()->withTagInformation()->withNotes();
|
||||||
|
if(0 !== $this->accounts->count()) {
|
||||||
|
$collector->setAccounts($this->accounts);
|
||||||
|
}
|
||||||
|
|
||||||
$journals = $collector->getExtractedJournals();
|
$journals = $collector->getExtractedJournals();
|
||||||
|
|
||||||
// get repository for meta data:
|
// get repository for meta data:
|
||||||
|
@@ -64,6 +64,46 @@ Route::group(
|
|||||||
Route::get('overview', ['uses' => 'AccountController@overview', 'as' => 'overview']);
|
Route::get('overview', ['uses' => 'AccountController@overview', 'as' => 'overview']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DATA ROUTES
|
||||||
|
*/
|
||||||
|
// EXPORT
|
||||||
|
Route::group(
|
||||||
|
['namespace' => 'FireflyIII\Api\V1\Controllers\Data\Export', 'prefix' => 'data/export',
|
||||||
|
'as' => 'api.v1.data.export.',],
|
||||||
|
static function () {
|
||||||
|
Route::get('accounts', ['uses' => 'ExportController@accounts', 'as' => 'accounts']);
|
||||||
|
Route::get('bills', ['uses' => 'ExportController@bills', 'as' => 'bills']);
|
||||||
|
Route::get('budgets', ['uses' => 'ExportController@budgets', 'as' => 'budgets']);
|
||||||
|
Route::get('categories', ['uses' => 'ExportController@categories', 'as' => 'categories']);
|
||||||
|
Route::get('piggy-banks', ['uses' => 'ExportController@piggyBanks', 'as' => 'piggy-banks']);
|
||||||
|
Route::get('recurring', ['uses' => 'ExportController@recurring', 'as' => 'recurring']);
|
||||||
|
Route::get('rules', ['uses' => 'ExportController@rules', 'as' => 'rules']);
|
||||||
|
Route::get('tags', ['uses' => 'ExportController@tags', 'as' => 'tags']);
|
||||||
|
Route::get('transactions', ['uses' => 'ExportController@transactions', 'as' => 'transactions']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SUMMARY CONTROLLER
|
* SUMMARY CONTROLLER
|
||||||
@@ -82,14 +122,14 @@ Route::group(
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// EXPORT TODO
|
//// EXPORT
|
||||||
Route::group(
|
//Route::group(
|
||||||
['namespace' => 'FireflyIII\Api\V1\Controllers\Data\Export', 'prefix' => 'data/export',
|
// ['namespace' => 'FireflyIII\Api\V1\Controllers\Data\Export', 'prefix' => 'data/export',
|
||||||
'as' => 'api.v1.data.export.',],
|
// 'as' => 'api.v1.data.export.',],
|
||||||
static function () {
|
// static function () {
|
||||||
Route::get('transactions', ['uses' => 'TransactionController@export', 'as' => 'transactions']);
|
// Route::get('transactions', ['uses' => 'TransactionController@export', 'as' => 'transactions']);
|
||||||
}
|
// }
|
||||||
);
|
//);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INSIGHT CONTROLLERS
|
* INSIGHT CONTROLLERS
|
||||||
@@ -102,7 +142,7 @@ Route::group(
|
|||||||
static function () {
|
static function () {
|
||||||
// Insight in expenses.
|
// Insight in expenses.
|
||||||
|
|
||||||
// grouped by expense account or asset account:
|
// TODO grouped by expense account or asset account:
|
||||||
Route::get('expense', ['uses' => 'AccountController@expense', 'as' => 'expense']);
|
Route::get('expense', ['uses' => 'AccountController@expense', 'as' => 'expense']);
|
||||||
Route::get('asset', ['uses' => 'AccountController@asset', 'as' => 'asset']);
|
Route::get('asset', ['uses' => 'AccountController@asset', 'as' => 'asset']);
|
||||||
|
|
||||||
@@ -111,17 +151,48 @@ Route::group(
|
|||||||
|
|
||||||
// TODO Budget/no budget and budget limit
|
// TODO Budget/no budget and budget limit
|
||||||
Route::get('budget', ['uses' => 'BudgetController@budget', 'as' => 'budget']);
|
Route::get('budget', ['uses' => 'BudgetController@budget', 'as' => 'budget']);
|
||||||
Route::get('no-budget', ['uses' => 'BudgetController@budget', 'as' => 'budget']);
|
Route::get('no-budget', ['uses' => 'BudgetController@noBudget', 'as' => 'no-budget']);
|
||||||
|
|
||||||
// TODO category and no category
|
// TODO category and no category
|
||||||
|
Route::get('category', ['uses' => 'CategoryController@category', 'as' => 'category']);
|
||||||
|
Route::get('no-category', ['uses' => 'CategoryController@noCategory', 'as' => 'no-category']);
|
||||||
|
|
||||||
// TODO bill and no bill
|
// TODO bill and no bill
|
||||||
|
Route::get('bill', ['uses' => 'BillController@bill', 'as' => 'bill']);
|
||||||
|
Route::get('no-bill', ['uses' => 'BillController@noBill', 'as' => 'no-bill']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
//// Insight in income.
|
// Insight in expenses:
|
||||||
// // Insight in income by date.
|
Route::group(
|
||||||
// Route::get('income/date/basic', ['uses' => 'Income\DateController@basic', 'as' => 'income.date.basic']);
|
['namespace' => 'FireflyIII\Api\V1\Controllers\Insight\Income', 'prefix' => 'insight/income',
|
||||||
|
'as' => 'api.v1.insight.income.',],
|
||||||
|
static function () {
|
||||||
|
// Insight in income
|
||||||
|
|
||||||
|
// TODO grouped by expense account or asset account:
|
||||||
|
Route::get('revenue', ['uses' => 'AccountController@revenue', 'as' => 'expense']);
|
||||||
|
Route::get('asset', ['uses' => 'AccountController@asset', 'as' => 'asset']);
|
||||||
|
|
||||||
|
// TODO total:
|
||||||
|
Route::get('total', ['uses' => 'PeriodController@total', 'as' => 'total']);
|
||||||
|
|
||||||
|
// TODO category and no category
|
||||||
|
Route::get('category', ['uses' => 'CategoryController@category', 'as' => 'category']);
|
||||||
|
Route::get('no-category', ['uses' => 'CategoryController@noCategory', 'as' => 'no-category']);
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user