From a708670ef75732dbf7daf24d23ffb9d7aab29245 Mon Sep 17 00:00:00 2001 From: Kevin Kaniaburka Date: Mon, 24 Jul 2023 00:41:22 +0200 Subject: [PATCH] Rename ExchangeRate into ExchangeRateLive --- .../edycja_kursu_wymiany.feature | 2 +- .../tworzenie_kursu_wymiany.feature | 2 +- .../usuwanie_kursu_wymiany.feature | 2 +- ...wy\305\233wietlanie_kursu_wymiany.feature" | 2 +- ...ge_rates.yaml => exchange_rate_lives.yaml} | 10 ++-- migrations/Version20230723222438.php | 29 +++++++++++ .../api/exchange_rate/get/collection.json | 22 ++++----- .../collection_by_base_and_quote_assets.json | 12 ++--- responses/api/exchange_rate/get/item.json | 6 +-- responses/api/exchange_rate/patch/valid.json | 6 +-- responses/api/exchange_rate/post/valid.json | 6 +-- .../CreateExchangeRateCommandHandler.php | 45 ----------------- .../CreateReversedExchangeRateCommand.php | 24 ---------- .../DeleteExchangeRateCommandHandler.php | 26 ---------- .../UpdateReversedExchangeRateCommand.php | 24 ---------- .../CreateExchangeRateLiveCommand.php} | 4 +- .../CreateExchangeRateLiveCommandHandler.php | 45 +++++++++++++++++ .../CreateReversedExchangeRateLiveCommand.php | 24 ++++++++++ .../DeleteExchangeRateLiveCommand.php} | 4 +- .../DeleteExchangeRateLiveCommandHandler.php | 26 ++++++++++ .../UpdateExchangeRateLiveCommand.php} | 4 +- .../UpdateExchangeRateLiveCommandHandler.php} | 24 +++++----- .../UpdateReversedExchangeRateLiveCommand.php | 24 ++++++++++ ...geRateLiveWhenExchangeRateLiveChanged.php} | 26 +++++----- .../FindExchangeRateQueryHandler.php | 21 -------- .../FindExchangeRateLiveQuery.php} | 4 +- .../FindExchangeRateLiveQueryHandler.php | 21 ++++++++ .../FindExchangeRateLivesQuery.php} | 4 +- .../FindExchangeRateLivesQueryHandler.php} | 10 ++-- ...t.php => ExchangeRateLiveCreatedEvent.php} | 4 +- ...t.php => ExchangeRateLiveUpdatedEvent.php} | 4 +- ... ReversedExchangeLiveRateCreatedEvent.php} | 4 +- ... ReversedExchangeRateLiveUpdatedEvent.php} | 4 +- .../Domain/Factory/ExchangeRateFactory.php | 16 ------- .../Factory/ExchangeRateFactoryInterface.php | 12 ----- .../Factory/ExchangeRateLiveFactory.php | 16 +++++++ .../ExchangeRateLiveFactoryInterface.php | 12 +++++ ...{ExchangeRate.php => ExchangeRateLive.php} | 2 +- ...face.php => ExchangeRateLiveInterface.php} | 2 +- ...> ExchangeRateLiveRepositoryInterface.php} | 12 ++--- ...ource.php => ExchangeRateLiveResource.php} | 22 ++++----- .../Processor/ExchangeRateLiveProcessor.php | 48 +++++++++++++++++++ .../Processor/ExchangeRateProcessor.php | 48 ------------------- ...vider.php => ExchangeRateLiveProvider.php} | 26 +++++----- .../Configuration/Doctrine/mapping.yaml | 4 +- ...eRate.orm.xml => ExchangeRateLive.orm.xml} | 2 +- .../Symfony/Service/api_state/processor.php | 4 +- .../Symfony/Service/api_state/provider.php | 4 +- .../Symfony/Service/command_handlers.php | 24 +++++----- .../Symfony/Service/event_listeners.php | 8 ++-- .../Configuration/Symfony/Service/factory.php | 8 ++-- .../Symfony/Service/query_handlers.php | 14 +++--- .../Symfony/Service/repository.php | 8 ++-- ...{ExchangeRate.xml => ExchangeRateLive.xml} | 2 +- ...ory.php => ExchangeRateLiveRepository.php} | 24 +++++----- ...y.php => DefaultExchangeRateLiveQuery.php} | 2 +- .../DeleteExchangeRateLiveTest.php} | 22 ++++----- .../GetExchangeRateLiveTest.php} | 30 ++++++------ .../PatchExchangeRateLiveTest.php} | 46 +++++++++--------- .../PostExchangeRateLiveTest.php} | 14 +++--- ...ange_rate.yaml => exchange_rate_live.yaml} | 4 +- tests/Behat/Configuration/suites.yaml | 2 +- .../Behat/Context/Api/ExchangeRateContext.php | 20 ++++---- .../Context/Setup/ExchangeRateContext.php | 4 +- .../Context/Transform/ExchangeRateContext.php | 14 +++--- 65 files changed, 490 insertions(+), 461 deletions(-) rename features/{exchange_rate => exchange_rate_live}/edycja_kursu_wymiany.feature (97%) rename features/{exchange_rate => exchange_rate_live}/tworzenie_kursu_wymiany.feature (98%) rename features/{exchange_rate => exchange_rate_live}/usuwanie_kursu_wymiany.feature (97%) rename "features/exchange_rate/wy\305\233wietlanie_kursu_wymiany.feature" => "features/exchange_rate_live/wy\305\233wietlanie_kursu_wymiany.feature" (98%) rename fixtures/api/{exchange_rates.yaml => exchange_rate_lives.yaml} (81%) create mode 100644 migrations/Version20230723222438.php delete mode 100644 src/Exchange/Application/Command/ExchangeRate/CreateExchangeRateCommandHandler.php delete mode 100644 src/Exchange/Application/Command/ExchangeRate/CreateReversedExchangeRateCommand.php delete mode 100644 src/Exchange/Application/Command/ExchangeRate/DeleteExchangeRateCommandHandler.php delete mode 100644 src/Exchange/Application/Command/ExchangeRate/UpdateReversedExchangeRateCommand.php rename src/Exchange/Application/Command/{ExchangeRate/CreateExchangeRateCommand.php => ExchangeRateLive/CreateExchangeRateLiveCommand.php} (62%) create mode 100644 src/Exchange/Application/Command/ExchangeRateLive/CreateExchangeRateLiveCommandHandler.php create mode 100644 src/Exchange/Application/Command/ExchangeRateLive/CreateReversedExchangeRateLiveCommand.php rename src/Exchange/Application/Command/{ExchangeRate/DeleteExchangeRateCommand.php => ExchangeRateLive/DeleteExchangeRateLiveCommand.php} (56%) create mode 100644 src/Exchange/Application/Command/ExchangeRateLive/DeleteExchangeRateLiveCommandHandler.php rename src/Exchange/Application/Command/{ExchangeRate/UpdateExchangeRateCommand.php => ExchangeRateLive/UpdateExchangeRateLiveCommand.php} (62%) rename src/Exchange/Application/Command/{ExchangeRate/UpdateExchangeRateCommandHandler.php => ExchangeRateLive/UpdateExchangeRateLiveCommandHandler.php} (50%) create mode 100644 src/Exchange/Application/Command/ExchangeRateLive/UpdateReversedExchangeRateLiveCommand.php rename src/Exchange/Application/EventListener/{CreateOrUpdateReversedExchangeRateWhenExchangeRateChanged.php => CreateOrUpdateReversedExchangeRateLiveWhenExchangeRateLiveChanged.php} (50%) delete mode 100644 src/Exchange/Application/Query/ExchangeRate/FindExchangeRateQueryHandler.php rename src/Exchange/Application/Query/{ExchangeRate/FindExchangeRateQuery.php => ExchangeRateLive/FindExchangeRateLiveQuery.php} (58%) create mode 100644 src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLiveQueryHandler.php rename src/Exchange/Application/Query/{ExchangeRate/FindExchangeRatesQuery.php => ExchangeRateLive/FindExchangeRateLivesQuery.php} (68%) rename src/Exchange/Application/Query/{ExchangeRate/FindExchangeRatesQueryHandler.php => ExchangeRateLive/FindExchangeRateLivesQueryHandler.php} (59%) rename src/Exchange/Domain/Event/{ReversedExchangeRateUpdatedEvent.php => ExchangeRateLiveCreatedEvent.php} (54%) rename src/Exchange/Domain/Event/{ExchangeRateCreatedEvent.php => ExchangeRateLiveUpdatedEvent.php} (54%) rename src/Exchange/Domain/Event/{ExchangeRateUpdatedEvent.php => ReversedExchangeLiveRateCreatedEvent.php} (52%) rename src/Exchange/Domain/Event/{ReversedExchangeRateCreatedEvent.php => ReversedExchangeRateLiveUpdatedEvent.php} (52%) delete mode 100644 src/Exchange/Domain/Factory/ExchangeRateFactory.php delete mode 100644 src/Exchange/Domain/Factory/ExchangeRateFactoryInterface.php create mode 100644 src/Exchange/Domain/Factory/ExchangeRateLiveFactory.php create mode 100644 src/Exchange/Domain/Factory/ExchangeRateLiveFactoryInterface.php rename src/Exchange/Domain/Model/{ExchangeRate.php => ExchangeRateLive.php} (93%) rename src/Exchange/Domain/Model/{ExchangeRateInterface.php => ExchangeRateLiveInterface.php} (81%) rename src/Exchange/Domain/Repository/{ExchangeRateRepositoryInterface.php => ExchangeRateLiveRepositoryInterface.php} (54%) rename src/Exchange/Infrastructure/ApiResource/{ExchangeRateResource.php => ExchangeRateLiveResource.php} (81%) create mode 100644 src/Exchange/Infrastructure/ApiState/Processor/ExchangeRateLiveProcessor.php delete mode 100644 src/Exchange/Infrastructure/ApiState/Processor/ExchangeRateProcessor.php rename src/Exchange/Infrastructure/ApiState/Provider/{ExchangeRateProvider.php => ExchangeRateLiveProvider.php} (67%) rename src/Exchange/Infrastructure/Configuration/Doctrine/mappings/{ExchangeRate.orm.xml => ExchangeRateLive.orm.xml} (89%) rename src/Exchange/Infrastructure/Configuration/Symfony/validation/{ExchangeRate.xml => ExchangeRateLive.xml} (97%) rename src/Exchange/Infrastructure/Doctrine/Orm/{ExchangeRateRepository.php => ExchangeRateLiveRepository.php} (71%) rename src/Exchange/Infrastructure/Doctrine/Orm/Query/{DefaultExchangeRateQuery.php => DefaultExchangeRateLiveQuery.php} (93%) rename tests/Api/{ExchangeRate/DeleteExchangeRateTest.php => ExchangeRateLive/DeleteExchangeRateLiveTest.php} (52%) rename tests/Api/{ExchangeRate/GetExchangeRateTest.php => ExchangeRateLive/GetExchangeRateLiveTest.php} (61%) rename tests/Api/{ExchangeRate/PatchExchangeRateTest.php => ExchangeRateLive/PatchExchangeRateLiveTest.php} (59%) rename tests/Api/{ExchangeRate/PostExchangeRateTest.php => ExchangeRateLive/PostExchangeRateLiveTest.php} (88%) rename tests/Behat/Configuration/Suite/api/{exchange_rate.yaml => exchange_rate_live.yaml} (89%) diff --git a/features/exchange_rate/edycja_kursu_wymiany.feature b/features/exchange_rate_live/edycja_kursu_wymiany.feature similarity index 97% rename from features/exchange_rate/edycja_kursu_wymiany.feature rename to features/exchange_rate_live/edycja_kursu_wymiany.feature index 8f930d8..5336b5c 100644 --- a/features/exchange_rate/edycja_kursu_wymiany.feature +++ b/features/exchange_rate_live/edycja_kursu_wymiany.feature @@ -1,6 +1,6 @@ # language: pl -@exchange_rate +@exchange_rate_live Potrzeba biznesowa: Zmiana kursu wymiany W celu korzystania śledzenia kursu wymiany aktywów Jako użytkownik diff --git a/features/exchange_rate/tworzenie_kursu_wymiany.feature b/features/exchange_rate_live/tworzenie_kursu_wymiany.feature similarity index 98% rename from features/exchange_rate/tworzenie_kursu_wymiany.feature rename to features/exchange_rate_live/tworzenie_kursu_wymiany.feature index 0aff6e0..01a6032 100644 --- a/features/exchange_rate/tworzenie_kursu_wymiany.feature +++ b/features/exchange_rate_live/tworzenie_kursu_wymiany.feature @@ -1,6 +1,6 @@ # language: pl -@exchange_rate +@exchange_rate_live Potrzeba biznesowa: Tworzenie kursu wymiany W celu posiadania informacji o kursie wymiany między dwoma aktywami Jako użytkownik diff --git a/features/exchange_rate/usuwanie_kursu_wymiany.feature b/features/exchange_rate_live/usuwanie_kursu_wymiany.feature similarity index 97% rename from features/exchange_rate/usuwanie_kursu_wymiany.feature rename to features/exchange_rate_live/usuwanie_kursu_wymiany.feature index dcb582f..03b555f 100644 --- a/features/exchange_rate/usuwanie_kursu_wymiany.feature +++ b/features/exchange_rate_live/usuwanie_kursu_wymiany.feature @@ -1,6 +1,6 @@ # language: pl -@exchange_rate +@exchange_rate_live Potrzeba biznesowa: Usuwanie kursów wymiany W celu posiadania tylko potrzebnych kursów wymiany Jako użytkownik diff --git "a/features/exchange_rate/wy\305\233wietlanie_kursu_wymiany.feature" "b/features/exchange_rate_live/wy\305\233wietlanie_kursu_wymiany.feature" similarity index 98% rename from "features/exchange_rate/wy\305\233wietlanie_kursu_wymiany.feature" rename to "features/exchange_rate_live/wy\305\233wietlanie_kursu_wymiany.feature" index bf6d889..5bbedae 100644 --- "a/features/exchange_rate/wy\305\233wietlanie_kursu_wymiany.feature" +++ "b/features/exchange_rate_live/wy\305\233wietlanie_kursu_wymiany.feature" @@ -1,6 +1,6 @@ # language: pl -@exchange_rate +@exchange_rate_live Potrzeba biznesowa: Wyświetlanie kursów wymiany W celu śledzenia zmiany kursów dla wybranych aktywów Jako użytkownik diff --git a/fixtures/api/exchange_rates.yaml b/fixtures/api/exchange_rate_lives.yaml similarity index 81% rename from fixtures/api/exchange_rates.yaml rename to fixtures/api/exchange_rate_lives.yaml index f276a95..bb74952 100644 --- a/fixtures/api/exchange_rates.yaml +++ b/fixtures/api/exchange_rate_lives.yaml @@ -1,20 +1,20 @@ include: - 'assets.yaml' -Panda\Exchange\Domain\Model\ExchangeRate: - exchange_rate_acme_1: +Panda\Exchange\Domain\Model\ExchangeRateLive: + exchange_rate_live_acme_1: __construct: ['@asset_acme->ticker', '@asset_1->ticker', ''] createdAt: <(new DateTimeImmutable())> updatedAt: <(new DateTimeImmutable())> - exchange_rate_acme_2: + exchange_rate_live_acme_2: __construct: ['@asset_acme->ticker', '@asset_2->ticker', ''] createdAt: <(new DateTimeImmutable())> updatedAt: <(new DateTimeImmutable())> - exchange_rate_acme_3: + exchange_rate_live_acme_3: __construct: ['@asset_acme->ticker', '@asset_3->ticker', ''] createdAt: <(new DateTimeImmutable())> updatedAt: <(new DateTimeImmutable())> - exchange_rate_acme_4: + exchange_rate_live_acme_4: __construct: ['@asset_acme->ticker', '@asset_4->ticker', ''] createdAt: <(new DateTimeImmutable())> updatedAt: <(new DateTimeImmutable())> diff --git a/migrations/Version20230723222438.php b/migrations/Version20230723222438.php new file mode 100644 index 0000000..5861401 --- /dev/null +++ b/migrations/Version20230723222438.php @@ -0,0 +1,29 @@ +addSql('ALTER TABLE panda_exchange_rate RENAME TO panda_exchange_rate_live'); + $this->addSql('ALTER INDEX uniq_1992c039d58bbb05589c0d1c RENAME TO UNIQ_B1C1ADC316A390FF447BA6D5'); + + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE panda_exchange_rate_live RENAME TO panda_exchange_rate'); + $this->addSql('ALTER INDEX uniq_b1c1adc316a390ff447ba6d5 RENAME TO uniq_1992c039d58bbb05589c0d1c'); + } +} diff --git a/responses/api/exchange_rate/get/collection.json b/responses/api/exchange_rate/get/collection.json index 21a93fc..8345e1a 100644 --- a/responses/api/exchange_rate/get/collection.json +++ b/responses/api/exchange_rate/get/collection.json @@ -1,12 +1,12 @@ { - "@context": "/contexts/ExchangeRate", - "@id": "/exchange_rates", + "@context": "/contexts/ExchangeRateLive", + "@id": "/exchange_rate_lives", "@type": "hydra:Collection", "hydra:totalItems": 4, "hydra:member": [ { - "@id": "/exchange_rates/@uuid@", - "@type": "ExchangeRate", + "@id": "/exchange_rate_lives/@uuid@", + "@type": "ExchangeRateLive", "baseTicker": "ACM", "quoteTicker": "TCK1", "rate": "@number@", @@ -14,8 +14,8 @@ "updatedAt": "@datetime@" }, { - "@id": "/exchange_rates/@uuid@", - "@type": "ExchangeRate", + "@id": "/exchange_rate_lives/@uuid@", + "@type": "ExchangeRateLive", "baseTicker": "ACM", "quoteTicker": "TCK2", "rate": "@number@", @@ -23,8 +23,8 @@ "updatedAt": "@datetime@" }, { - "@id": "/exchange_rates/@uuid@", - "@type": "ExchangeRate", + "@id": "/exchange_rate_lives/@uuid@", + "@type": "ExchangeRateLive", "baseTicker": "ACM", "quoteTicker": "TCK3", "rate": "@number@", @@ -32,8 +32,8 @@ "updatedAt": "@datetime@" }, { - "@id": "/exchange_rates/@uuid@", - "@type": "ExchangeRate", + "@id": "/exchange_rate_lives/@uuid@", + "@type": "ExchangeRateLive", "baseTicker": "ACM", "quoteTicker": "TCK4", "rate": "@number@", @@ -43,7 +43,7 @@ ], "hydra:search": { "@type": "hydra:IriTemplate", - "hydra:template": "/exchange_rates{?baseTicker,quoteTicker}", + "hydra:template": "/exchange_rate_lives{?baseTicker,quoteTicker}", "hydra:variableRepresentation": "BasicRepresentation", "hydra:mapping": [ { diff --git a/responses/api/exchange_rate/get/collection_by_base_and_quote_assets.json b/responses/api/exchange_rate/get/collection_by_base_and_quote_assets.json index 4391a40..75d4e36 100644 --- a/responses/api/exchange_rate/get/collection_by_base_and_quote_assets.json +++ b/responses/api/exchange_rate/get/collection_by_base_and_quote_assets.json @@ -1,12 +1,12 @@ { - "@context": "/contexts/ExchangeRate", - "@id": "/exchange_rates", + "@context": "/contexts/ExchangeRateLive", + "@id": "/exchange_rate_lives", "@type": "hydra:Collection", "hydra:totalItems": 1, "hydra:member": [ { - "@id": "/exchange_rates/@uuid@", - "@type": "ExchangeRate", + "@id": "/exchange_rate_lives/@uuid@", + "@type": "ExchangeRateLive", "baseTicker": "ACM", "quoteTicker": "TCK1", "rate": "@number@", @@ -15,12 +15,12 @@ } ], "hydra:view": { - "@id": "/exchange_rates?baseTicker=ACM"eTicker=TCK1", + "@id": "/exchange_rate_lives?baseTicker=ACM"eTicker=TCK1", "@type": "hydra:PartialCollectionView" }, "hydra:search": { "@type": "hydra:IriTemplate", - "hydra:template": "/exchange_rates{?baseTicker,quoteTicker}", + "hydra:template": "/exchange_rate_lives{?baseTicker,quoteTicker}", "hydra:variableRepresentation": "BasicRepresentation", "hydra:mapping": [ { diff --git a/responses/api/exchange_rate/get/item.json b/responses/api/exchange_rate/get/item.json index a81b14b..f8e062f 100644 --- a/responses/api/exchange_rate/get/item.json +++ b/responses/api/exchange_rate/get/item.json @@ -1,7 +1,7 @@ { - "@context": "/contexts/ExchangeRate", - "@id": "/exchange_rates/@uuid@", - "@type": "ExchangeRate", + "@context": "/contexts/ExchangeRateLive", + "@id": "/exchange_rate_lives/@uuid@", + "@type": "ExchangeRateLive", "baseTicker": "ACM", "quoteTicker": "TCK1", "rate": "@number@", diff --git a/responses/api/exchange_rate/patch/valid.json b/responses/api/exchange_rate/patch/valid.json index a81b14b..f8e062f 100644 --- a/responses/api/exchange_rate/patch/valid.json +++ b/responses/api/exchange_rate/patch/valid.json @@ -1,7 +1,7 @@ { - "@context": "/contexts/ExchangeRate", - "@id": "/exchange_rates/@uuid@", - "@type": "ExchangeRate", + "@context": "/contexts/ExchangeRateLive", + "@id": "/exchange_rate_lives/@uuid@", + "@type": "ExchangeRateLive", "baseTicker": "ACM", "quoteTicker": "TCK1", "rate": "@number@", diff --git a/responses/api/exchange_rate/post/valid.json b/responses/api/exchange_rate/post/valid.json index a81b14b..f8e062f 100644 --- a/responses/api/exchange_rate/post/valid.json +++ b/responses/api/exchange_rate/post/valid.json @@ -1,7 +1,7 @@ { - "@context": "/contexts/ExchangeRate", - "@id": "/exchange_rates/@uuid@", - "@type": "ExchangeRate", + "@context": "/contexts/ExchangeRateLive", + "@id": "/exchange_rate_lives/@uuid@", + "@type": "ExchangeRateLive", "baseTicker": "ACM", "quoteTicker": "TCK1", "rate": "@number@", diff --git a/src/Exchange/Application/Command/ExchangeRate/CreateExchangeRateCommandHandler.php b/src/Exchange/Application/Command/ExchangeRate/CreateExchangeRateCommandHandler.php deleted file mode 100644 index e82e93f..0000000 --- a/src/Exchange/Application/Command/ExchangeRate/CreateExchangeRateCommandHandler.php +++ /dev/null @@ -1,45 +0,0 @@ -exchangeRateFactory->create($command->baseTicker, $command->quoteTicker, $command->rate); - - $this->validator->validate($exchangeRate, ['groups' => ['panda:create']]); - - $this->exchangeRateRepository->save($exchangeRate); - - switch (get_class($command)) { - case CreateExchangeRateCommand::class: - $this->eventBus->dispatch(new ExchangeRateCreatedEvent($exchangeRate->getId())); - break; - case CreateReversedExchangeRateCommand::class: - $this->eventBus->dispatch(new ReversedExchangeRateCreatedEvent($exchangeRate->getId())); - break; - } - - return $exchangeRate; - } -} diff --git a/src/Exchange/Application/Command/ExchangeRate/CreateReversedExchangeRateCommand.php b/src/Exchange/Application/Command/ExchangeRate/CreateReversedExchangeRateCommand.php deleted file mode 100644 index f96284d..0000000 --- a/src/Exchange/Application/Command/ExchangeRate/CreateReversedExchangeRateCommand.php +++ /dev/null @@ -1,24 +0,0 @@ -exchangeRateRepository->findById($command->id); - - if (null === $exchangeRate) { - return; - } - - $this->exchangeRateRepository->remove($exchangeRate); - } -} diff --git a/src/Exchange/Application/Command/ExchangeRate/UpdateReversedExchangeRateCommand.php b/src/Exchange/Application/Command/ExchangeRate/UpdateReversedExchangeRateCommand.php deleted file mode 100644 index b4b9ba6..0000000 --- a/src/Exchange/Application/Command/ExchangeRate/UpdateReversedExchangeRateCommand.php +++ /dev/null @@ -1,24 +0,0 @@ -exchangeRateFactory->create($command->baseTicker, $command->quoteTicker, $command->rate); + + $this->validator->validate($exchangeRate, ['groups' => ['panda:create']]); + + $this->exchangeRateRepository->save($exchangeRate); + + switch (get_class($command)) { + case CreateExchangeRateLiveCommand::class: + $this->eventBus->dispatch(new ExchangeRateLiveCreatedEvent($exchangeRate->getId())); + break; + case CreateReversedExchangeRateLiveCommand::class: + $this->eventBus->dispatch(new ReversedExchangeLiveRateCreatedEvent($exchangeRate->getId())); + break; + } + + return $exchangeRate; + } +} diff --git a/src/Exchange/Application/Command/ExchangeRateLive/CreateReversedExchangeRateLiveCommand.php b/src/Exchange/Application/Command/ExchangeRateLive/CreateReversedExchangeRateLiveCommand.php new file mode 100644 index 0000000..7c00fc5 --- /dev/null +++ b/src/Exchange/Application/Command/ExchangeRateLive/CreateReversedExchangeRateLiveCommand.php @@ -0,0 +1,24 @@ +exchangeRateRepository->findById($command->id); + + if (null === $exchangeRate) { + return; + } + + $this->exchangeRateRepository->remove($exchangeRate); + } +} diff --git a/src/Exchange/Application/Command/ExchangeRate/UpdateExchangeRateCommand.php b/src/Exchange/Application/Command/ExchangeRateLive/UpdateExchangeRateLiveCommand.php similarity index 62% rename from src/Exchange/Application/Command/ExchangeRate/UpdateExchangeRateCommand.php rename to src/Exchange/Application/Command/ExchangeRateLive/UpdateExchangeRateLiveCommand.php index fa19176..b1e60f8 100644 --- a/src/Exchange/Application/Command/ExchangeRate/UpdateExchangeRateCommand.php +++ b/src/Exchange/Application/Command/ExchangeRateLive/UpdateExchangeRateLiveCommand.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Panda\Exchange\Application\Command\ExchangeRate; +namespace Panda\Exchange\Application\Command\ExchangeRateLive; use Panda\Core\Application\Command\CommandInterface; use Symfony\Component\Uid\Uuid; -final readonly class UpdateExchangeRateCommand implements CommandInterface +final readonly class UpdateExchangeRateLiveCommand implements CommandInterface { public function __construct( public Uuid $id, diff --git a/src/Exchange/Application/Command/ExchangeRate/UpdateExchangeRateCommandHandler.php b/src/Exchange/Application/Command/ExchangeRateLive/UpdateExchangeRateLiveCommandHandler.php similarity index 50% rename from src/Exchange/Application/Command/ExchangeRate/UpdateExchangeRateCommandHandler.php rename to src/Exchange/Application/Command/ExchangeRateLive/UpdateExchangeRateLiveCommandHandler.php index 6080016..c5d48ff 100644 --- a/src/Exchange/Application/Command/ExchangeRate/UpdateExchangeRateCommandHandler.php +++ b/src/Exchange/Application/Command/ExchangeRateLive/UpdateExchangeRateLiveCommandHandler.php @@ -2,27 +2,27 @@ declare(strict_types=1); -namespace Panda\Exchange\Application\Command\ExchangeRate; +namespace Panda\Exchange\Application\Command\ExchangeRateLive; use ApiPlatform\Validator\ValidatorInterface; use Panda\Core\Application\Command\CommandHandlerInterface; use Panda\Core\Application\Event\EventBusInterface; -use Panda\Exchange\Domain\Event\ExchangeRateUpdatedEvent; -use Panda\Exchange\Domain\Event\ReversedExchangeRateUpdatedEvent; -use Panda\Exchange\Domain\Model\ExchangeRateInterface; -use Panda\Exchange\Domain\Repository\ExchangeRateRepositoryInterface; +use Panda\Exchange\Domain\Event\ExchangeRateLiveUpdatedEvent; +use Panda\Exchange\Domain\Event\ReversedExchangeRateLiveUpdatedEvent; +use Panda\Exchange\Domain\Model\ExchangeRateLiveInterface; +use Panda\Exchange\Domain\Repository\ExchangeRateLiveRepositoryInterface; use Webmozart\Assert\Assert; -final readonly class UpdateExchangeRateCommandHandler implements CommandHandlerInterface +final readonly class UpdateExchangeRateLiveCommandHandler implements CommandHandlerInterface { public function __construct( - private ExchangeRateRepositoryInterface $exchangeRateRepository, + private ExchangeRateLiveRepositoryInterface $exchangeRateRepository, private EventBusInterface $eventBus, private ValidatorInterface $validator, ) { } - public function __invoke(UpdateExchangeRateCommand|UpdateReversedExchangeRateCommand $command): ExchangeRateInterface + public function __invoke(UpdateExchangeRateLiveCommand|UpdateReversedExchangeRateLiveCommand $command): ExchangeRateLiveInterface { $exchangeRate = $this->exchangeRateRepository->findById($command->id); Assert::notNull($exchangeRate); @@ -34,11 +34,11 @@ public function __invoke(UpdateExchangeRateCommand|UpdateReversedExchangeRateCom $this->exchangeRateRepository->save($exchangeRate); switch (get_class($command)) { - case UpdateExchangeRateCommand::class: - $this->eventBus->dispatch(new ExchangeRateUpdatedEvent($exchangeRate->getId())); + case UpdateExchangeRateLiveCommand::class: + $this->eventBus->dispatch(new ExchangeRateLiveUpdatedEvent($exchangeRate->getId())); break; - case UpdateReversedExchangeRateCommand::class: - $this->eventBus->dispatch(new ReversedExchangeRateUpdatedEvent($exchangeRate->getId())); + case UpdateReversedExchangeRateLiveCommand::class: + $this->eventBus->dispatch(new ReversedExchangeRateLiveUpdatedEvent($exchangeRate->getId())); break; } diff --git a/src/Exchange/Application/Command/ExchangeRateLive/UpdateReversedExchangeRateLiveCommand.php b/src/Exchange/Application/Command/ExchangeRateLive/UpdateReversedExchangeRateLiveCommand.php new file mode 100644 index 0000000..16f973d --- /dev/null +++ b/src/Exchange/Application/Command/ExchangeRateLive/UpdateReversedExchangeRateLiveCommand.php @@ -0,0 +1,24 @@ +exchangeRateRepository->findById($event->exchangeRateId) + $createdExchangeRate = $this->exchangeRateRepository->findById($event->exchangeRateLiveId) ); $reversedExchangeRate = $this->exchangeRateRepository->findByBaseAndQuoteResources( @@ -32,18 +32,18 @@ public function __invoke(ExchangeRateCreatedEvent|ExchangeRateUpdatedEvent $even $createdExchangeRate->getBaseTicker(), ); - $reversedRate = round(1 / $createdExchangeRate->getRate(), ExchangeRateInterface::RATE_PRECISION); + $reversedRate = round(1 / $createdExchangeRate->getRate(), ExchangeRateLiveInterface::RATE_PRECISION); if (null !== $reversedExchangeRate) { $this->commandBus->dispatch( - new UpdateReversedExchangeRateCommand($reversedExchangeRate->getId(), $reversedRate) + new UpdateReversedExchangeRateLiveCommand($reversedExchangeRate->getId(), $reversedRate) ); return; } $this->commandBus->dispatch( - new CreateReversedExchangeRateCommand( + new CreateReversedExchangeRateLiveCommand( $createdExchangeRate->getQuoteTicker(), $createdExchangeRate->getBaseTicker(), $reversedRate, diff --git a/src/Exchange/Application/Query/ExchangeRate/FindExchangeRateQueryHandler.php b/src/Exchange/Application/Query/ExchangeRate/FindExchangeRateQueryHandler.php deleted file mode 100644 index bb2b624..0000000 --- a/src/Exchange/Application/Query/ExchangeRate/FindExchangeRateQueryHandler.php +++ /dev/null @@ -1,21 +0,0 @@ -exchangeRateRepository->findById($query->id); - } -} diff --git a/src/Exchange/Application/Query/ExchangeRate/FindExchangeRateQuery.php b/src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLiveQuery.php similarity index 58% rename from src/Exchange/Application/Query/ExchangeRate/FindExchangeRateQuery.php rename to src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLiveQuery.php index 3f017bc..a637994 100644 --- a/src/Exchange/Application/Query/ExchangeRate/FindExchangeRateQuery.php +++ b/src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLiveQuery.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Panda\Exchange\Application\Query\ExchangeRate; +namespace Panda\Exchange\Application\Query\ExchangeRateLive; use Panda\Core\Application\Query\QueryInterface; use Symfony\Component\Uid\Uuid; -final readonly class FindExchangeRateQuery implements QueryInterface +final readonly class FindExchangeRateLiveQuery implements QueryInterface { public function __construct( public Uuid $id, diff --git a/src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLiveQueryHandler.php b/src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLiveQueryHandler.php new file mode 100644 index 0000000..8b8ece8 --- /dev/null +++ b/src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLiveQueryHandler.php @@ -0,0 +1,21 @@ +exchangeRateRepository->findById($query->id); + } +} diff --git a/src/Exchange/Application/Query/ExchangeRate/FindExchangeRatesQuery.php b/src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLivesQuery.php similarity index 68% rename from src/Exchange/Application/Query/ExchangeRate/FindExchangeRatesQuery.php rename to src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLivesQuery.php index 0adb5ab..b055435 100644 --- a/src/Exchange/Application/Query/ExchangeRate/FindExchangeRatesQuery.php +++ b/src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLivesQuery.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Panda\Exchange\Application\Query\ExchangeRate; +namespace Panda\Exchange\Application\Query\ExchangeRateLive; use Panda\Core\Application\Query\QueryInterface; -final readonly class FindExchangeRatesQuery implements QueryInterface +final readonly class FindExchangeRateLivesQuery implements QueryInterface { public function __construct( public ?string $baseTicker = null, diff --git a/src/Exchange/Application/Query/ExchangeRate/FindExchangeRatesQueryHandler.php b/src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLivesQueryHandler.php similarity index 59% rename from src/Exchange/Application/Query/ExchangeRate/FindExchangeRatesQueryHandler.php rename to src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLivesQueryHandler.php index 9d1d5ad..b839366 100644 --- a/src/Exchange/Application/Query/ExchangeRate/FindExchangeRatesQueryHandler.php +++ b/src/Exchange/Application/Query/ExchangeRateLive/FindExchangeRateLivesQueryHandler.php @@ -2,19 +2,19 @@ declare(strict_types=1); -namespace Panda\Exchange\Application\Query\ExchangeRate; +namespace Panda\Exchange\Application\Query\ExchangeRateLive; use Panda\Core\Application\Query\QueryHandlerInterface; use Panda\Core\Domain\Repository\CollectionIteratorInterface; -use Panda\Exchange\Domain\Repository\ExchangeRateRepositoryInterface; +use Panda\Exchange\Domain\Repository\ExchangeRateLiveRepositoryInterface; -final readonly class FindExchangeRatesQueryHandler implements QueryHandlerInterface +final readonly class FindExchangeRateLivesQueryHandler implements QueryHandlerInterface { - public function __construct(private ExchangeRateRepositoryInterface $exchangeRateRepository) + public function __construct(private ExchangeRateLiveRepositoryInterface $exchangeRateRepository) { } - public function __invoke(FindExchangeRatesQuery $query): ?CollectionIteratorInterface + public function __invoke(FindExchangeRateLivesQuery $query): ?CollectionIteratorInterface { $exchangeRateQuery = $this->exchangeRateRepository->defaultQuery( $query->baseTicker, diff --git a/src/Exchange/Domain/Event/ReversedExchangeRateUpdatedEvent.php b/src/Exchange/Domain/Event/ExchangeRateLiveCreatedEvent.php similarity index 54% rename from src/Exchange/Domain/Event/ReversedExchangeRateUpdatedEvent.php rename to src/Exchange/Domain/Event/ExchangeRateLiveCreatedEvent.php index 63fd7e4..63297cc 100644 --- a/src/Exchange/Domain/Event/ReversedExchangeRateUpdatedEvent.php +++ b/src/Exchange/Domain/Event/ExchangeRateLiveCreatedEvent.php @@ -7,9 +7,9 @@ use Panda\Core\Domain\Event\EventInterface; use Symfony\Component\Uid\Uuid; -final readonly class ReversedExchangeRateUpdatedEvent implements EventInterface +final readonly class ExchangeRateLiveCreatedEvent implements EventInterface { - public function __construct(public Uuid $exchangeRateId) + public function __construct(public Uuid $exchangeRateLiveId) { } } diff --git a/src/Exchange/Domain/Event/ExchangeRateCreatedEvent.php b/src/Exchange/Domain/Event/ExchangeRateLiveUpdatedEvent.php similarity index 54% rename from src/Exchange/Domain/Event/ExchangeRateCreatedEvent.php rename to src/Exchange/Domain/Event/ExchangeRateLiveUpdatedEvent.php index 448bd94..578bc29 100644 --- a/src/Exchange/Domain/Event/ExchangeRateCreatedEvent.php +++ b/src/Exchange/Domain/Event/ExchangeRateLiveUpdatedEvent.php @@ -7,9 +7,9 @@ use Panda\Core\Domain\Event\EventInterface; use Symfony\Component\Uid\Uuid; -final readonly class ExchangeRateCreatedEvent implements EventInterface +final readonly class ExchangeRateLiveUpdatedEvent implements EventInterface { - public function __construct(public Uuid $exchangeRateId) + public function __construct(public Uuid $exchangeRateLiveId) { } } diff --git a/src/Exchange/Domain/Event/ExchangeRateUpdatedEvent.php b/src/Exchange/Domain/Event/ReversedExchangeLiveRateCreatedEvent.php similarity index 52% rename from src/Exchange/Domain/Event/ExchangeRateUpdatedEvent.php rename to src/Exchange/Domain/Event/ReversedExchangeLiveRateCreatedEvent.php index e35ca81..27f2d21 100644 --- a/src/Exchange/Domain/Event/ExchangeRateUpdatedEvent.php +++ b/src/Exchange/Domain/Event/ReversedExchangeLiveRateCreatedEvent.php @@ -7,9 +7,9 @@ use Panda\Core\Domain\Event\EventInterface; use Symfony\Component\Uid\Uuid; -final readonly class ExchangeRateUpdatedEvent implements EventInterface +final readonly class ReversedExchangeLiveRateCreatedEvent implements EventInterface { - public function __construct(public Uuid $exchangeRateId) + public function __construct(public Uuid $exchangeRateLiveId) { } } diff --git a/src/Exchange/Domain/Event/ReversedExchangeRateCreatedEvent.php b/src/Exchange/Domain/Event/ReversedExchangeRateLiveUpdatedEvent.php similarity index 52% rename from src/Exchange/Domain/Event/ReversedExchangeRateCreatedEvent.php rename to src/Exchange/Domain/Event/ReversedExchangeRateLiveUpdatedEvent.php index 6582065..0b628e2 100644 --- a/src/Exchange/Domain/Event/ReversedExchangeRateCreatedEvent.php +++ b/src/Exchange/Domain/Event/ReversedExchangeRateLiveUpdatedEvent.php @@ -7,9 +7,9 @@ use Panda\Core\Domain\Event\EventInterface; use Symfony\Component\Uid\Uuid; -final readonly class ReversedExchangeRateCreatedEvent implements EventInterface +final readonly class ReversedExchangeRateLiveUpdatedEvent implements EventInterface { - public function __construct(public Uuid $exchangeRateId) + public function __construct(public Uuid $exchangeRateLiveId) { } } diff --git a/src/Exchange/Domain/Factory/ExchangeRateFactory.php b/src/Exchange/Domain/Factory/ExchangeRateFactory.php deleted file mode 100644 index d7a8461..0000000 --- a/src/Exchange/Domain/Factory/ExchangeRateFactory.php +++ /dev/null @@ -1,16 +0,0 @@ - [self::READ_GROUP]], denormalizationContext: ['groups' => [self::CREATE_GROUP, self::UPDATE_GROUP]], - provider: ExchangeRateProvider::class, - processor: ExchangeRateProcessor::class, + provider: ExchangeRateLiveProvider::class, + processor: ExchangeRateLiveProcessor::class, )] -final class ExchangeRateResource +final class ExchangeRateLiveResource { - public const READ_GROUP = 'exchange_rate:read'; - public const CREATE_GROUP = 'exchange_rate:create'; - public const UPDATE_GROUP = 'exchange_rate:update'; + public const READ_GROUP = 'exchange_rate_live:read'; + public const CREATE_GROUP = 'exchange_rate_live:create'; + public const UPDATE_GROUP = 'exchange_rate_live:update'; public function __construct( #[ApiProperty(readable: false, writable: false, identifier: true)] @@ -68,7 +68,7 @@ public function __construct( ) { } - public static function fromModel(ExchangeRateInterface $exchangeRate): ExchangeRateResource + public static function fromModel(ExchangeRateLiveInterface $exchangeRate): ExchangeRateLiveResource { return new self( $exchangeRate->getId(), diff --git a/src/Exchange/Infrastructure/ApiState/Processor/ExchangeRateLiveProcessor.php b/src/Exchange/Infrastructure/ApiState/Processor/ExchangeRateLiveProcessor.php new file mode 100644 index 0000000..06d1fe9 --- /dev/null +++ b/src/Exchange/Infrastructure/ApiState/Processor/ExchangeRateLiveProcessor.php @@ -0,0 +1,48 @@ +commandBus->dispatch(new DeleteExchangeRateLiveCommand($uriVariables['id'])); + + return null; + } + + $command = !isset($uriVariables['id']) + ? new CreateExchangeRateLiveCommand( + (string) $data->baseTicker, + (string) $data->quoteTicker, + (float) $data->rate, + ) + : new UpdateExchangeRateLiveCommand($uriVariables['id'], (float) $data->rate); + + /** @var ExchangeRateLiveInterface $model */ + $model = $this->commandBus->dispatch($command); + + return ExchangeRateLiveResource::fromModel($model); + } +} diff --git a/src/Exchange/Infrastructure/ApiState/Processor/ExchangeRateProcessor.php b/src/Exchange/Infrastructure/ApiState/Processor/ExchangeRateProcessor.php deleted file mode 100644 index 98db1ad..0000000 --- a/src/Exchange/Infrastructure/ApiState/Processor/ExchangeRateProcessor.php +++ /dev/null @@ -1,48 +0,0 @@ -commandBus->dispatch(new DeleteExchangeRateCommand($uriVariables['id'])); - - return null; - } - - $command = !isset($uriVariables['id']) - ? new CreateExchangeRateCommand( - (string) $data->baseTicker, - (string) $data->quoteTicker, - (float) $data->rate, - ) - : new UpdateExchangeRateCommand($uriVariables['id'], (float) $data->rate); - - /** @var ExchangeRateInterface $model */ - $model = $this->commandBus->dispatch($command); - - return ExchangeRateResource::fromModel($model); - } -} diff --git a/src/Exchange/Infrastructure/ApiState/Provider/ExchangeRateProvider.php b/src/Exchange/Infrastructure/ApiState/Provider/ExchangeRateLiveProvider.php similarity index 67% rename from src/Exchange/Infrastructure/ApiState/Provider/ExchangeRateProvider.php rename to src/Exchange/Infrastructure/ApiState/Provider/ExchangeRateLiveProvider.php index d45fdb1..56ac43b 100644 --- a/src/Exchange/Infrastructure/ApiState/Provider/ExchangeRateProvider.php +++ b/src/Exchange/Infrastructure/ApiState/Provider/ExchangeRateLiveProvider.php @@ -11,13 +11,13 @@ use Panda\Core\Application\Query\QueryBusInterface; use Panda\Core\Infrastructure\ApiState\Pagination\Paginator; use Panda\Core\Infrastructure\Doctrine\Orm\DoctrineCollectionIterator; -use Panda\Exchange\Application\Query\ExchangeRate\FindExchangeRateQuery; -use Panda\Exchange\Application\Query\ExchangeRate\FindExchangeRatesQuery; -use Panda\Exchange\Domain\Model\ExchangeRate; -use Panda\Exchange\Infrastructure\ApiResource\ExchangeRateResource; +use Panda\Exchange\Application\Query\ExchangeRateLive\FindExchangeRateLiveQuery; +use Panda\Exchange\Application\Query\ExchangeRateLive\FindExchangeRateLivesQuery; +use Panda\Exchange\Domain\Model\ExchangeRateLive; +use Panda\Exchange\Infrastructure\ApiResource\ExchangeRateLiveResource; use Symfony\Component\Uid\Uuid; -final readonly class ExchangeRateProvider implements ProviderInterface +final readonly class ExchangeRateLiveProvider implements ProviderInterface { public function __construct( private QueryBusInterface $queryBus, @@ -26,7 +26,7 @@ public function __construct( } /** - * @return ExchangeRateResource|Paginator|array + * @return ExchangeRateLiveResource|Paginator|array */ public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null { @@ -48,8 +48,8 @@ public function provide(Operation $operation, array $uriVariables = [], array $c ? (string) $context['filters']['quoteTicker'] : null; - /** @var DoctrineCollectionIterator $models */ - $models = $this->queryBus->ask(new FindExchangeRatesQuery( + /** @var DoctrineCollectionIterator $models */ + $models = $this->queryBus->ask(new FindExchangeRateLivesQuery( $baseTicker, $quoteTicker, $offset, @@ -59,7 +59,7 @@ public function provide(Operation $operation, array $uriVariables = [], array $c $resources = []; foreach ($models as $model) { - $resources[] = ExchangeRateResource::fromModel($model); + $resources[] = ExchangeRateLiveResource::fromModel($model); } if (null !== $paginator = $models->paginator()) { @@ -75,11 +75,11 @@ public function provide(Operation $operation, array $uriVariables = [], array $c return $resources; } - private function provideItem(Uuid $id): ?ExchangeRateResource + private function provideItem(Uuid $id): ?ExchangeRateLiveResource { - /** @var ExchangeRate|null $model */ - $model = $this->queryBus->ask(new FindExchangeRateQuery($id)); + /** @var ExchangeRateLive|null $model */ + $model = $this->queryBus->ask(new FindExchangeRateLiveQuery($id)); - return null !== $model ? ExchangeRateResource::fromModel($model) : null; + return null !== $model ? ExchangeRateLiveResource::fromModel($model) : null; } } diff --git a/src/Exchange/Infrastructure/Configuration/Doctrine/mapping.yaml b/src/Exchange/Infrastructure/Configuration/Doctrine/mapping.yaml index 198a789..158d7e6 100644 --- a/src/Exchange/Infrastructure/Configuration/Doctrine/mapping.yaml +++ b/src/Exchange/Infrastructure/Configuration/Doctrine/mapping.yaml @@ -1,9 +1,9 @@ doctrine: orm: mappings: - ExchangeRate: + ExchangeRateLive: is_bundle: false type: xml dir: '%kernel.project_dir%/src/Exchange/Infrastructure/Configuration/Doctrine/mappings' prefix: 'Panda\Exchange\Domain\Model' - alias: ExchangeRate + alias: ExchangeRateLive diff --git a/src/Exchange/Infrastructure/Configuration/Doctrine/mappings/ExchangeRate.orm.xml b/src/Exchange/Infrastructure/Configuration/Doctrine/mappings/ExchangeRateLive.orm.xml similarity index 89% rename from src/Exchange/Infrastructure/Configuration/Doctrine/mappings/ExchangeRate.orm.xml rename to src/Exchange/Infrastructure/Configuration/Doctrine/mappings/ExchangeRateLive.orm.xml index 8b8827a..c3fdf2a 100644 --- a/src/Exchange/Infrastructure/Configuration/Doctrine/mappings/ExchangeRate.orm.xml +++ b/src/Exchange/Infrastructure/Configuration/Doctrine/mappings/ExchangeRateLive.orm.xml @@ -4,7 +4,7 @@ xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:gedmo="http://gediminasm.org/schemas/orm/doctrine-extensions-mapping" > - + diff --git a/src/Exchange/Infrastructure/Configuration/Symfony/Service/api_state/processor.php b/src/Exchange/Infrastructure/Configuration/Symfony/Service/api_state/processor.php index a11bc9b..b4b136c 100644 --- a/src/Exchange/Infrastructure/Configuration/Symfony/Service/api_state/processor.php +++ b/src/Exchange/Infrastructure/Configuration/Symfony/Service/api_state/processor.php @@ -3,14 +3,14 @@ declare(strict_types=1); use Panda\Core\Application\Command\CommandBusInterface; -use Panda\Exchange\Infrastructure\ApiState\Processor\ExchangeRateProcessor; +use Panda\Exchange\Infrastructure\ApiState\Processor\ExchangeRateLiveProcessor; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use function Symfony\Component\DependencyInjection\Loader\Configurator\service; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); - $services->set(ExchangeRateProcessor::class) + $services->set(ExchangeRateLiveProcessor::class) ->args([service(CommandBusInterface::class)]) ->autoconfigure(false) ->tag('api_platform.state_processor', ['priority' => 0]); diff --git a/src/Exchange/Infrastructure/Configuration/Symfony/Service/api_state/provider.php b/src/Exchange/Infrastructure/Configuration/Symfony/Service/api_state/provider.php index f8bc305..c515828 100644 --- a/src/Exchange/Infrastructure/Configuration/Symfony/Service/api_state/provider.php +++ b/src/Exchange/Infrastructure/Configuration/Symfony/Service/api_state/provider.php @@ -4,14 +4,14 @@ use ApiPlatform\State\Pagination\Pagination; use Panda\Core\Application\Query\QueryBusInterface; -use Panda\Exchange\Infrastructure\ApiState\Provider\ExchangeRateProvider; +use Panda\Exchange\Infrastructure\ApiState\Provider\ExchangeRateLiveProvider; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use function Symfony\Component\DependencyInjection\Loader\Configurator\service; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); - $services->set(ExchangeRateProvider::class) + $services->set(ExchangeRateLiveProvider::class) ->args([ service(QueryBusInterface::class), service(Pagination::class), diff --git a/src/Exchange/Infrastructure/Configuration/Symfony/Service/command_handlers.php b/src/Exchange/Infrastructure/Configuration/Symfony/Service/command_handlers.php index f93ebb9..dfc72a4 100644 --- a/src/Exchange/Infrastructure/Configuration/Symfony/Service/command_handlers.php +++ b/src/Exchange/Infrastructure/Configuration/Symfony/Service/command_handlers.php @@ -4,21 +4,21 @@ use ApiPlatform\Validator\ValidatorInterface; use Panda\Core\Application\Event\EventBusInterface; -use Panda\Exchange\Application\Command\ExchangeRate\CreateExchangeRateCommandHandler; -use Panda\Exchange\Application\Command\ExchangeRate\DeleteExchangeRateCommandHandler; -use Panda\Exchange\Application\Command\ExchangeRate\UpdateExchangeRateCommandHandler; -use Panda\Exchange\Domain\Factory\ExchangeRateFactoryInterface; -use Panda\Exchange\Domain\Repository\ExchangeRateRepositoryInterface; +use Panda\Exchange\Application\Command\ExchangeRateLive\CreateExchangeRateLiveCommandHandler; +use Panda\Exchange\Application\Command\ExchangeRateLive\DeleteExchangeRateLiveCommandHandler; +use Panda\Exchange\Application\Command\ExchangeRateLive\UpdateExchangeRateLiveCommandHandler; +use Panda\Exchange\Domain\Factory\ExchangeRateLiveFactoryInterface; +use Panda\Exchange\Domain\Repository\ExchangeRateLiveRepositoryInterface; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use function Symfony\Component\DependencyInjection\Loader\Configurator\service; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); - $services->set(CreateExchangeRateCommandHandler::class) + $services->set(CreateExchangeRateLiveCommandHandler::class) ->args([ - service(ExchangeRateRepositoryInterface::class), - service(ExchangeRateFactoryInterface::class), + service(ExchangeRateLiveRepositoryInterface::class), + service(ExchangeRateLiveFactoryInterface::class), service(EventBusInterface::class), service(ValidatorInterface::class), ]) @@ -26,9 +26,9 @@ 'bus' => 'command.bus', ]); - $services->set(UpdateExchangeRateCommandHandler::class) + $services->set(UpdateExchangeRateLiveCommandHandler::class) ->args([ - service(ExchangeRateRepositoryInterface::class), + service(ExchangeRateLiveRepositoryInterface::class), service(EventBusInterface::class), service(ValidatorInterface::class), ]) @@ -36,8 +36,8 @@ 'bus' => 'command.bus', ]); - $services->set(DeleteExchangeRateCommandHandler::class) - ->args([service(ExchangeRateRepositoryInterface::class)]) + $services->set(DeleteExchangeRateLiveCommandHandler::class) + ->args([service(ExchangeRateLiveRepositoryInterface::class)]) ->tag('messenger.message_handler', [ 'bus' => 'command.bus', ]); diff --git a/src/Exchange/Infrastructure/Configuration/Symfony/Service/event_listeners.php b/src/Exchange/Infrastructure/Configuration/Symfony/Service/event_listeners.php index 958ca15..3892aa6 100644 --- a/src/Exchange/Infrastructure/Configuration/Symfony/Service/event_listeners.php +++ b/src/Exchange/Infrastructure/Configuration/Symfony/Service/event_listeners.php @@ -3,17 +3,17 @@ declare(strict_types=1); use Panda\Core\Application\Command\CommandBusInterface; -use Panda\Exchange\Application\EventListener\CreateOrUpdateReversedExchangeRateWhenExchangeRateChanged; -use Panda\Exchange\Domain\Repository\ExchangeRateRepositoryInterface; +use Panda\Exchange\Application\EventListener\CreateOrUpdateReversedExchangeRateLiveWhenExchangeRateLiveChanged; +use Panda\Exchange\Domain\Repository\ExchangeRateLiveRepositoryInterface; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use function Symfony\Component\DependencyInjection\Loader\Configurator\service; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); - $services->set(CreateOrUpdateReversedExchangeRateWhenExchangeRateChanged::class) + $services->set(CreateOrUpdateReversedExchangeRateLiveWhenExchangeRateLiveChanged::class) ->args([ - service(ExchangeRateRepositoryInterface::class), + service(ExchangeRateLiveRepositoryInterface::class), service(CommandBusInterface::class), ]) ->tag('messenger.message_handler', [ diff --git a/src/Exchange/Infrastructure/Configuration/Symfony/Service/factory.php b/src/Exchange/Infrastructure/Configuration/Symfony/Service/factory.php index c0184ec..f72ccd2 100644 --- a/src/Exchange/Infrastructure/Configuration/Symfony/Service/factory.php +++ b/src/Exchange/Infrastructure/Configuration/Symfony/Service/factory.php @@ -2,13 +2,13 @@ declare(strict_types=1); -use Panda\Exchange\Domain\Factory\ExchangeRateFactory; -use Panda\Exchange\Domain\Factory\ExchangeRateFactoryInterface; +use Panda\Exchange\Domain\Factory\ExchangeRateLiveFactory; +use Panda\Exchange\Domain\Factory\ExchangeRateLiveFactoryInterface; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); - $services->set(ExchangeRateFactoryInterface::class) - ->class(ExchangeRateFactory::class); + $services->set(ExchangeRateLiveFactoryInterface::class) + ->class(ExchangeRateLiveFactory::class); }; diff --git a/src/Exchange/Infrastructure/Configuration/Symfony/Service/query_handlers.php b/src/Exchange/Infrastructure/Configuration/Symfony/Service/query_handlers.php index 964bb7d..ae872aa 100644 --- a/src/Exchange/Infrastructure/Configuration/Symfony/Service/query_handlers.php +++ b/src/Exchange/Infrastructure/Configuration/Symfony/Service/query_handlers.php @@ -2,23 +2,23 @@ declare(strict_types=1); -use Panda\Exchange\Application\Query\ExchangeRate\FindExchangeRateQueryHandler; -use Panda\Exchange\Application\Query\ExchangeRate\FindExchangeRatesQueryHandler; -use Panda\Exchange\Domain\Repository\ExchangeRateRepositoryInterface; +use Panda\Exchange\Application\Query\ExchangeRateLive\FindExchangeRateLiveQueryHandler; +use Panda\Exchange\Application\Query\ExchangeRateLive\FindExchangeRateLivesQueryHandler; +use Panda\Exchange\Domain\Repository\ExchangeRateLiveRepositoryInterface; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use function Symfony\Component\DependencyInjection\Loader\Configurator\service; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); - $services->set(FindExchangeRateQueryHandler::class) - ->args([service(ExchangeRateRepositoryInterface::class)]) + $services->set(FindExchangeRateLiveQueryHandler::class) + ->args([service(ExchangeRateLiveRepositoryInterface::class)]) ->tag('messenger.message_handler', [ 'bus' => 'query.bus', ]); - $services->set(FindExchangeRatesQueryHandler::class) - ->args([service(ExchangeRateRepositoryInterface::class)]) + $services->set(FindExchangeRateLivesQueryHandler::class) + ->args([service(ExchangeRateLiveRepositoryInterface::class)]) ->tag('messenger.message_handler', [ 'bus' => 'query.bus', ]); diff --git a/src/Exchange/Infrastructure/Configuration/Symfony/Service/repository.php b/src/Exchange/Infrastructure/Configuration/Symfony/Service/repository.php index 1269d97..8096053 100644 --- a/src/Exchange/Infrastructure/Configuration/Symfony/Service/repository.php +++ b/src/Exchange/Infrastructure/Configuration/Symfony/Service/repository.php @@ -3,15 +3,15 @@ declare(strict_types=1); use Doctrine\ORM\EntityManagerInterface; -use Panda\Exchange\Domain\Repository\ExchangeRateRepositoryInterface; -use Panda\Exchange\Infrastructure\Doctrine\Orm\ExchangeRateRepository; +use Panda\Exchange\Domain\Repository\ExchangeRateLiveRepositoryInterface; +use Panda\Exchange\Infrastructure\Doctrine\Orm\ExchangeRateLiveRepository; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use function Symfony\Component\DependencyInjection\Loader\Configurator\service; return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); - $services->set(ExchangeRateRepositoryInterface::class) - ->class(ExchangeRateRepository::class) + $services->set(ExchangeRateLiveRepositoryInterface::class) + ->class(ExchangeRateLiveRepository::class) ->args([service(EntityManagerInterface::class)]); }; diff --git a/src/Exchange/Infrastructure/Configuration/Symfony/validation/ExchangeRate.xml b/src/Exchange/Infrastructure/Configuration/Symfony/validation/ExchangeRateLive.xml similarity index 97% rename from src/Exchange/Infrastructure/Configuration/Symfony/validation/ExchangeRate.xml rename to src/Exchange/Infrastructure/Configuration/Symfony/validation/ExchangeRateLive.xml index 4017921..dc1d301 100644 --- a/src/Exchange/Infrastructure/Configuration/Symfony/validation/ExchangeRate.xml +++ b/src/Exchange/Infrastructure/Configuration/Symfony/validation/ExchangeRateLive.xml @@ -5,7 +5,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/services/constraint-mapping-1.0.xsd" > - +