Skip to content

Commit

Permalink
Merge pull request #2 from vfilipovsky/feat_regions_get
Browse files Browse the repository at this point in the history
feat: regions list
  • Loading branch information
Vadims Filipovskis committed Dec 18, 2022
2 parents 88f9567 + eda69c6 commit 2c1b9fe
Show file tree
Hide file tree
Showing 17 changed files with 592 additions and 5 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"symfony/dotenv": "6.2.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "6.2.*",
"symfony/monolog-bundle": "^3.8",
"symfony/runtime": "6.2.*",
"symfony/security-bundle": "6.2.*",
"symfony/serializer": "6.2.*",
Expand Down
267 changes: 266 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
];
54 changes: 54 additions & 0 deletions config/packages/monolog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
monolog:
channels:
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists

when@dev:
monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: [ "!event" ]
console:
type: console
level: debug
process_psr_3_messages: false
channels: [ "!event", "!doctrine", "!console" ]

when@test:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [ 404, 405 ]
channels: [ "!event" ]
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug

when@prod:
monolog:
handlers:
main:
type: fingers_crossed
action_level: error
handler: nested
excluded_http_codes: [ 404, 405 ]
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
type: stream
path: php://stderr
level: debug
formatter: monolog.formatter.json
console:
type: console
process_psr_3_messages: false
channels: [ "!event", "!doctrine" ]
deprecation:
type: stream
channels: [ deprecation ]
path: php://stderr
22 changes: 22 additions & 0 deletions src/Action/Region/Get/GetRegionsAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace App\Action\Region\Get;

use App\Repository\RegionRepositoryInterface;

readonly class GetRegionsAction implements GetRegionsActionInterface
{
public function __construct(private RegionRepositoryInterface $regionRepository)
{
}

public function run(GetRegionsActionRequest $request): GetRegionsActionResponse
{
return new GetRegionsActionResponse(
$this->regionRepository->list($request->offset, $request->limit, $request->title)
);
}

}
10 changes: 10 additions & 0 deletions src/Action/Region/Get/GetRegionsActionInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace App\Action\Region\Get;

interface GetRegionsActionInterface
{
public function run(GetRegionsActionRequest $request): GetRegionsActionResponse;
}
Loading

0 comments on commit 2c1b9fe

Please sign in to comment.