Skip to content

Commit

Permalink
Release/1.0.2 (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavofreze authored Nov 7, 2024
1 parent 22bcf09 commit 8bbfb57
Show file tree
Hide file tree
Showing 33 changed files with 96 additions and 86 deletions.
8 changes: 7 additions & 1 deletion config/php/www.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[www]
user = www-data
group = www-data
listen = /run/php-fpm/php-fpm.sock

listen.mode = 0666
listen.owner = www-data
listen.group = www-data

pm = dynamic
pm.max_children = 10
Expand All @@ -8,4 +14,4 @@ pm.min_spare_servers = 2
pm.max_spare_servers = 4

php_flag[display_errors] = off
access.log = /dev/null
access.log = /dev/null
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ services:
container_name: account
env_file:
- ./config/local.env
volumes:
- ./src:/var/www/html/src
depends_on:
- account-adm

Expand Down
2 changes: 2 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

printf "Waiting for Database to start... \n\n"

sleep 15

flyway -connectRetries=15 migrate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Account\Application\Domain\Commands;
namespace Account\Application\Commands;

/**
* Commands encapsulate specific actions or intentions within the application,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Account\Application\Domain\Commands;
namespace Account\Application\Commands;

use Account\Application\Domain\Models\Account\AccountId;
use Account\Application\Domain\Models\Transaction\Transaction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Account\Application\Domain\Commands;
namespace Account\Application\Commands;

use Account\Application\Domain\Models\Account\AccountId;
use Account\Application\Domain\Models\Transaction\Transaction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Account\Application\Domain\Commands;
namespace Account\Application\Commands;

use Account\Application\Domain\Models\Account\AccountId;
use Account\Application\Domain\Models\Account\Holder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Account\Application\Domain\Commands;
namespace Account\Application\Commands;

use Account\Application\Domain\Models\Account\AccountId;
use Account\Application\Domain\Models\Transaction\Transaction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace Account\Application\Domain\Handlers;
namespace Account\Application\Handlers;

use Account\Application\Domain\Commands\CreditAccount;
use Account\Application\Commands\CreditAccount;
use Account\Application\Domain\Exceptions\AccountNotFound;
use Account\Application\Domain\Ports\Inbound\AccountCrediting;
use Account\Application\Domain\Ports\Outbound\Accounts;
use Account\Application\Ports\Inbound\AccountCrediting;
use Account\Application\Ports\Outbound\Accounts;

final readonly class AccountCreditingHandler implements AccountCrediting
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace Account\Application\Domain\Handlers;
namespace Account\Application\Handlers;

use Account\Application\Domain\Commands\DebitAccount;
use Account\Application\Commands\DebitAccount;
use Account\Application\Domain\Exceptions\AccountNotFound;
use Account\Application\Domain\Ports\Inbound\AccountDebiting;
use Account\Application\Domain\Ports\Outbound\Accounts;
use Account\Application\Ports\Inbound\AccountDebiting;
use Account\Application\Ports\Outbound\Accounts;

final readonly class AccountDebitingHandler implements AccountDebiting
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

namespace Account\Application\Domain\Handlers;
namespace Account\Application\Handlers;

use Account\Application\Domain\Commands\OpenAccount;
use Account\Application\Commands\OpenAccount;
use Account\Application\Domain\Exceptions\AccountAlreadyExists;
use Account\Application\Domain\Models\Account\Account;
use Account\Application\Domain\Ports\Inbound\AccountOpening;
use Account\Application\Domain\Ports\Outbound\Accounts;
use Account\Application\Ports\Inbound\AccountOpening;
use Account\Application\Ports\Outbound\Accounts;

final readonly class AccountOpeningHandler implements AccountOpening
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace Account\Application\Domain\Handlers;
namespace Account\Application\Handlers;

use Account\Application\Domain\Commands\RequestWithdrawal;
use Account\Application\Commands\RequestWithdrawal;
use Account\Application\Domain\Exceptions\AccountNotFound;
use Account\Application\Domain\Ports\Inbound\AccountWithdrawal;
use Account\Application\Domain\Ports\Outbound\Accounts;
use Account\Application\Ports\Inbound\AccountWithdrawal;
use Account\Application\Ports\Outbound\Accounts;

final readonly class AccountWithdrawalHandler implements AccountWithdrawal
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Account\Application\Domain\Ports\Inbound;
namespace Account\Application\Ports\Inbound;

use Account\Application\Domain\Commands\CreditAccount;
use Account\Application\Commands\CreditAccount;

/**
* Handles account crediting requests by processing the specified command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Account\Application\Domain\Ports\Inbound;
namespace Account\Application\Ports\Inbound;

use Account\Application\Domain\Commands\DebitAccount;
use Account\Application\Commands\DebitAccount;

/**
* Handles account debiting requests by processing the specified command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Account\Application\Domain\Ports\Inbound;
namespace Account\Application\Ports\Inbound;

use Account\Application\Domain\Commands\OpenAccount;
use Account\Application\Commands\OpenAccount;

/**
* Handles account opening requests by processing the specified command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Account\Application\Domain\Ports\Inbound;
namespace Account\Application\Ports\Inbound;

use Account\Application\Domain\Commands\RequestWithdrawal;
use Account\Application\Commands\RequestWithdrawal;

/**
* Handles withdrawal requests for an account by processing the specified command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Account\Application\Domain\Ports\Outbound;
namespace Account\Application\Ports\Outbound;

use Account\Application\Domain\Models\Account\Account;
use Account\Application\Domain\Models\Account\AccountId;
Expand Down
26 changes: 13 additions & 13 deletions src/Dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace Account;

use Account\Application\Domain\Handlers\AccountCreditingHandler;
use Account\Application\Domain\Handlers\AccountDebitingHandler;
use Account\Application\Domain\Handlers\AccountOpeningHandler;
use Account\Application\Domain\Handlers\AccountWithdrawalHandler;
use Account\Application\Domain\Ports\Inbound\AccountCrediting;
use Account\Application\Domain\Ports\Inbound\AccountDebiting;
use Account\Application\Domain\Ports\Inbound\AccountOpening;
use Account\Application\Domain\Ports\Inbound\AccountWithdrawal;
use Account\Application\Domain\Ports\Outbound\Accounts;
use Account\Application\Handlers\AccountCreditingHandler;
use Account\Application\Handlers\AccountDebitingHandler;
use Account\Application\Handlers\AccountOpeningHandler;
use Account\Application\Handlers\AccountWithdrawalHandler;
use Account\Application\Ports\Inbound\AccountCrediting;
use Account\Application\Ports\Inbound\AccountDebiting;
use Account\Application\Ports\Inbound\AccountOpening;
use Account\Application\Ports\Inbound\AccountWithdrawal;
use Account\Application\Ports\Outbound\Accounts;
use Account\Driven\Account\Repository\Adapter as AccountsAdapter;
use Account\Driven\Shared\Database\MySql\MySqlEngine;
use Account\Driven\Shared\Database\RelationalConnection;
Expand Down Expand Up @@ -43,10 +43,10 @@ public static function definitions(): array
return [
Logger::class => static function () {
$logger = new MonoLogger(name: 'StreamLogger');
$formatter = new LineFormatter('%message%');
$streamHandler = new StreamHandler('php://stdout');
$streamHandler->setFormatter($formatter);
$logger->pushHandler($streamHandler);
$formatter = (new LineFormatter(format: '%message%'))->allowInlineLineBreaks();
$streamHandler = new StreamHandler(stream: 'php://stdout');
$streamHandler->setFormatter(formatter: $formatter);
$logger->pushHandler(handler: $streamHandler);
$obfuscators = Obfuscators::createFrom(elements: [new SimpleIdentity()]);

return new LoggerHandler(logger: $logger, obfuscators: $obfuscators);
Expand Down
2 changes: 1 addition & 1 deletion src/Driven/Account/Repository/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Account\Application\Domain\Models\Account\Balance;
use Account\Application\Domain\Models\Account\Holder;
use Account\Application\Domain\Models\Transaction\Transaction;
use Account\Application\Domain\Ports\Outbound\Accounts;
use Account\Application\Ports\Outbound\Accounts;
use Account\Driven\Account\OperationType;
use Account\Driven\Account\Repository\Records\AccountRecord;
use Account\Driven\Account\Repository\Records\BalanceRecord;
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Http/Endpoints/Account/OpenAccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Account\Driver\Http\Endpoints\Account;

use Account\Application\Domain\Ports\Inbound\AccountOpening;
use Account\Application\Ports\Inbound\AccountOpening;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Http/Endpoints/Account/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Account\Driver\Http\Endpoints\Account;

use Account\Application\Domain\Commands\OpenAccount;
use Account\Application\Commands\OpenAccount;
use Account\Application\Domain\Models\Account\AccountId;
use Account\Application\Domain\Models\Account\Documents\SimpleIdentity;
use Account\Application\Domain\Models\Account\Holder;
Expand Down
6 changes: 3 additions & 3 deletions src/Driver/Http/Endpoints/Transaction/CreateTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Account\Driver\Http\Endpoints\Transaction;

use Account\Application\Domain\Ports\Inbound\AccountCrediting;
use Account\Application\Domain\Ports\Inbound\AccountDebiting;
use Account\Application\Domain\Ports\Inbound\AccountWithdrawal;
use Account\Application\Ports\Inbound\AccountCrediting;
use Account\Application\Ports\Inbound\AccountDebiting;
use Account\Application\Ports\Inbound\AccountWithdrawal;
use Account\Driver\Http\Endpoints\Transaction\Factories\UseCaseFactory;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Account\Driver\Http\Endpoints\Transaction\Factories;

use Account\Application\Domain\Commands\Command;
use Account\Application\Domain\Commands\CreditAccount;
use Account\Application\Domain\Commands\DebitAccount;
use Account\Application\Domain\Commands\RequestWithdrawal;
use Account\Application\Commands\Command;
use Account\Application\Commands\CreditAccount;
use Account\Application\Commands\DebitAccount;
use Account\Application\Commands\RequestWithdrawal;
use Account\Application\Domain\Models\Account\AccountId;
use Account\Driven\Account\OperationType;
use InvalidArgumentException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

namespace Account\Driver\Http\Endpoints\Transaction\Factories;

use Account\Application\Domain\Commands\Command;
use Account\Application\Domain\Commands\CreditAccount;
use Account\Application\Domain\Commands\DebitAccount;
use Account\Application\Domain\Commands\RequestWithdrawal;
use Account\Application\Domain\Ports\Inbound\AccountCrediting;
use Account\Application\Domain\Ports\Inbound\AccountDebiting;
use Account\Application\Domain\Ports\Inbound\AccountWithdrawal;
use Account\Application\Commands\Command;
use Account\Application\Commands\CreditAccount;
use Account\Application\Commands\DebitAccount;
use Account\Application\Commands\RequestWithdrawal;
use Account\Application\Ports\Inbound\AccountCrediting;
use Account\Application\Ports\Inbound\AccountDebiting;
use Account\Application\Ports\Inbound\AccountWithdrawal;

final readonly class UseCaseFactory
{
Expand Down
2 changes: 1 addition & 1 deletion src/Driver/Http/Endpoints/Transaction/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Account\Driver\Http\Endpoints\Transaction;

use Account\Application\Domain\Commands\Command;
use Account\Application\Commands\Command;
use Account\Driver\Http\Endpoints\InvalidRequest;
use Account\Driver\Http\Endpoints\Transaction\Factories\CommandFactory;
use Respect\Validation\Exceptions\NestedValidationException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

declare(strict_types=1);

namespace Test\Integration\Application\Domain\Handlers;
namespace Test\Integration\Application\Handlers;

use Account\Application\Domain\Commands\CreditAccount;
use Account\Application\Commands\CreditAccount;
use Account\Application\Domain\Exceptions\AccountNotFound;
use Account\Application\Domain\Models\Account\Account;
use Account\Application\Domain\Models\Account\AccountId;
use Account\Application\Domain\Models\Account\Documents\SimpleIdentity;
use Account\Application\Domain\Models\Account\Holder;
use Account\Application\Domain\Models\Transaction\Amounts\PositiveAmount;
use Account\Application\Domain\Models\Transaction\Operations\CreditVoucher;
use Account\Application\Domain\Ports\Inbound\AccountCrediting;
use Account\Application\Domain\Ports\Outbound\Accounts;
use Account\Application\Ports\Inbound\AccountCrediting;
use Account\Application\Ports\Outbound\Accounts;
use Account\Driven\Shared\Database\RelationalConnection;
use Test\Integration\Application\Repository;
use Test\Integration\IntegrationTestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Test\Integration\Application\Domain\Handlers;
namespace Test\Integration\Application\Handlers;

use Account\Application\Domain\Commands\DebitAccount;
use Account\Application\Commands\DebitAccount;
use Account\Application\Domain\Exceptions\AccountNotFound;
use Account\Application\Domain\Exceptions\InsufficientFunds;
use Account\Application\Domain\Models\Account\Account;
Expand All @@ -16,8 +16,8 @@
use Account\Application\Domain\Models\Transaction\Operations\CreditVoucher;
use Account\Application\Domain\Models\Transaction\Operations\NormalPurchase;
use Account\Application\Domain\Models\Transaction\Operations\PurchaseWithInstallments;
use Account\Application\Domain\Ports\Inbound\AccountDebiting;
use Account\Application\Domain\Ports\Outbound\Accounts;
use Account\Application\Ports\Inbound\AccountDebiting;
use Account\Application\Ports\Outbound\Accounts;
use Account\Driven\Shared\Database\RelationalConnection;
use Test\Integration\Application\Repository;
use Test\Integration\IntegrationTestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

declare(strict_types=1);

namespace Test\Integration\Application\Domain\Handlers;
namespace Test\Integration\Application\Handlers;

use Account\Application\Domain\Commands\OpenAccount;
use Account\Application\Commands\OpenAccount;
use Account\Application\Domain\Exceptions\AccountAlreadyExists;
use Account\Application\Domain\Models\Account\Account;
use Account\Application\Domain\Models\Account\AccountId;
use Account\Application\Domain\Models\Account\Documents\SimpleIdentity;
use Account\Application\Domain\Models\Account\Holder;
use Account\Application\Domain\Ports\Inbound\AccountOpening;
use Account\Application\Domain\Ports\Outbound\Accounts;
use Account\Application\Ports\Inbound\AccountOpening;
use Account\Application\Ports\Outbound\Accounts;
use Test\Integration\IntegrationTestCase;

final class AccountOpeningHandlerTest extends IntegrationTestCase
Expand Down
Loading

0 comments on commit 8bbfb57

Please sign in to comment.