mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 02:26:58 +00:00
First page for currency exchange rates.
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* IndexController.php
|
||||
* Copyright (c) 2024 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/.
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* IndexRequest.php
|
||||
* Copyright (c) 2024 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/.
|
||||
*/
|
||||
|
||||
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',
|
||||
];
|
||||
|
||||
}
|
||||
}
|
@@ -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,
|
||||
|
@@ -270,6 +270,9 @@ return [
|
||||
'response',
|
||||
'visit_webhook_url',
|
||||
'reset_webhook_secret',
|
||||
'header_exchange_rates',
|
||||
'exchange_rates_intro',
|
||||
'exchange_rates_from_to'
|
||||
],
|
||||
'form' => [
|
||||
'url',
|
||||
|
@@ -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",
|
||||
|
97
resources/assets/v1/src/components/exchange-rates/Index.vue
Normal file
97
resources/assets/v1/src/components/exchange-rates/Index.vue
Normal file
@@ -0,0 +1,97 @@
|
||||
<!--
|
||||
- Index.vue
|
||||
- Copyright (c) 2022 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/>.
|
||||
-->
|
||||
|
||||
<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>
|
39
resources/assets/v1/src/exchange-rates/index.js
Normal file
39
resources/assets/v1/src/exchange-rates/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* edit_transactions.js
|
||||
* Copyright (c) 2019 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/>.
|
||||
*/
|
||||
|
||||
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})
|
||||
},
|
||||
});
|
1
resources/assets/v1/src/locales/.json
Normal file
1
resources/assets/v1/src/locales/.json
Normal file
@@ -0,0 +1 @@
|
||||
[]
|
@@ -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",
|
||||
|
@@ -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});
|
||||
|
@@ -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',
|
||||
|
@@ -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>
|
||||
|
||||
<div id="exchange_rates_index"></div>
|
||||
{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
{% endblock %}
|
||||
|
@@ -219,13 +219,13 @@
|
||||
<span>{{ 'currencies'|_ }}</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>
|
||||
{% if hasRole('owner') %}
|
||||
<li class="{{ activeRoutePartial('admin') }}">
|
||||
<a class="{{ activeRoutePartial('admin') }}" href="{{ route('admin.index') }}">
|
||||
<span class="fa fa-angle-right fa-fw"></span>
|
||||
|
304
routes/api.php
304
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.',
|
||||
],
|
||||
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(
|
||||
// [
|
||||
// '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',
|
||||
'namespace' => 'FireflyIII\Api\V2\Controllers\Model\TransactionCurrency',
|
||||
'prefix' => 'v2/currencies',
|
||||
'as' => 'api.v2.currencies.',
|
||||
],
|
||||
static function (): void {
|
||||
// Route::get('', ['uses' => 'IndexController@index', 'as' => 'index']);
|
||||
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 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 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(
|
||||
//// [
|
||||
//// '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
|
||||
|
Reference in New Issue
Block a user