Skip to content

Firefly III: a personal finances manager

First page for currency exchange rates.

James Cole1daffedde06d
diff --git a/app/Api/V2/Controllers/Model/TransactionCurrency/IndexController.php b/app/Api/V2/Controllers/Model/TransactionCurrency/IndexController.php
new file mode 100644
index 0000000000..ec311fb17b
--- /dev/null
+++ b/app/Api/V2/Controllers/Model/TransactionCurrency/IndexController.php
@@ -0,0 +1,86 @@
+<?php
+
+/*
+ * IndexController.php
+ * Copyright (c) 2024 [email protected].
+ *
+ * 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/.
+ */
+
+declare(strict_types=1);
+
+namespace FireflyIII\Api\V2\Controllers\Model\TransactionCurrency;
+
+use FireflyIII\Api\V2\Controllers\Controller;
+use FireflyIII\Api\V2\Request\Model\TransactionCurrency\IndexRequest;
+use FireflyIII\Enums\UserRoleEnum;
+use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
+use FireflyIII\Transformers\V2\CurrencyTransformer;
+use Illuminate\Http\JsonResponse;
+use Illuminate\Pagination\LengthAwarePaginator;
+
+class IndexController extends Controller
+{
+ public const string RESOURCE_KEY = 'transaction-currencies';
+
+ private CurrencyRepositoryInterface $repository;
+ protected array $acceptedRoles = [UserRoleEnum::READ_ONLY];
+
+ /**
+ * AccountController constructor.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->middleware(
+ function ($request, $next) {
+ $this->repository = app(CurrencyRepositoryInterface::class);
+ // new way of user group validation
+ $userGroup = $this->validateUserGroup($request);
+ $this->repository->setUserGroup($userGroup);
+
+ return $next($request);
+ }
+ );
+ }
+
+ public function index(IndexRequest $request): JsonResponse
+ {
+ $settings = $request->getAll();
+ if(true === $settings['enabled']) {
+ $currencies = $this->repository->get();
+ }
+ if(true !== $settings['enabled']) {
+ $currencies = $this->repository->getAll();
+ }
+
+ $pageSize = $this->parameters->get('limit');
+ $count = $currencies->count();
+
+ // depending on the sort parameters, this list must not be split, because the
+ // order is calculated in the account transformer and by that time it's too late.
+ $accounts = $currencies->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
+ $paginator = new LengthAwarePaginator($accounts, $count, $pageSize, $this->parameters->get('page'));
+ $transformer = new CurrencyTransformer();
+
+ $this->parameters->set('pageSize', $pageSize);
+ $transformer->setParameters($this->parameters); // give params to transformer
+
+ return response()
+ ->json($this->jsonApiList(self::RESOURCE_KEY, $paginator, $transformer))
+ ->header('Content-Type', self::CONTENT_TYPE);
+ }
+}
diff --git a/app/Api/V2/Request/Model/TransactionCurrency/IndexRequest.php b/app/Api/V2/Request/Model/TransactionCurrency/IndexRequest.php
new file mode 100644
index 0000000000..4984d7f5c0
--- /dev/null
+++ b/app/Api/V2/Request/Model/TransactionCurrency/IndexRequest.php
@@ -0,0 +1,65 @@
+<?php
+
+/*
+ * IndexRequest.php
+ * Copyright (c) 2024 [email protected].
+ *
+ * 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/.
+ */
+
+declare(strict_types=1);
+
+namespace FireflyIII\Api\V2\Request\Model\TransactionCurrency;
+
+use Carbon\Carbon;
+use FireflyIII\Support\Http\Api\AccountFilter;
+use FireflyIII\Support\Request\ChecksLogin;
+use FireflyIII\Support\Request\ConvertsDataTypes;
+use FireflyIII\Support\Request\GetFilterInstructions;
+use FireflyIII\Support\Request\GetSortInstructions;
+use Illuminate\Foundation\Http\FormRequest;
+
+/**
+ * Class IndexRequest
+ *
+ * Lots of code stolen from the SingleDateRequest.
+ */
+class IndexRequest extends FormRequest
+{
+ use AccountFilter;
+ use ChecksLogin;
+ use ConvertsDataTypes;
+ use GetFilterInstructions;
+ use GetSortInstructions;
+
+ public function getAll(): array
+ {
+ return [
+ 'enabled' => $this->convertBoolean($this->get('enabled')),
+ ];
+ }
+
+ /**
+ * The rules that the incoming request must be matched against.
+ */
+ public function rules(): array
+ {
+ return [
+ 'enabled' => 'nullable|boolean',
+ ];
+
+ }
+}
diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php
index c0e4cd0db4..f66fc0dbd2 100644
--- a/app/Repositories/Currency/CurrencyRepository.php
+++ b/app/Repositories/Currency/CurrencyRepository.php
@@ -90,6 +90,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
return CurrencyExchangeRate::create(
[
'user_id' => $this->user->id,
+ 'user_group_id' => $this->user->user_group_id,
'from_currency_id' => $fromCurrency->id,
'to_currency_id' => $toCurrency->id,
'date' => $date,
diff --git a/config/translations.php b/config/translations.php
index 3017b488ae..f98060e92e 100644
--- a/config/translations.php
+++ b/config/translations.php
@@ -270,6 +270,9 @@ return [
'response',
'visit_webhook_url',
'reset_webhook_secret',
+ 'header_exchange_rates',
+ 'exchange_rates_intro',
+ 'exchange_rates_from_to'
],
'form' => [
'url',
diff --git a/resources/assets/v1/mix-manifest.json b/resources/assets/v1/mix-manifest.json
index db8d5e4037..563436036e 100644
--- a/resources/assets/v1/mix-manifest.json
+++ b/resources/assets/v1/mix-manifest.json
@@ -8,14 +8,21 @@
"/build/webhooks/create.js": "/build/webhooks/create.js",
"/build/webhooks/edit.js": "/build/webhooks/edit.js",
"/build/webhooks/show.js": "/build/webhooks/show.js",
+ "/build/exchange-rates/index.js": "/build/exchange-rates/index.js",
"/public/v1/js/app.js": "/public/v1/js/app.js",
"/public/v1/js/app.js.LICENSE.txt": "/public/v1/js/app.js.LICENSE.txt",
"/public/v1/js/app_vue.js": "/public/v1/js/app_vue.js",
"/public/v1/js/app_vue.js.LICENSE.txt": "/public/v1/js/app_vue.js.LICENSE.txt",
+ "/public/v1/js/create.js": "/public/v1/js/create.js",
+ "/public/v1/js/create.js.LICENSE.txt": "/public/v1/js/create.js.LICENSE.txt",
"/public/v1/js/create_transaction.js": "/public/v1/js/create_transaction.js",
"/public/v1/js/create_transaction.js.LICENSE.txt": "/public/v1/js/create_transaction.js.LICENSE.txt",
+ "/public/v1/js/edit.js": "/public/v1/js/edit.js",
+ "/public/v1/js/edit.js.LICENSE.txt": "/public/v1/js/edit.js.LICENSE.txt",
"/public/v1/js/edit_transaction.js": "/public/v1/js/edit_transaction.js",
"/public/v1/js/edit_transaction.js.LICENSE.txt": "/public/v1/js/edit_transaction.js.LICENSE.txt",
+ "/public/v1/js/exchange-rates/index.js": "/public/v1/js/exchange-rates/index.js",
+ "/public/v1/js/exchange-rates/index.js.LICENSE.txt": "/public/v1/js/exchange-rates/index.js.LICENSE.txt",
"/public/v1/js/ff/accounts/create.js": "/public/v1/js/ff/accounts/create.js",
"/public/v1/js/ff/accounts/edit-reconciliation.js": "/public/v1/js/ff/accounts/edit-reconciliation.js",
"/public/v1/js/ff/accounts/edit.js": "/public/v1/js/ff/accounts/edit.js",
@@ -84,6 +91,8 @@
"/public/v1/js/ff/transactions/mass/edit-bulk.js": "/public/v1/js/ff/transactions/mass/edit-bulk.js",
"/public/v1/js/ff/transactions/mass/edit.js": "/public/v1/js/ff/transactions/mass/edit.js",
"/public/v1/js/ff/transactions/show.js": "/public/v1/js/ff/transactions/show.js",
+ "/public/v1/js/index.js": "/public/v1/js/index.js",
+ "/public/v1/js/index.js.LICENSE.txt": "/public/v1/js/index.js.LICENSE.txt",
"/public/v1/js/lib/Chart.bundle.min.js": "/public/v1/js/lib/Chart.bundle.min.js",
"/public/v1/js/lib/accounting.min.js": "/public/v1/js/lib/accounting.min.js",
"/public/v1/js/lib/bootstrap-multiselect.js": "/public/v1/js/lib/bootstrap-multiselect.js",
@@ -142,6 +151,8 @@
"/public/v1/js/lib/vue.js": "/public/v1/js/lib/vue.js",
"/public/v1/js/profile.js": "/public/v1/js/profile.js",
"/public/v1/js/profile.js.LICENSE.txt": "/public/v1/js/profile.js.LICENSE.txt",
+ "/public/v1/js/show.js": "/public/v1/js/show.js",
+ "/public/v1/js/show.js.LICENSE.txt": "/public/v1/js/show.js.LICENSE.txt",
"/public/v1/js/webhooks/create.js": "/public/v1/js/webhooks/create.js",
"/public/v1/js/webhooks/create.js.LICENSE.txt": "/public/v1/js/webhooks/create.js.LICENSE.txt",
"/public/v1/js/webhooks/edit.js": "/public/v1/js/webhooks/edit.js",
diff --git a/resources/assets/v1/src/components/exchange-rates/Index.vue b/resources/assets/v1/src/components/exchange-rates/Index.vue
new file mode 100644
index 0000000000..31a99cfb0e
--- /dev/null
+++ b/resources/assets/v1/src/components/exchange-rates/Index.vue
@@ -0,0 +1,97 @@
+<!--
+ - Index.vue
+ - Copyright (c) 2022 [email protected]
+ -
+ - 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/>.
+ -->
+
+<template>
+ <div>
+ <div class="row">
+ <div class="col-lg-8 col-lg-offset-2 col-md-12 col-sm-12 col-xs-12">
+ <div class="box box-primary">
+ <div class="box-header with-border">
+ <h3 class="box-title">{{ $t('firefly.header_exchange_rates') }}</h3>
+ </div>
+ <div class="box-body">
+ <p>
+ {{ $t('firefly.exchange_rates_intro') }}
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-lg-8 col-lg-offset-2 col-md-12 col-sm-12 col-xs-12">
+ <div class="box box-default" v-for="currency in currencies" :key="currency.id">
+ <div class="box-header with-border">
+ <h3 class="box-title">{{ currency.name }}</h3>
+ </div>
+ <div class="box-body">
+ <ul v-if="currencies.length > 0">
+ <li v-for="sub in currencies" :key="sub.id" v-show="sub.id !== currency.id">
+ <a :href="'exchange-rates/' + currency.code + '/' + sub.code" :title="$t('firefly.exchange_rates_from_to', {from: currency.name, to: sub.name})">{{ $t('firefly.exchange_rates_from_to', {from: currency.name, to: sub.name}) }}</a>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script>
+export default {
+ name: "Index",
+ data() {
+ return {
+ currencies: [],
+ };
+ },
+ mounted() {
+ this.getCurrencies();
+ },
+ methods: {
+ getCurrencies: function () {
+ this.currencies = [];
+ this.downloadCurrencies(1);
+ },
+ downloadCurrencies: function (page) {
+ axios.get("./api/v2/currencies?enabled=1&page=" + page).then((response) => {
+ for (let i in response.data.data) {
+ if (response.data.data.hasOwnProperty(i)) {
+ let current = response.data.data[i];
+ let currency = {
+ id: current.id,
+ name: current.attributes.name,
+ code: current.attributes.code,
+ };
+ this.currencies.push(currency);
+ }
+ }
+
+ if (response.data.meta.pagination.current_page < response.data.meta.pagination.total_pages) {
+ this.downloadCurrencies(parseInt(response.data.meta.pagination.current_page) + 1);
+ }
+ });
+ },
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
diff --git a/resources/assets/v1/src/exchange-rates/index.js b/resources/assets/v1/src/exchange-rates/index.js
new file mode 100644
index 0000000000..1545bf2f44
--- /dev/null
+++ b/resources/assets/v1/src/exchange-rates/index.js
@@ -0,0 +1,39 @@
+/*
+ * edit_transactions.js
+ * Copyright (c) 2019 [email protected]
+ *
+ * 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/>.
+ */
+
+import Index from "../components/exchange-rates/Index";
+
+/**
+ * First we will load Axios via bootstrap.js
+ * jquery and bootstrap-sass preloaded in app.js
+ * vue, uiv and vuei18n are in app_vue.js
+ */
+
+require('../bootstrap');
+const i18n = require('../i18n');
+
+let props = {};
+const app = new Vue({
+ i18n,
+ el: "#exchange_rates_index",
+ render: (createElement) => {
+ return createElement(Index, {props: props})
+ },
+});
diff --git a/resources/assets/v1/src/locales/.json b/resources/assets/v1/src/locales/.json
new file mode 100644
index 0000000000..0637a088a0
--- /dev/null
+++ b/resources/assets/v1/src/locales/.json
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/resources/assets/v1/src/locales/en.json b/resources/assets/v1/src/locales/en.json
index e41ff89456..1517f83aa4 100644
--- a/resources/assets/v1/src/locales/en.json
+++ b/resources/assets/v1/src/locales/en.json
@@ -129,7 +129,10 @@
"logs": "Logs",
"response": "Response",
"visit_webhook_url": "Visit webhook URL",
- "reset_webhook_secret": "Reset webhook secret"
+ "reset_webhook_secret": "Reset webhook secret",
+ "header_exchange_rates": "Exchange rates",
+ "exchange_rates_intro": "Firefly III supports downloading and using exchange rates. Read more about this in <a href=\"https:\/\/docs.firefly-iii.org\/LOL_NOT_FINISHED_YET_TODO\">the documentation<\/a>.",
+ "exchange_rates_from_to": "Between {from} and {to}"
},
"form": {
"url": "URL",
diff --git a/resources/assets/v1/webpack.mix.js b/resources/assets/v1/webpack.mix.js
index bea3d693cf..ae305aa76d 100644
--- a/resources/assets/v1/webpack.mix.js
+++ b/resources/assets/v1/webpack.mix.js
@@ -46,3 +46,6 @@ mix.js('src/webhooks/index.js', 'build/webhooks').vue({version: 2});
mix.js('src/webhooks/create.js', 'build/webhooks').vue({version: 2});
mix.js('src/webhooks/edit.js', 'build/webhooks').vue({version: 2});
mix.js('src/webhooks/show.js', 'build/webhooks').vue({version: 2}).copy('build','../../../public/v1/js')
+
+// exchange rates
+mix.js('src/exchange-rates/index.js', 'build/exchange-rates').vue({version: 2});
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index fa0cb6b42b..616b6124d1 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -1398,6 +1398,7 @@ return [
'menu_exchange_rates_index' => 'Exchange rates',
'header_exchange_rates' => 'Exchange rates',
'exchange_rates_intro' =>'Firefly III supports downloading and using exchange rates. Read more about this in <a href="https://docs.firefly-iii.org/LOL_NOT_FINISHED_YET_TODO">the documentation</a>.',
+ 'exchange_rates_from_to' => 'Between {from} and {to}',
// Financial administrations
'administration_index' => 'Financial administration',
diff --git a/resources/views/exchange-rates/index.twig b/resources/views/exchange-rates/index.twig
index 6bab169fd7..8d51135202 100644
--- a/resources/views/exchange-rates/index.twig
+++ b/resources/views/exchange-rates/index.twig
@@ -1,51 +1,12 @@
+{% set VUE_SCRIPT_NAME = 'exchange-rates/index' %}
{% extends './layout/default' %}
-
{% block breadcrumbs %}
- {{ Breadcrumbs.render(Route.getCurrentRoute.getName) }}
+ {{ Breadcrumbs.render(Route.getCurrentRoute.getName, objectType) }}
{% endblock %}
{% block content %}
- <div class="row">
- <div class="col-lg-8 col-lg-offset-2 col-md-12 col-sm-12 col-xs-12">
- <div class="box box-primary">
- <div class="box-header with-border">
- <h3 class="box-title">{{ 'header_exchange_rates'|_ }}</h3>
- </div>
- <div class="box-body">
- <p>
- {{ 'exchange_rates_intro'|_ }}
- </p>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-lg-8 col-lg-offset-2 col-md-12 col-sm-12 col-xs-12">
- {% for currency in currencies %}
- <div class="box box-default">
- <div class="box-header with-border">
- <h3 class="box-title">{{ currency.name }}</h3>
- </div>
- <div class="box-body">
- {% if currencies.count > 0 %}
- <ul>
- {% for sub in currencies %}
- {% if sub.id != currency.id %}
- <li>From {{ currency.name }} to {{ sub.name }}</li>
- {% endif %}
- {% endfor %}
- </ul>
- {% endif %}
- </div>
- </div>
- {% endfor %}
- </div>
- </div>
-
-{% endblock %}
-
-{% block styles %}
+ <div id="exchange_rates_index"></div>
{% endblock %}
-
{% block scripts %}
+
{% endblock %}
diff --git a/resources/views/partials/menu-sidebar.twig b/resources/views/partials/menu-sidebar.twig
index c9443ff939..ca77379ff6 100644
--- a/resources/views/partials/menu-sidebar.twig
+++ b/resources/views/partials/menu-sidebar.twig
@@ -219,13 +219,13 @@
<span>{{ 'currencies'|_ }}</span>
</a>
</li>
+ <li class="{{ activeRoutePartial('exchange-rates') }}">
+ <a class="{{ activeRoutePartial('exchange-rates') }}" href="{{ route('exchange-rates.index') }}">
+ <span class="fa fa-angle-right fa-fw"></span>
+ <span>{{ 'menu_exchange_rates_index'|_ }}</span>
+ </a>
+ </li>
{% if hasRole('owner') %}
- <li class="{{ activeRoutePartial('exchange-rates') }}">
- <a class="{{ activeRoutePartial('exchange-rates') }}" href="{{ route('exchange-rates.index') }}">
- <span class="fa fa-angle-right fa-fw"></span>
- <span>{{ 'menu_exchange_rates_index'|_ }}</span>
- </a>
- </li>
<li class="{{ activeRoutePartial('admin') }}">
<a class="{{ activeRoutePartial('admin') }}" href="{{ route('admin.index') }}">
<span class="fa fa-angle-right fa-fw"></span>
diff --git a/routes/api.php b/routes/api.php
index ec16affdd9..1c1e082f59 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -86,159 +86,177 @@ Route::group(
}
);
-// V2 API route for Summary boxes
-// BASIC
+// CURRENCY ROUTES
Route::group(
[
- 'namespace' => 'FireflyIII\Api\V2\Controllers\Summary',
- 'prefix' => 'v2/summary',
- 'as' => 'api.v2.summary.',
+ 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\TransactionCurrency',
+ 'prefix' => 'v2/currencies',
+ 'as' => 'api.v2.currencies.',
],
static function (): void {
- // Route::get('basic', ['uses' => 'BasicController@basic', 'as' => 'basic']);
+ Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
+// Route::post('', ['uses' => 'StoreController@store', 'as' => 'store']);
+// Route::get('{userGroup}', ['uses' => 'ShowController@show', 'as' => 'show']);
+ // Route::put('{userGroup}', ['uses' => 'UpdateController@update', 'as' => 'update']);
+ // Route::post('{userGroup}/use', ['uses' => 'UpdateController@useUserGroup', 'as' => 'use']);
+ // Route::put('{userGroup}/update-membership', ['uses' => 'UpdateController@updateMembership', 'as' => 'updateMembership']);
+ // Route::delete('{userGroup}', ['uses' => 'DestroyController@destroy', 'as' => 'destroy']);
}
);
-// V2 API route for all kinds of Transaction lists.
-// A lot of endpoints involve transactions. So any time Firefly III needs to list transactions
-// it's coming from these endpoints.
-Route::group(
- [
- 'namespace' => 'FireflyIII\Api\V2\Controllers\Transaction\List',
- 'prefix' => 'v2',
- 'as' => 'api.v2.',
- ],
- static function (): void {
- // basic list
- // Route::get('transactions', ['uses' => 'TransactionController@list', 'as' => 'transactions.list']);
- // list by parent or related object.
- // note how the check is done on the user group, not the user itself.
- // Route::get('accounts/{userGroupAccount}/transactions', ['uses' => 'AccountController@list', 'as' => 'accounts.transactions']);
- }
-);
+// V2 API route for Summary boxes
+// BASIC
+//Route::group(
+// [
+// 'namespace' => 'FireflyIII\Api\V2\Controllers\Summary',
+// 'prefix' => 'v2/summary',
+// 'as' => 'api.v2.summary.',
+// ],
+// static function (): void {
+// // Route::get('basic', ['uses' => 'BasicController@basic', 'as' => 'basic']);
+// }
+//);
+//// V2 API route for all kinds of Transaction lists.
+//// A lot of endpoints involve transactions. So any time Firefly III needs to list transactions
+//// it's coming from these endpoints.
+//Route::group(
+// [
+// 'namespace' => 'FireflyIII\Api\V2\Controllers\Transaction\List',
+// 'prefix' => 'v2',
+// 'as' => 'api.v2.',
+// ],
+// static function (): void {
+// // basic list
+// // Route::get('transactions', ['uses' => 'TransactionController@list', 'as' => 'transactions.list']);
+//
+// // list by parent or related object.
+// // note how the check is done on the user group, not the user itself.
+// // Route::get('accounts/{userGroupAccount}/transactions', ['uses' => 'AccountController@list', 'as' => 'accounts.transactions']);
+// }
+//);
// V2 API routes for auto complete
-
-// V2 API route for net worth endpoint(s);
-Route::group(
- [
- 'namespace' => 'FireflyIII\Api\V2\Controllers\Summary',
- 'prefix' => 'v2/net-worth',
- 'as' => 'api.v2.net-worth.',
- ],
- static function (): void {
- // Route::get('', ['uses' => 'NetWorthController@get', 'as' => 'index']);
- }
-);
-
-// // V2 API route for accounts.
-// Route::group(
+//
+//// V2 API route for net worth endpoint(s);
+//Route::group(
// [
-// 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Account',
-// 'prefix' => 'v2/accounts',
-// 'as' => 'api.v2.accounts.',
+// 'namespace' => 'FireflyIII\Api\V2\Controllers\Summary',
+// 'prefix' => 'v2/net-worth',
+// 'as' => 'api.v2.net-worth.',
// ],
// 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']);
+// // Route::get('', ['uses' => 'NetWorthController@get', 'as' => 'index']);
// }
-// );
-
-// V2 API route for subscriptions.
-Route::group(
- [
- 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Bill',
- 'prefix' => 'v2/subscriptions',
- 'as' => 'api.v2.subscriptions.',
- ],
- static function (): void {
- // Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
- // Route::get('{userGroupBill}', ['uses' => 'ShowController@show', 'as' => 'show']);
- // Route::get('sum/paid', ['uses' => 'SumController@paid', 'as' => 'sum.paid']);
- // Route::get('sum/unpaid', ['uses' => 'SumController@unpaid', 'as' => 'sum.unpaid']);
- }
-);
-
-// V2 API route for piggy banks.
-Route::group(
- [
- 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\PiggyBank',
- 'prefix' => 'v2/piggy-banks',
- 'as' => 'api.v2.piggy-banks.',
- ],
- static function (): void {
- // Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
- }
-);
-
-// V2 API route for transaction currencies
-Route::group(
- [
- 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Currency',
- 'prefix' => 'v2/currencies',
- 'as' => 'api.v2.currencies.',
- ],
- static function (): void {
- // Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
- }
-);
-
-// V2 API route for transactions
-Route::group(
- [
- 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Transaction',
- 'prefix' => 'v2/transactions',
- 'as' => 'api.v2.transactions.',
- ],
- static function (): void {
- // Route::post('', ['uses' => 'StoreController@post', 'as' => 'store']);
- // Route::get('{userGroupTransaction}', ['uses' => 'ShowController@show', 'as' => 'show']);
- // Route::put('{userGroupTransaction}', ['uses' => 'UpdateController@update', 'as' => 'update']);
- }
-);
-// infinite (transactions) list:
-Route::group(
- [
- 'namespace' => 'FireflyIII\Api\V2\Controllers\Transaction\List',
- 'prefix' => 'v2/infinite/transactions',
- 'as' => 'api.v2.infinite.transactions.',
- ],
- static function (): void {
- // Route::get('', ['uses' => 'TransactionController@infiniteList', 'as' => 'list']);
- }
-);
-
-// V2 API route for budgets and budget limits:
-Route::group(
- [
- 'namespace' => 'FireflyIII\Api\V2\Controllers\Model',
- 'prefix' => 'v2/budgets',
- 'as' => 'api.v2.budgets',
- ],
- static function (): void {
- // Route::get('', ['uses' => 'Budget\IndexController@index', 'as' => 'index']);
- // Route::get('{budget}', ['uses' => 'Budget\ShowController@show', 'as' => 'show']);
- // Route::get('{budget}/limits', ['uses' => 'BudgetLimit\IndexController@index', 'as' => 'budget-limits.index']);
- // Route::get('sum/budgeted', ['uses' => 'Budget\SumController@budgeted', 'as' => 'sum.budgeted']);
- // Route::get('sum/spent', ['uses' => 'Budget\SumController@spent', 'as' => 'sum.spent']);
- // Route::get('{budget}/budgeted', ['uses' => 'Budget\ShowController@budgeted', 'as' => 'budget.budgeted']);
- // Route::get('{budget}/spent', ['uses' => 'Budget\ShowController@spent', 'as' => 'budget.spent']);
- }
-);
-
-// V2 API route for system
-Route::group(
- [
- 'namespace' => 'FireflyIII\Api\V2\Controllers\System',
- 'prefix' => 'v2',
- 'as' => 'api.v2.system.',
- ],
- static function (): void {
- // Route::get('preferences/{preference}', ['uses' => 'PreferencesController@get', 'as' => 'preferences.get']);
- }
-);
-
+//);
+//
+//// // 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(
+// [
+// 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Bill',
+// 'prefix' => 'v2/subscriptions',
+// 'as' => 'api.v2.subscriptions.',
+// ],
+// static function (): void {
+// // Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
+// // Route::get('{userGroupBill}', ['uses' => 'ShowController@show', 'as' => 'show']);
+// // Route::get('sum/paid', ['uses' => 'SumController@paid', 'as' => 'sum.paid']);
+// // Route::get('sum/unpaid', ['uses' => 'SumController@unpaid', 'as' => 'sum.unpaid']);
+// }
+//);
+//
+//// V2 API route for piggy banks.
+//Route::group(
+// [
+// 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\PiggyBank',
+// 'prefix' => 'v2/piggy-banks',
+// 'as' => 'api.v2.piggy-banks.',
+// ],
+// static function (): void {
+// // Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
+// }
+//);
+//
+//// V2 API route for transaction currencies
+//Route::group(
+// [
+// 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Currency',
+// 'prefix' => 'v2/currencies',
+// 'as' => 'api.v2.currencies.',
+// ],
+// static function (): void {
+// // Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
+// }
+//);
+//
+//// V2 API route for transactions
+//Route::group(
+// [
+// 'namespace' => 'FireflyIII\Api\V2\Controllers\Model\Transaction',
+// 'prefix' => 'v2/transactions',
+// 'as' => 'api.v2.transactions.',
+// ],
+// static function (): void {
+// // Route::post('', ['uses' => 'StoreController@post', 'as' => 'store']);
+// // Route::get('{userGroupTransaction}', ['uses' => 'ShowController@show', 'as' => 'show']);
+// // Route::put('{userGroupTransaction}', ['uses' => 'UpdateController@update', 'as' => 'update']);
+// }
+//);
+//// infinite (transactions) list:
+//Route::group(
+// [
+// 'namespace' => 'FireflyIII\Api\V2\Controllers\Transaction\List',
+// 'prefix' => 'v2/infinite/transactions',
+// 'as' => 'api.v2.infinite.transactions.',
+// ],
+// static function (): void {
+// // Route::get('', ['uses' => 'TransactionController@infiniteList', 'as' => 'list']);
+// }
+//);
+//
+//// V2 API route for budgets and budget limits:
+//Route::group(
+// [
+// 'namespace' => 'FireflyIII\Api\V2\Controllers\Model',
+// 'prefix' => 'v2/budgets',
+// 'as' => 'api.v2.budgets',
+// ],
+// static function (): void {
+// // Route::get('', ['uses' => 'Budget\IndexController@index', 'as' => 'index']);
+// // Route::get('{budget}', ['uses' => 'Budget\ShowController@show', 'as' => 'show']);
+// // Route::get('{budget}/limits', ['uses' => 'BudgetLimit\IndexController@index', 'as' => 'budget-limits.index']);
+// // Route::get('sum/budgeted', ['uses' => 'Budget\SumController@budgeted', 'as' => 'sum.budgeted']);
+// // Route::get('sum/spent', ['uses' => 'Budget\SumController@spent', 'as' => 'sum.spent']);
+// // Route::get('{budget}/budgeted', ['uses' => 'Budget\ShowController@budgeted', 'as' => 'budget.budgeted']);
+// // Route::get('{budget}/spent', ['uses' => 'Budget\ShowController@spent', 'as' => 'budget.spent']);
+// }
+//);
+//
+//// V2 API route for system
+//Route::group(
+// [
+// 'namespace' => 'FireflyIII\Api\V2\Controllers\System',
+// 'prefix' => 'v2',
+// 'as' => 'api.v2.system.',
+// ],
+// static function (): void {
+// // Route::get('preferences/{preference}', ['uses' => 'PreferencesController@get', 'as' => 'preferences.get']);
+// }
+//);
+//
// V2 JSON API ROUTES