Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Various API changes for v2
James Cole077f3e095bc2
diff --git a/app/Http/Controllers/Api/V3/Controllers/AccountController.php b/app/Http/Controllers/Api/V2/Controllers/AccountController.phpsimilarity index 54%rename from app/Http/Controllers/Api/V3/Controllers/AccountController.phprename to app/Http/Controllers/Api/V2/Controllers/AccountController.phpindex 6051904899..7639cee1a3 100644--- a/app/Http/Controllers/Api/V3/Controllers/AccountController.php+++ b/app/Http/Controllers/Api/V2/Controllers/AccountController.php@@ -2,10 +2,10 @@declare(strict_types=1);-namespace FireflyIII\Http\Controllers\Api\V3\Controllers;+namespace FireflyIII\Http\Controllers\Api\V2\Controllers;use FireflyIII\Http\Controllers\Controller;-use FireflyIII\JsonApi\V3\AccountBalances\AccountBalanceSchema;+use FireflyIII\JsonApi\V2\AccountBalances\AccountBalanceSchema;use FireflyIII\Models\Account;use Illuminate\Contracts\Support\Responsable;use LaravelJsonApi\Core\Facades\JsonApi;@@ -26,18 +26,18 @@ class AccountController extends Controlleruse Actions\Update;use Actions\UpdateRelationship;- public function readAccountBalances(AnonymousQuery $query, AccountBalanceSchema $schema, Account $account): Responsable- {- $schema = JsonApi::server()->schemas()->schemaFor('account-balances');-- $models = $schema- ->repository()- ->queryAll()- ->withRequest($query)- ->withAccount($account)- ->get()- ;-- return DataResponse::make($models);- }+// public function readAccountBalances(AnonymousQuery $query, AccountBalanceSchema $schema, Account $account): Responsable+// {+// $schema = JsonApi::server()->schemas()->schemaFor('account-balances');+//+// $models = $schema+// ->repository()+// ->queryAll()+// ->withRequest($query)+// ->withAccount($account)+// ->get()+// ;+//+// return DataResponse::make($models);+// }}diff --git a/app/JsonApi/V3/AccountBalances/AccountBalanceRepository.php b/app/JsonApi/V2/AccountBalances/AccountBalanceRepository.phpsimilarity index 96%rename from app/JsonApi/V3/AccountBalances/AccountBalanceRepository.phprename to app/JsonApi/V2/AccountBalances/AccountBalanceRepository.phpindex f5fa8c0193..6d4551cc93 100644--- a/app/JsonApi/V3/AccountBalances/AccountBalanceRepository.php+++ b/app/JsonApi/V2/AccountBalances/AccountBalanceRepository.php@@ -21,7 +21,7 @@declare(strict_types=1);-namespace FireflyIII\JsonApi\V3\AccountBalances;+namespace FireflyIII\JsonApi\V2\AccountBalances;use FireflyIII\Entities\AccountBalance;use LaravelJsonApi\Contracts\Store\QueriesAll;diff --git a/app/JsonApi/V3/AccountBalances/AccountBalanceResource.php b/app/JsonApi/V2/AccountBalances/AccountBalanceResource.phpsimilarity index 94%rename from app/JsonApi/V3/AccountBalances/AccountBalanceResource.phprename to app/JsonApi/V2/AccountBalances/AccountBalanceResource.phpindex 15d12d9152..e9d3520556 100644--- a/app/JsonApi/V3/AccountBalances/AccountBalanceResource.php+++ b/app/JsonApi/V2/AccountBalances/AccountBalanceResource.php@@ -2,7 +2,7 @@declare(strict_types=1);-namespace FireflyIII\JsonApi\V3\AccountBalances;+namespace FireflyIII\JsonApi\V2\AccountBalances;use Illuminate\Http\Request;use LaravelJsonApi\Core\Resources\JsonApiResource;diff --git a/app/JsonApi/V3/AccountBalances/AccountBalanceSchema.php b/app/JsonApi/V2/AccountBalances/AccountBalanceSchema.phpsimilarity index 95%rename from app/JsonApi/V3/AccountBalances/AccountBalanceSchema.phprename to app/JsonApi/V2/AccountBalances/AccountBalanceSchema.phpindex 6e4b4573cf..e0c2d13bb9 100644--- a/app/JsonApi/V3/AccountBalances/AccountBalanceSchema.php+++ b/app/JsonApi/V2/AccountBalances/AccountBalanceSchema.php@@ -2,7 +2,7 @@declare(strict_types=1);-namespace FireflyIII\JsonApi\V3\AccountBalances;+namespace FireflyIII\JsonApi\V2\AccountBalances;use FireflyIII\Entities\AccountBalance;use LaravelJsonApi\Core\Schema\Schema;diff --git a/app/JsonApi/V3/AccountBalances/Capabilities/AccountBalanceQuery.php b/app/JsonApi/V2/AccountBalances/Capabilities/AccountBalanceQuery.phpsimilarity index 96%rename from app/JsonApi/V3/AccountBalances/Capabilities/AccountBalanceQuery.phprename to app/JsonApi/V2/AccountBalances/Capabilities/AccountBalanceQuery.phpindex 6221948d4f..19994ab2a0 100644--- a/app/JsonApi/V3/AccountBalances/Capabilities/AccountBalanceQuery.php+++ b/app/JsonApi/V2/AccountBalances/Capabilities/AccountBalanceQuery.php@@ -21,7 +21,7 @@declare(strict_types=1);-namespace FireflyIII\JsonApi\V3\AccountBalances\Capabilities;+namespace FireflyIII\JsonApi\V2\AccountBalances\Capabilities;use FireflyIII\Entities\AccountBalance;use FireflyIII\Models\Account;diff --git a/app/JsonApi/V3/Accounts/AccountRepository.php b/app/JsonApi/V2/Accounts/AccountRepository.phpsimilarity index 97%rename from app/JsonApi/V3/Accounts/AccountRepository.phprename to app/JsonApi/V2/Accounts/AccountRepository.phpindex 1c4415756d..d73ddd75a2 100644--- a/app/JsonApi/V3/Accounts/AccountRepository.php+++ b/app/JsonApi/V2/Accounts/AccountRepository.php@@ -21,7 +21,7 @@declare(strict_types=1);-namespace FireflyIII\JsonApi\V3\Accounts;+namespace FireflyIII\JsonApi\V2\Accounts;use FireflyIII\Models\Account;use FireflyIII\Support\JsonApi\Concerns\UsergroupAware;diff --git a/app/JsonApi/V3/Accounts/AccountResource.php b/app/JsonApi/V2/Accounts/AccountResource.phpsimilarity index 96%rename from app/JsonApi/V3/Accounts/AccountResource.phprename to app/JsonApi/V2/Accounts/AccountResource.phpindex 2d4d0525c9..b809641bb5 100644--- a/app/JsonApi/V3/Accounts/AccountResource.php+++ b/app/JsonApi/V2/Accounts/AccountResource.php@@ -2,7 +2,7 @@declare(strict_types=1);-namespace FireflyIII\JsonApi\V3\Accounts;+namespace FireflyIII\JsonApi\V2\Accounts;use FireflyIII\Models\Account;use Illuminate\Http\Request;@@ -123,7 +123,8 @@ class AccountResource extends JsonApiResource{return [$this->relation('user')->withData($this->resource->user),- $this->relation('account_balances')->withData($this->resource->balances),+ $this->relation('currency')->withData($this->resource->transactionCurrency),+ //$this->relation('account_balances')->withData($this->resource->balances),];}}diff --git a/app/JsonApi/V3/Accounts/AccountSchema.php b/app/JsonApi/V2/Accounts/AccountSchema.phpsimilarity index 97%rename from app/JsonApi/V3/Accounts/AccountSchema.phprename to app/JsonApi/V2/Accounts/AccountSchema.phpindex 12aefffe11..bb50bd600b 100644--- a/app/JsonApi/V3/Accounts/AccountSchema.php+++ b/app/JsonApi/V2/Accounts/AccountSchema.php@@ -2,7 +2,7 @@declare(strict_types=1);-namespace FireflyIII\JsonApi\V3\Accounts;+namespace FireflyIII\JsonApi\V2\Accounts;use FireflyIII\Models\Account;use LaravelJsonApi\Eloquent\Contracts\Paginator;diff --git a/app/JsonApi/V3/Accounts/Capabilities/AccountQuery.php b/app/JsonApi/V2/Accounts/Capabilities/AccountQuery.phpsimilarity index 97%rename from app/JsonApi/V3/Accounts/Capabilities/AccountQuery.phprename to app/JsonApi/V2/Accounts/Capabilities/AccountQuery.phpindex 948c5f4486..c52d97d921 100644--- a/app/JsonApi/V3/Accounts/Capabilities/AccountQuery.php+++ b/app/JsonApi/V2/Accounts/Capabilities/AccountQuery.php@@ -21,7 +21,7 @@declare(strict_types=1);-namespace FireflyIII\JsonApi\V3\Accounts\Capabilities;+namespace FireflyIII\JsonApi\V2\Accounts\Capabilities;use FireflyIII\Support\JsonApi\Concerns\UsergroupAware;use FireflyIII\Support\JsonApi\Enrichments\AccountEnrichment;diff --git a/app/JsonApi/V3/Server.php b/app/JsonApi/V2/Server.phpsimilarity index 76%rename from app/JsonApi/V3/Server.phprename to app/JsonApi/V2/Server.phpindex 6ab65c5e51..a0c5d97356 100644--- a/app/JsonApi/V3/Server.php+++ b/app/JsonApi/V2/Server.php@@ -2,11 +2,11 @@declare(strict_types=1);-namespace FireflyIII\JsonApi\V3;+namespace FireflyIII\JsonApi\V2;-use FireflyIII\JsonApi\V3\Accounts\AccountSchema;-use FireflyIII\JsonApi\V3\AccountBalances\AccountBalanceSchema;-use FireflyIII\JsonApi\V3\Users\UserSchema;+use FireflyIII\JsonApi\V2\Accounts\AccountSchema;+use FireflyIII\JsonApi\V2\AccountBalances\AccountBalanceSchema;+use FireflyIII\JsonApi\V2\Users\UserSchema;use LaravelJsonApi\Core\Server\Server as BaseServer;class Server extends BaseServerdiff --git a/app/JsonApi/V3/Users/UserResource.php b/app/JsonApi/V2/Users/UserResource.phpsimilarity index 95%rename from app/JsonApi/V3/Users/UserResource.phprename to app/JsonApi/V2/Users/UserResource.phpindex 44d5be0d18..137325e65d 100644--- a/app/JsonApi/V3/Users/UserResource.php+++ b/app/JsonApi/V2/Users/UserResource.php@@ -2,7 +2,7 @@declare(strict_types=1);-namespace FireflyIII\JsonApi\V3\Users;+namespace FireflyIII\JsonApi\V2\Users;use FireflyIII\Models\User;use Illuminate\Http\Request;diff --git a/app/JsonApi/V3/Users/UserSchema.php b/app/JsonApi/V2/Users/UserSchema.phpsimilarity index 96%rename from app/JsonApi/V3/Users/UserSchema.phprename to app/JsonApi/V2/Users/UserSchema.phpindex f503151f30..8a32b34676 100644--- a/app/JsonApi/V3/Users/UserSchema.php+++ b/app/JsonApi/V2/Users/UserSchema.php@@ -2,7 +2,7 @@declare(strict_types=1);-namespace FireflyIII\JsonApi\V3\Users;+namespace FireflyIII\JsonApi\V2\Users;use FireflyIII\User;use LaravelJsonApi\Eloquent\Contracts\Paginator;diff --git a/app/Models/Account.php b/app/Models/Account.phpindex df6f4ae9c4..8bfdc2a192 100644--- a/app/Models/Account.php+++ b/app/Models/Account.php@@ -28,6 +28,7 @@ use Eloquent;use FireflyIII\Support\Models\ReturnsIntegerIdTrait;use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;use FireflyIII\User;+use GeneaLabs\LaravelModelCaching\Traits\Cachable;use Illuminate\Database\Eloquent\Builder as EloquentBuilder;use Illuminate\Database\Eloquent\Casts\Attribute;use Illuminate\Database\Eloquent\Collection;@@ -95,22 +96,22 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @method static Builder|Account withTrashed()* @method static Builder|Account withoutTrashed()*- * @property Carbon $lastActivityDate- * @property string $startBalance- * @property string $endBalance- * @property string $difference- * @property string $interest- * @property string $interestPeriod- * @property string $accountTypeString- * @property Location $location- * @property string $liability_direction- * @property string $current_debt- * @property int $user_group_id+ * @property Carbon $lastActivityDate+ * @property string $startBalance+ * @property string $endBalance+ * @property string $difference+ * @property string $interest+ * @property string $interestPeriod+ * @property string $accountTypeString+ * @property Location $location+ * @property string $liability_direction+ * @property string $current_debt+ * @property int $user_group_id** @method static EloquentBuilder|Account whereUserGroupId($value)*- * @property null|UserGroup $userGroup- * @property mixed $account_id+ * @property null|UserGroup $userGroup+ * @property mixed $account_id** @mixin Eloquent*/@@ -120,9 +121,10 @@ class Account extends Modeluse ReturnsIntegerIdTrait;use ReturnsIntegerUserIdTrait;use SoftDeletes;+ use Cachable;protected $casts- = [+ = ['created_at' => 'datetime','updated_at' => 'datetime','user_id' => 'integer',@@ -131,9 +133,9 @@ class Account extends Model'encrypted' => 'boolean',];- protected $fillable = ['user_id', 'user_group_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];+ protected $fillable = ['user_id', 'user_group_id', 'account_type_id', 'name', 'active', 'virtual_balance', 'iban'];- protected $hidden = ['encrypted'];+ protected $hidden = ['encrypted'];private bool $joinedAccountTypes = false;/**@@ -144,13 +146,13 @@ class Account extends Modelpublic static function routeBinder(string $value): self{if (auth()->check()) {- $accountId = (int)$value;+ $accountId = (int) $value;/** @var User $user */- $user = auth()->user();+ $user = auth()->user();/** @var null|Account $account */- $account = $user->accounts()->with(['accountType'])->find($accountId);+ $account = $user->accounts()->with(['accountType'])->find($accountId);if (null !== $account) {return $account;}@@ -181,9 +183,8 @@ class Account extends Model{/** @var null|AccountMeta $metaValue */$metaValue = $this->accountMeta()- ->where('name', 'account_number')- ->first()- ;+ ->where('name', 'account_number')+ ->first();return null !== $metaValue ? $metaValue->data : '';}@@ -246,7 +247,7 @@ class Account extends Modelpublic function setVirtualBalanceAttribute(mixed $value): void{- $value = (string)$value;+ $value = (string) $value;if ('' === $value) {$value = null;}@@ -266,7 +267,7 @@ class Account extends Modelprotected function accountId(): Attribute{return Attribute::make(- get: static fn ($value) => (int)$value,+ get: static fn($value) => (int) $value,);}@@ -276,21 +277,21 @@ class Account extends Modelprotected function accountTypeId(): Attribute{return Attribute::make(- get: static fn ($value) => (int)$value,+ get: static fn($value) => (int) $value,);}protected function iban(): Attribute{return Attribute::make(- get: static fn ($value) => null === $value ? null : trim(str_replace(' ', '', (string)$value)),+ get: static fn($value) => null === $value ? null : trim(str_replace(' ', '', (string) $value)),);}protected function order(): Attribute{return Attribute::make(- get: static fn ($value) => (int)$value,+ get: static fn($value) => (int) $value,);}@@ -300,7 +301,7 @@ class Account extends Modelprotected function virtualBalance(): Attribute{return Attribute::make(- get: static fn ($value) => (string)$value,+ get: static fn($value) => (string) $value,);}}diff --git a/composer.json b/composer.jsonindex 8e721952af..c0148abbd6 100644--- a/composer.json+++ b/composer.json@@ -84,6 +84,7 @@"bacon/bacon-qr-code": "2.*","diglactic/laravel-breadcrumbs": "^9","gdbots/query-parser": "^3.0",+ "genealabs/laravel-model-caching": "^11.0","guzzlehttp/guzzle": "^7.8","jc5/google2fa-laravel": "^2.0","jc5/recovery": "^2",diff --git a/composer.lock b/composer.lockindex 9f731b90fe..8903d56f49 100644--- a/composer.lock+++ b/composer.lock@@ -4,7 +4,7 @@"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies","This file is @generated automatically"],- "content-hash": "a3648ab093343dd83bf7e728034ab46c",+ "content-hash": "9d828d17b38cf563cd5cfc14c906c08f","packages": [{"name": "bacon/bacon-qr-code",@@ -1045,6 +1045,130 @@},"time": "2021-12-05T19:44:35+00:00"},+ {+ "name": "genealabs/laravel-model-caching",+ "version": "11.0.1",+ "source": {+ "type": "git",+ "url": "https://github.com/mikebronner/laravel-model-caching.git",+ "reference": "2a38f0f1ed3554cf2da272d66c4d08a7885f196b"+ },+ "dist": {+ "type": "zip",+ "url": "https://api.github.com/repos/mikebronner/laravel-model-caching/zipball/2a38f0f1ed3554cf2da272d66c4d08a7885f196b",+ "reference": "2a38f0f1ed3554cf2da272d66c4d08a7885f196b",+ "shasum": ""+ },+ "require": {+ "genealabs/laravel-pivot-events": "^10.0|^11.0",+ "illuminate/cache": "^10.0|^11.0",+ "illuminate/config": "^10.0|^11.0",+ "illuminate/console": "^10.0|^11.0",+ "illuminate/container": "^10.0|^11.0",+ "illuminate/database": "^10.0|^11.0",+ "illuminate/http": "^10.0|^11.0",+ "illuminate/support": "^10.0|^11.0",+ "php": ">=8.1"+ },+ "require-dev": {+ "doctrine/dbal": "^3.3",+ "fakerphp/faker": "^1.11",+ "laravel/legacy-factories": "^1.3",+ "laravel/nova": "^4.0",+ "orchestra/testbench": "^8.0|^9.0",+ "orchestra/testbench-browser-kit": "^8.0",+ "php-coveralls/php-coveralls": "^2.2",+ "phpunit/phpunit": "^10.0",+ "slevomat/coding-standard": "^7.0|^8.14",+ "squizlabs/php_codesniffer": "^3.6",+ "symfony/thanks": "^1.2"+ },+ "type": "library",+ "extra": {+ "laravel": {+ "providers": [+ "GeneaLabs\\LaravelModelCaching\\Providers\\Service"+ ]+ }+ },+ "autoload": {+ "psr-4": {+ "GeneaLabs\\LaravelModelCaching\\": "src/"+ }+ },+ "notification-url": "https://packagist.org/downloads/",+ "license": [+ "MIT"+ ],+ "authors": [+ {+ "name": "Mike Bronner",+ "email": "[email protected]"+ }+ ],+ "description": "Automatic caching for Eloquent models.",+ "support": {+ "issues": "https://github.com/mikebronner/laravel-model-caching/issues",+ "source": "https://github.com/mikebronner/laravel-model-caching/tree/11.0.1"+ },+ "time": "2024-03-14T23:34:57+00:00"+ },+ {+ "name": "genealabs/laravel-pivot-events",+ "version": "11.0.0",+ "source": {+ "type": "git",+ "url": "https://github.com/mikebronner/laravel-pivot-events.git",+ "reference": "16e974d80160774641f4323f5ffb757b79f300d3"+ },+ "dist": {+ "type": "zip",+ "url": "https://api.github.com/repos/mikebronner/laravel-pivot-events/zipball/16e974d80160774641f4323f5ffb757b79f300d3",+ "reference": "16e974d80160774641f4323f5ffb757b79f300d3",+ "shasum": ""+ },+ "require": {+ "illuminate/database": "^8.0|^9.0|^10.0|^11.0",+ "illuminate/support": "^8.0|^9.0|^10.0|^11.0"+ },+ "require-dev": {+ "orchestra/testbench": "^9.0",+ "phpunit/phpunit": "^10.5",+ "symfony/thanks": "^1.0"+ },+ "type": "library",+ "autoload": {+ "psr-4": {+ "GeneaLabs\\LaravelPivotEvents\\": "src"+ }+ },+ "notification-url": "https://packagist.org/downloads/",+ "license": [+ "MIT"+ ],+ "authors": [+ {+ "name": "Mike Bronner",+ "email": "[email protected]",+ "homepage": "https://genealabs.com",+ "role": "Developer"+ }+ ],+ "description": "This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.",+ "homepage": "https://github.com/mikebronner/laravel-pivot-events",+ "keywords": [+ "eloquent events",+ "eloquent extra events",+ "laravel BelongsToMany events",+ "laravel pivot events",+ "laravel sync events"+ ],+ "support": {+ "issues": "https://github.com/mikebronner/laravel-pivot-events/issues",+ "source": "https://github.com/mikebronner/laravel-pivot-events"+ },+ "time": "2024-03-14T23:24:54+00:00"+ },{"name": "graham-campbell/result-type","version": "v1.1.3",diff --git a/config/jsonapi.php b/config/jsonapi.phpindex 498c1545a2..4047db0651 100644--- a/config/jsonapi.php+++ b/config/jsonapi.php@@ -2,7 +2,7 @@declare(strict_types=1);-use FireflyIII\JsonApi\V3\Server;+use FireflyIII\JsonApi\V2\Server;return [/*@@ -30,6 +30,6 @@ return [| class name of the server class.*/'servers' => [- 'v3' => Server::class,+ 'v2' => Server::class,],];diff --git a/config/laravel-model-caching.php b/config/laravel-model-caching.phpnew file mode 100644index 0000000000..cda02fbe7a--- /dev/null+++ b/config/laravel-model-caching.php@@ -0,0 +1,11 @@+<?php++return [+ 'cache-prefix' => '',++ 'enabled' => env('MODEL_CACHE_ENABLED', true),++ 'use-database-keying' => env('MODEL_CACHE_USE_DATABASE_KEYING', true),++ 'store' => env('MODEL_CACHE_STORE'),+];diff --git a/routes/api.php b/routes/api.phpindex 1a5bc447f4..be94da8681 100644--- a/routes/api.php+++ b/routes/api.php@@ -22,14 +22,27 @@declare(strict_types=1);-use FireflyIII\Http\Controllers\Api\V3\Controllers\AccountController;+use FireflyIII\Http\Controllers\Api\V2\Controllers\AccountController;use LaravelJsonApi\Laravel\Facades\JsonApiRoute;use LaravelJsonApi\Laravel\Http\Controllers\JsonApiController;-use LaravelJsonApi\Laravel\Routing\ActionRegistrar;use LaravelJsonApi\Laravel\Routing\Relationships;use LaravelJsonApi\Laravel\Routing\ResourceRegistrar;-// V2 auto complete controller(s)+/*+ *+ * ____ ____ ___ .______ ______ __ __ .___________. _______ _______.+ * \ \ / / |__ \ | _ \ / __ \ | | | | | || ____| / |+ * \ \/ / ) | | |_) | | | | | | | | | `---| |----`| |__ | (----`+ * \ / / / | / | | | | | | | | | | | __| \ \+ * \ / / /_ | |\ \----.| `--' | | `--' | | | | |____.----) |+ * \__/ |____| | _| `._____| \______/ \______/ |__| |_______|_______/+ */++++/**+ * AUTOCOMPLETE ROUTES+ */Route::group(['namespace' => 'FireflyIII\Api\V2\Controllers\Autocomplete',@@ -37,7 +50,6 @@ Route::group('as' => 'api.v2.autocomplete.',],static function (): void {- // Auto complete routesRoute::get('accounts', ['uses' => 'AccountController@accounts', 'as' => 'accounts']);Route::get('categories', ['uses' => 'CategoryController@categories', 'as' => 'categories']);Route::get('tags', ['uses' => 'TagController@tags', 'as' => 'tags']);@@ -45,7 +57,9 @@ Route::group(});-// V2 API routes for charts+/**+ * CHART ROUTES+ */Route::group(['namespace' => 'FireflyIII\Api\V2\Controllers\Chart',@@ -54,27 +68,13 @@ Route::group(],static function (): void {Route::get('account/dashboard', ['uses' => 'AccountController@dashboard', 'as' => 'account.dashboard']);- // Route::get('budget/dashboard', ['uses' => 'BudgetController@dashboard', 'as' => 'budget.dashboard']);- // Route::get('category/dashboard', ['uses' => 'CategoryController@dashboard', 'as' => 'category.dashboard']);+ Route::get('budget/dashboard', ['uses' => 'BudgetController@dashboard', 'as' => 'budget.dashboard']);+ Route::get('category/dashboard', ['uses' => 'CategoryController@dashboard', 'as' => 'category.dashboard']);Route::get('balance/balance', ['uses' => 'BalanceController@balance', 'as' => 'balance.balance']);});-// JsonApiRoute::server('v3')-// ->prefix('v3')-// ->resources(function (ResourceRegistrar $server) {-// $server->resource('accounts', AccountController::class)->readOnly()->relationships(function (Relationships $relations) {-// $relations->hasOne('user')->readOnly();-// //$relations->hasMany('account_balances')->readOnly();-// })-// ->actions(function (ActionRegistrar $actions) {-// $actions->withId()->get('account-balances', 'readAccountBalances'); // non-eloquent pseudo relation-// });-// $server->resource('users', JsonApiController::class)->readOnly()->relationships(function (Relationships $relations) {-// $relations->hasMany('accounts')->readOnly();-// });-// $server->resource('account-balances', JsonApiController::class);-// });+// V2 API route for Summary boxes// BASIC@@ -121,19 +121,19 @@ Route::group(});-// V2 API route for accounts.-Route::group(- [- 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Account',- 'prefix' => 'v2/accounts',- 'as' => 'api.v2.accounts.',- ],- static function (): void {- Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);- Route::get('{account}', ['uses' => 'ShowController@show', 'as' => 'show']);- Route::put('{account}', ['uses' => 'UpdateController@update', 'as' => 'update']);- }-);+//// V2 API route for accounts.+//Route::group(+// [+// 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Account',+// 'prefix' => 'v2/accounts',+// 'as' => 'api.v2.accounts.',+// ],+// static function (): void {+// Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);+// Route::get('{account}', ['uses' => 'ShowController@show', 'as' => 'show']);+// Route::put('{account}', ['uses' => 'UpdateController@update', 'as' => 'update']);+// }+//);// V2 API route for subscriptions.Route::group(@@ -247,7 +247,34 @@ Route::group(});-// down here is v1+/**+ * V2 JSON API ROUTES+ */+JsonApiRoute::server('v2')->prefix('v2')+ ->resources(function (ResourceRegistrar $server) {+ /**+ * ACCOUNTS+ */+ $server->resource('accounts', AccountController::class)->readOnly()->relationships(function (Relationships $relations) {+ $relations->hasOne('user')->readOnly();+ });++ /**+ * USERS+ */+ $server->resource('users', JsonApiController::class)->readOnly()->relationships(function (Relationships $relations) {+ $relations->hasMany('accounts')->readOnly();+ });+ });++/*+ * ____ ____ __ .______ ______ __ __ .___________. _______ _______.+ * \ \ / / /_ | | _ \ / __ \ | | | | | || ____| / |+ * \ \/ / | | | |_) | | | | | | | | | `---| |----`| |__ | (----`+ * \ / | | | / | | | | | | | | | | | __| \ \+ * \ / | | | |\ \----.| `--' | | `--' | | | | |____.----) |+ * \__/ |_| | _| `._____| \______/ \______/ |__| |_______|_______/+ */// Autocomplete controllersRoute::group(@@ -278,7 +305,7 @@ Route::group();// CHART ROUTES.-// Accounts+// Chart accountsRoute::group(['namespace' => 'FireflyIII\Api\V1\Controllers\Chart',