Skip to content

Commit

Permalink
readme update, new exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawel Malisak committed Mar 11, 2024
1 parent d0c9e63 commit 4b69544
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .idea/sonarlint/issuestore/index.pb

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

12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

`docker compose build --no-cache` to build fresh images

`docker compose up` - to run application
`docker compose up` to run application

Setup application:

Expand Down Expand Up @@ -53,17 +53,19 @@ I am sorry, no endpoint for fetch, you need to check database ( port 5430 ! ).
- you can send notification
- you can define several providers for the same type of notification channel
- a notification is delayed and later resent if all providers fail ( retry strategy )
- provided an abstraction between at least two different messaging service providers ( BUT the second is mocker )
- architecture:
- DDD ( Notification aggregate )
- Hexagonal
- CQRS
- unit and functional tests
- unit and functional tests

## What is not done

- no supervisor to trigger scheduled notifications ( must be run manually )
- small number of tests :(
- bonuses
- there is no second provider, instead there is a mock

## What could be done better
## More time

- add: phpcs, infection, deptrac, more tests
- add: phpcs, infection, deptrac, tests !!!
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace App\Notification\Infrastructure\Doctrine\Exception;

class NotFoundException extends \Exception
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use App\Notification\Domain\Notification;
use App\Notification\Domain\Repository\NotificationRepository;
use App\Notification\Infrastructure\Doctrine\Exception\NotFoundException;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Uid\Uuid;
Expand All @@ -21,7 +22,7 @@ public function __construct(ManagerRegistry $registry)
}
public function get(Uuid $notificationId): Notification
{
return $this->find($notificationId) ?: throw new \Exception('Not found');
return $this->find($notificationId) ?: throw new NotFoundException('Notification not found');
}

public function add(Notification $notification): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Notification\Domain\Provider\Provider;
use App\Notification\Domain\Provider\ProviderConfiguration;
use App\Notification\Domain\Provider\ProviderConfigurationRepository;
use App\Notification\Infrastructure\Doctrine\Exception\NotFoundException;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;

Expand All @@ -29,6 +30,6 @@ public function getAvailableProviders(Channel $channel): array
public function get(Provider $provider, Channel $channel): ProviderConfiguration
{
return $this->findOneBy(['provider' => $provider, 'channel' => $channel])
?? throw new \Exception('Not found');
?? throw new NotFoundException('ProviderConfiguration not found');
}
}

0 comments on commit 4b69544

Please sign in to comment.