refactor(notifications): remove factory indirection, interface, and listener duplication

Remove NotificationRepositoryFactory, NotificationServicesFactory, and
NotificationRepositoryInterface — all single-consumer abstractions with
no polymorphism benefit. Simplify container registrar to wire services
directly. Extract shared listener logic (sanitizeTenantIds,
resolveDisplayName, resolveUuid) into NotificationListenerTrait,
eliminating duplication across 4 listeners.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 12:01:11 +01:00
parent 6ea3c2b88c
commit e746a2e874
13 changed files with 83 additions and 167 deletions

View File

@@ -2,7 +2,7 @@
namespace MintyPHP\Tests\Module\Notifications\Service;
use MintyPHP\Module\Notifications\Repository\NotificationRepositoryInterface;
use MintyPHP\Module\Notifications\Repository\NotificationRepository;
use MintyPHP\Module\Notifications\Service\NotificationMessage;
use MintyPHP\Module\Notifications\Service\NotificationService;
use MintyPHP\Repository\Tenant\UserTenantRepositoryInterface;
@@ -11,13 +11,13 @@ use PHPUnit\Framework\TestCase;
class NotificationServiceTest extends TestCase
{
private NotificationRepositoryInterface&MockObject $notifRepo;
private NotificationRepository&MockObject $notifRepo;
private UserTenantRepositoryInterface&MockObject $utRepo;
private NotificationService $service;
protected function setUp(): void
{
$this->notifRepo = $this->createMock(NotificationRepositoryInterface::class);
$this->notifRepo = $this->createMock(NotificationRepository::class);
$this->utRepo = $this->createMock(UserTenantRepositoryInterface::class);
$this->service = new NotificationService($this->notifRepo, $this->utRepo);
}