From f89bed25da1cd92b242c72039417ab2bbd252da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Mon, 1 May 2023 19:15:45 +0200 Subject: [PATCH 1/8] RVRNEXT-6 update soko-web --- composer.json | 2 +- composer.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 1f4500f..45d6329 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "esoko/soko-web": "0.7", + "esoko/soko-web": "0.8", "firebase/php-jwt": "^6.4" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 27d420f..e3bd9cf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,15 +4,15 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "71f3adc97b2d83ac1d57112ecce65fac", + "content-hash": "a89a42e04596ab159fc41abbd9390068", "packages": [ { "name": "esoko/soko-web", - "version": "v0.7", + "version": "v0.8", "source": { "type": "git", "url": "https://git.esoko.eu/esoko/soko-web.git", - "reference": "88a2a99527b51dfb240ec78ac7070dc36a1022b6" + "reference": "219b42f995b8e34432da4dde77e53e24b75d78dd" }, "require": { "phpmailer/phpmailer": "^6.8", @@ -33,7 +33,7 @@ "GNU GPL 3.0" ], "description": "Lightweight web framework", - "time": "2023-04-30T18:20:27+00:00" + "time": "2023-05-01T17:08:22+00:00" }, { "name": "firebase/php-jwt", -- 2.45.2 From 2ed01df3315fa00b9ba819a4d8836c9069b7c830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Mon, 1 May 2023 19:18:48 +0200 Subject: [PATCH 2/8] RVRNEXT-6 layout fine-tuning --- public/static/css/rvr.css | 52 +++++++++++++++++-- views/account/account.php | 2 +- views/account/google_authenticate.php | 2 +- views/communities/community_currencies.php | 7 ++- views/communities/community_edit.php | 5 +- views/communities/community_members.php | 7 ++- views/communities/currency_exchange_rates.php | 7 ++- views/login/google_login_error.php | 2 +- views/login/login.php | 2 +- views/login/password_reset_request.php | 2 +- .../login/password_reset_request_success.php | 2 +- views/login/reset_password.php | 2 +- views/oauth/oauth_error.php | 2 +- 13 files changed, 75 insertions(+), 19 deletions(-) diff --git a/public/static/css/rvr.css b/public/static/css/rvr.css index ec9c086..b1bb9a9 100644 --- a/public/static/css/rvr.css +++ b/public/static/css/rvr.css @@ -31,6 +31,10 @@ main { color: #ffffff; } +::placeholder, select > option[value=""] { + color: #8e8e8e; +} + p, h1, h2, h3, input, textarea, select, button, a, table, label { font-family: 'Oxygen', sans-serif; } @@ -150,6 +154,12 @@ a:hover, a:focus { text-decoration: underline; } +a.block { + color: initial; + font-weight: initial; + text-decoration: initial; +} + button, a.button { cursor: pointer; font-size: 16px; @@ -421,7 +431,6 @@ div.buttonContainer>button { } div.box { - width: 576px; background-color: #eeeef4; border-radius: 3px; margin: 10px auto; @@ -429,6 +438,15 @@ div.box { box-sizing: border-box; } +div.compactBox { + width: 576px; +} + +div.transaction { + display: grid; + grid-template-columns: auto auto; +} + div.gridContainer { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); @@ -451,7 +469,7 @@ table.fullWidth { } table th { - font-weight: bold; + font-weight: 700; } table th, table td { @@ -467,6 +485,34 @@ table th:not(:last-child), table td:not(:last-child) { padding-right: 3px; } +p.paginateContainer { + font-size: 0; +} + +p.paginateContainer > * { + font-size: initial; + background-color: #5e77aa; + border: solid #5e77aa 1px; + color: #ffffff; + font-weight: 700; + padding: 3px 6px; + text-align: center; + display: inline-block; + height: 25px; + line-height: 25px; + width: 25px; +} + +p.paginateContainer > a:hover, p.paginateContainer > .selected { + background-color: #3b5998; + border: solid #29457f 1px; + text-decoration: none; +} + +p.paginateContainer > *:not(:last-child) { + border-right: solid #869ab9 1px; +} + .choices__inner { box-sizing: border-box; } @@ -501,7 +547,7 @@ table th:not(:last-child), table td:not(:last-child) { padding-left: 15px; padding-right: 15px; } - div.box { + div.compactBox { width: initial; } } diff --git a/views/account/account.php b/views/account/account.php index f414387..10eb87a 100644 --- a/views/account/account.php +++ b/views/account/account.php @@ -4,7 +4,7 @@ @section(main)

Account

-
+

Please confirm your identity with your password or with Google to modify your account.

diff --git a/views/account/google_authenticate.php b/views/account/google_authenticate.php index e265437..51fc72f 100644 --- a/views/account/google_authenticate.php +++ b/views/account/google_authenticate.php @@ -5,7 +5,7 @@ @section(main)

Authenticate with Google

-
+

diff --git a/views/communities/community_currencies.php b/views/communities/community_currencies.php index 27b1d95..36ad30c 100644 --- a/views/communities/community_currencies.php +++ b/views/communities/community_currencies.php @@ -1,8 +1,11 @@ @extends(templates/layout_normal) @section(main) -

getName() ?> - Edit currencies

-
+

+ getName() ?> » + Edit currencies +

+
diff --git a/views/communities/community_edit.php b/views/communities/community_edit.php index d7e08f7..07fbd0b 100644 --- a/views/communities/community_edit.php +++ b/views/communities/community_edit.php @@ -3,12 +3,13 @@ @section(main)

- getName() ?> - Edit + getName() ?> » + Edit New community

-
+
getRoute('community-edit-action')->generateLink(['communityId' => $community->getId()]) : diff --git a/views/communities/community_members.php b/views/communities/community_members.php index a793be4..4818b1b 100644 --- a/views/communities/community_members.php +++ b/views/communities/community_members.php @@ -5,8 +5,11 @@ @extends(templates/layout_normal) @section(main) -

getName() ?> - Edit members

-
+

+ getName() ?> » + Edit members +

+
diff --git a/views/communities/currency_exchange_rates.php b/views/communities/currency_exchange_rates.php index 60f0fe7..b3e73b0 100644 --- a/views/communities/currency_exchange_rates.php +++ b/views/communities/currency_exchange_rates.php @@ -1,8 +1,11 @@ @extends(templates/layout_normal) @section(main) -

getName() ?> - Exchange rates for getCode() ?>

-
+

+ getName() ?> » + Exchange rates for getCode() ?> +

+
diff --git a/views/login/google_login_error.php b/views/login/google_login_error.php index 9f6bf73..f68648b 100644 --- a/views/login/google_login_error.php +++ b/views/login/google_login_error.php @@ -2,7 +2,7 @@ @section(main)

Login up with Google

-
+

@endsection diff --git a/views/login/login.php b/views/login/login.php index 5b27647..cd98f3b 100644 --- a/views/login/login.php +++ b/views/login/login.php @@ -2,7 +2,7 @@ @section(main)

Login

-
+
diff --git a/views/login/password_reset_request.php b/views/login/password_reset_request.php index 7ae9410..779aa71 100644 --- a/views/login/password_reset_request.php +++ b/views/login/password_reset_request.php @@ -4,7 +4,7 @@ @section(main)

Request password reset

-
+
diff --git a/views/login/password_reset_request_success.php b/views/login/password_reset_request_success.php index 4e2eb1e..0c9ed09 100644 --- a/views/login/password_reset_request_success.php +++ b/views/login/password_reset_request_success.php @@ -2,7 +2,7 @@ @section(main)

Request password reset

-
+

Password reset was successfully requested. Please check your email and click on the link to reset your password!

@endsection diff --git a/views/login/reset_password.php b/views/login/reset_password.php index 098ae77..b7059d4 100644 --- a/views/login/reset_password.php +++ b/views/login/reset_password.php @@ -2,7 +2,7 @@ @section(main)

Reset password

-
+
diff --git a/views/oauth/oauth_error.php b/views/oauth/oauth_error.php index 971bdfb..3eedba2 100644 --- a/views/oauth/oauth_error.php +++ b/views/oauth/oauth_error.php @@ -2,7 +2,7 @@ @section(main)

OAuth error

-
+

@endsection -- 2.45.2 From f2d99c4f0fa7067165794c1cbe069f08e9a823da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Mon, 1 May 2023 19:19:10 +0200 Subject: [PATCH 3/8] RVRNEXT-6 add migration for transaction db structure --- .../structure/20230428_2150_transactions.sql | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 database/migrations/structure/20230428_2150_transactions.sql diff --git a/database/migrations/structure/20230428_2150_transactions.sql b/database/migrations/structure/20230428_2150_transactions.sql new file mode 100644 index 0000000..d6f0645 --- /dev/null +++ b/database/migrations/structure/20230428_2150_transactions.sql @@ -0,0 +1,19 @@ +CREATE TABLE `transactions` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `community_id` int(10) unsigned NOT NULL, + `currency_id` int(10) unsigned NOT NULL, + `payer_user_id` int(10) unsigned NOT NULL, + `payee_user_id` int(10) unsigned NULL, + `description` varchar(255) NOT NULL, + `sum` decimal(19,9) NOT NULL, + `time` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `community_id` (`community_id`), + KEY `currency_id` (`currency_id`), + KEY `payer_user_id` (`payer_user_id`), + KEY `payee_user_id` (`payee_user_id`), + CONSTRAINT `transactions_community_id` FOREIGN KEY (`community_id`) REFERENCES `communities` (`id`), + CONSTRAINT `transactions_currency_id` FOREIGN KEY (`currency_id`) REFERENCES `currencies` (`id`), + CONSTRAINT `transactions_payer_user_id` FOREIGN KEY (`payer_user_id`) REFERENCES `users` (`id`), + CONSTRAINT `transactions_payee_user_id` FOREIGN KEY (`payee_user_id`) REFERENCES `users` (`id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; -- 2.45.2 From 67114211ec3ae79bedc635aa0da9c610bf028fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Mon, 1 May 2023 19:19:39 +0200 Subject: [PATCH 4/8] RVRNEXT-6 add model and repository for transactions --- src/PersistentData/Model/Transaction.php | 160 +++++++++++++++++++++++ src/Repository/TransactionRepository.php | 44 +++++++ 2 files changed, 204 insertions(+) create mode 100644 src/PersistentData/Model/Transaction.php create mode 100644 src/Repository/TransactionRepository.php diff --git a/src/PersistentData/Model/Transaction.php b/src/PersistentData/Model/Transaction.php new file mode 100644 index 0000000..a4a9b48 --- /dev/null +++ b/src/PersistentData/Model/Transaction.php @@ -0,0 +1,160 @@ + Community::class, + 'currency' => Currency::class, + 'payer_user' => User::class, + 'payee_user' => User::class + ]; + + private ?Community $community = null; + + private int $communityId; + + private ?Currency $currency = null; + + private int $currencyId; + + private ?User $payerUser = null; + + private int $payerUserId; + + private ?User $payeeUser = null; + + private ?int $payeeUserId = null; + + private string $description = ''; + + private float $sum = 0.0; + + private DateTime $time; + + public function setCommunity(Community $community): void + { + $this->community = $community; + } + + public function setCommunityId(int $communityId): void + { + $this->communityId = $communityId; + } + + public function setCurrency(Currency $currency): void + { + $this->currency = $currency; + } + + public function setCurrencyId(int $currencyId): void + { + $this->currencyId = $currencyId; + } + + public function setPayerUser(User $payerUser): void + { + $this->payerUser = $payerUser; + } + + public function setPayerUserId(int $payerUserId): void + { + $this->payerUserId = $payerUserId; + } + + public function setPayeeUser(?User $payeeUser): void + { + $this->payeeUser = $payeeUser; + } + + public function setPayeeUserId(?int $payeeUserId): void + { + $this->payeeUserId = $payeeUserId; + } + + public function setDescription(string $description): void + { + $this->description = $description; + } + + public function setSum(float $sum): void + { + $this->sum = $sum; + } + + public function setTimeDate(DateTime $time): void + { + $this->time = $time; + } + + public function setTime(string $time): void + { + $this->time = new DateTime($time); + } + + public function getCommunity(): ?Community + { + return $this->community; + } + + public function getCommunityId(): int + { + return $this->communityId; + } + + public function getCurrency(): ?Currency + { + return $this->currency; + } + + public function getCurrencyId(): int + { + return $this->currencyId; + } + + public function getPayerUser(): ?User + { + return $this->payerUser; + } + + public function getPayerUserId(): int + { + return $this->payerUserId; + } + + public function getPayeeUser(): ?User + { + return $this->payeeUser; + } + + public function getPayeeUserId(): ?int + { + return $this->payeeUserId; + } + + public function getDescription(): string + { + return $this->description; + } + + public function getSum(): float + { + return $this->sum; + } + + public function getTimeDate(): DateTime + { + return $this->time; + } + + public function getTime(): string + { + return $this->time->format('Y-m-d H:i:s'); + } +} diff --git a/src/Repository/TransactionRepository.php b/src/Repository/TransactionRepository.php new file mode 100644 index 0000000..4ef85bc --- /dev/null +++ b/src/Repository/TransactionRepository.php @@ -0,0 +1,44 @@ +selectFromDbById($id, Transaction::class); + } + + public function getAllByCommunity(Community $community, bool $useRelations = false, array $withRelations = []): Generator + { + $select = $this->selectAllByCommunity($community); + + yield from Container::$persistentDataManager->selectMultipleFromDb($select, Transaction::class, $useRelations, $withRelations); + } + + public function countAllByCommunity(Community $community): int + { + return $this->selectAllByCommunity($community)->count(); + } + + public function getPagedByCommunity(Community $community, int $start, int $limit, bool $useRelations = false, array $withRelations = []): Generator + { + $select = new Select(Container::$dbConnection); + $select->where('community_id', '=', $community->getId()); + $select->orderBy('time', 'DESC'); + $select->limit($limit, $start); + + yield from Container::$persistentDataManager->selectMultipleFromDb($select, Transaction::class, $useRelations, $withRelations); + } + + private function selectAllByCommunity(Community $community) + { + $select = new Select(Container::$dbConnection, Transaction::getTable()); + $select->where('community_id', '=', $community->getId()); + return $select; + } +} -- 2.45.2 From c7c2df89c5312fc1bcf12dffd2c424a15f08a446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Mon, 1 May 2023 19:23:19 +0200 Subject: [PATCH 5/8] RVRNEXT-6 add ExchangeRateCalculator --- src/Finance/ExchangeRateCalculator.php | 52 ++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/Finance/ExchangeRateCalculator.php diff --git a/src/Finance/ExchangeRateCalculator.php b/src/Finance/ExchangeRateCalculator.php new file mode 100644 index 0000000..1b170b0 --- /dev/null +++ b/src/Finance/ExchangeRateCalculator.php @@ -0,0 +1,52 @@ +mainCurrency = $mainCurrency; + $this->currencyExchangeRateRepository = new CurrencyExchangeRateRepository(); + } + + public function calculate(float $sumInCurrency, Currency $currency, DateTime $time): float + { + if ($currency->getId() === $this->mainCurrency->getId()) { + return $sumInCurrency; + } + + $currentExchangeRate = $this->getCurrentExchangeRate($currency, $time); + if ($currentExchangeRate === null) { + return 0.0; + } + + return $sumInCurrency * $currentExchangeRate->getExchangeRate(); + } + + private function getCurrentExchangeRate(Currency $currency, DateTime $time): ?CurrencyExchangeRate + { + if (!isset($this->exchangeRates[$currency->getId()])) { + $this->exchangeRates[$currency->getId()] = iterator_to_array($this->currencyExchangeRateRepository->getAllByCurrency($currency)); + } + + $currentExchangeRate = null; + foreach ($this->exchangeRates[$currency->getId()] as $exchangeRate) { + if ($exchangeRate->getValidFrom() > $time) { + break; + } + $currentExchangeRate = $exchangeRate; + } + + return $currentExchangeRate; + } +} -- 2.45.2 From 6fb951a01e89c2a80f4fcba4cb7978fe4f938ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Mon, 1 May 2023 19:23:31 +0200 Subject: [PATCH 6/8] RVRNEXT-6 add transactioncontroller --- src/Controller/TransactionController.php | 162 +++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 src/Controller/TransactionController.php diff --git a/src/Controller/TransactionController.php b/src/Controller/TransactionController.php new file mode 100644 index 0000000..c6b484d --- /dev/null +++ b/src/Controller/TransactionController.php @@ -0,0 +1,162 @@ +communityRepository = new CommunityRepository(); + $this->communityMemberRepository = new CommunityMemberRepository(); + $this->currencyRepository = new CurrencyRepository(); + $this->transactionRepository = new TransactionRepository(); + } + + public function isAuthenticationRequired(): bool + { + return true; + } + + public function authorize(): bool + { + $communityId = \Container::$request->query('communityId'); + $this->community = $this->communityRepository->getById($communityId); + if ($this->community === null) { + return false; + } + + /** + * @var User $user + */ + $user = \Container::$request->user(); + $this->ownCommunityMember = $this->communityMemberRepository->getByCommunityAndUser($this->community, $user); + if ($this->ownCommunityMember === null) { + return false; + } + + return true; + } + + public function getTransactions(): IContent + { + Container::$persistentDataManager->loadRelationsFromDb($this->community, true, ['main_currency']); + $exchangeRateCalculator = new ExchangeRateCalculator($this->community->getMainCurrency()); + + $itemsPerPage = 50; + $numberOfTransactions = $this->transactionRepository->countAllByCommunity($this->community); + $pages = ceil($numberOfTransactions / $itemsPerPage); + $currentPage = Container::$request->query('page') ?: 0; + $transactions = $this->transactionRepository->getPagedByCommunity( + $this->community, + $currentPage * $itemsPerPage, + $itemsPerPage, + true, + ['currency', 'payer_user', 'payee_user'] + ); + + return new HtmlContent('communities/transactions', [ + 'community' => $this->community, + 'exchangeRateCalculator' => $exchangeRateCalculator, + 'pages' => $pages, + 'currentPage' => $currentPage, + 'transactions' => $transactions + ]); + } + + public function getTransactionEdit(): ?IContent + { + $transactionId = Container::$request->query('transactionId'); + if ($transactionId) { + $transaction = $this->transactionRepository->getById($transactionId); + if ($transaction === null) { + return null; + } + } else { + $transaction = null; + } + + return new HtmlContent('communities/transaction_edit', [ + 'community' => $this->community, + 'transaction' => $transaction, + 'members' => $this->getMembers($this->community), + 'currencies' => $this->getCurrencies($this->community) + ]); + } + + public function saveTransaction(): ?IContent + { + $transactionId = Container::$request->query('transactionId'); + if ($transactionId) { + $transaction = $this->transactionRepository->getById($transactionId); + } else { + $transaction = new Transaction(); + $transaction->setCommunity($this->community); + } + + $transaction->setCurrencyId(Container::$request->post('currency_id')); + $transaction->setPayerUserId(Container::$request->post('payer_user_id')); + $transaction->setPayeeUserId(Container::$request->post('payee_user_id') ?: null); + $transaction->setDescription(Container::$request->post('description')); + $transaction->setSum(Container::$request->post('sum')); + $transaction->setTimeDate(new DateTime(Container::$request->post('time'))); + Container::$persistentDataManager->saveToDb($transaction); + + return new JsonContent(['success' => true]); + } + + public function deleteTransaction(): IContent + { + $transaction = $this->transactionRepository->getById(Container::$request->query('transactionId')); + Container::$persistentDataManager->deleteFromDb($transaction); + + return new JsonContent(['success' => true]); + } + + private function getMembers(Community $community): array + { + $members = iterator_to_array($this->communityMemberRepository->getAllByCommunity($community, true, ['user'])); + usort($members, function($a, $b) { + return strnatcmp($a->getUser()->getDisplayName(), $b->getUser()->getDisplayName()); + }); + return $members; + } + + private function getCurrencies(Community $community): array + { + $currencies = iterator_to_array($this->currencyRepository->getAllByCommunity($community)); + usort($currencies, function($a, $b) { + return strnatcmp($a->getCode(), $b->getCode()); + }); + usort($currencies, function($a, $b) use ($community) { + return (int)($b->getId() === $community->getMainCurrencyId()) - (int)($a->getId() === $community->getMainCurrencyId()); + }); + return $currencies; + } +} -- 2.45.2 From 14f7a5b9b53dea823634b77db5af3c4f096c7097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Mon, 1 May 2023 19:23:48 +0200 Subject: [PATCH 7/8] RVRNEXT-6 add views for transactions --- views/communities/transaction_edit.php | 53 ++++++++++++++++++++++ views/communities/transactions.php | 62 ++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 views/communities/transaction_edit.php create mode 100644 views/communities/transactions.php diff --git a/views/communities/transaction_edit.php b/views/communities/transaction_edit.php new file mode 100644 index 0000000..152d479 --- /dev/null +++ b/views/communities/transaction_edit.php @@ -0,0 +1,53 @@ +@extends(templates/layout_normal) + +@section(main) +

+ getName() ?> » + Transactions » + + Edit transaction + + New transaction + +

+
+ getRoute('community.transactions.edit-action')->generateLink(['communityId' => $community->getId(), 'transactionId' => $transaction->getId()]) : + Container::$routeCollection->getRoute('community.transactions.new-action')->generateLink(['communityId' => $community->getId()]); + ?> + + + + + + + +

+
+ + + + +
+ + +
+ +
+@endsection diff --git a/views/communities/transactions.php b/views/communities/transactions.php new file mode 100644 index 0000000..3a7cf0f --- /dev/null +++ b/views/communities/transactions.php @@ -0,0 +1,62 @@ +@extends(templates/layout_normal) + +@section(main) +

+ getName() ?> » + Transactions +

+ +

New transaction

+ + 1): ?> +

+ « + + + + + + + + + + » +

+ + + + +
+
+

getDescription() ?>

+

getPayerUser()->getDisplayName() ?> ► getPayeeUser() ? $transaction->getPayeeUser()->getDisplayName() : '[common]' ?>

+

getTimeDate()->format('Y-m-d H:i') ?>

+
+
+

calculate($transaction->getSum(), $transaction->getCurrency(), $transaction->getTimeDate()), $community->getMainCurrency()->getRoundDigits()) ?> getMainCurrency()->getCode() ?>

+ getMainCurrencyId() !== $transaction->getCurrencyId()): ?> +

getSum(), $transaction->getCurrency()->getRoundDigits()) ?> getCurrency()->getCode() ?>

+ +
+
+
+ + + 1): ?> +

+ « + + + + + + + + + + » +

+ + +

New transaction

+@endsection -- 2.45.2 From 856664145939284c5fb6412f7e1e238708427a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Mon, 1 May 2023 19:24:24 +0200 Subject: [PATCH 8/8] RVRNEXT-6 add new routes for transactions --- web.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web.php b/web.php index 29af58d..4f2f758 100644 --- a/web.php +++ b/web.php @@ -11,6 +11,7 @@ use RVR\Controller\OAuthController; use RVR\Controller\UserController; use RVR\Controller\UserSearchController; use RVR\Controller\CommunityController; +use RVR\Controller\TransactionController; use RVR\Repository\UserRepository; require 'app.php'; @@ -76,6 +77,14 @@ Container::$routeCollection->group('communities', function (RouteCollection $rou $routeCollection->post('community-currency-exchange-rates-edit', '{code}/edit', [CommunityController::class, 'saveCurrencyExchangeRate']); $routeCollection->post('community-currency-exchange-rates-delete', '{code}/delete', [CommunityController::class, 'deleteCurrencyExchangeRate']); }); + $routeCollection->group('transactions', function (RouteCollection $routeCollection) { + $routeCollection->get('community.transactions', '', [TransactionController::class, 'getTransactions']); + $routeCollection->get('community.transactions.new', 'new', [TransactionController::class, 'getTransactionEdit']); + $routeCollection->post('community.transactions.new-action', 'new', [TransactionController::class, 'saveTransaction']); + $routeCollection->get('community.transactions.edit', '{transactionId}', [TransactionController::class, 'getTransactionEdit']); + $routeCollection->post('community.transactions.edit-action', '{transactionId}', [TransactionController::class, 'saveTransaction']); + $routeCollection->post('community.transactions.delete', '{transactionId}/delete', [TransactionController::class, 'deleteTransaction']); + }); }); }); -- 2.45.2