From 41ca08f20e9801375d0ef0e50c5d1c8ab1052dfe Mon Sep 17 00:00:00 2001 From: "ext.jeremy.guillot@maxicoffee.domains" Date: Thu, 12 Mar 2026 00:57:21 +0100 Subject: [PATCH 1/2] feat: notification system via Mercure for scraping events - NotificationInterface: add sendInfo() and sendWarning() levels - SymfonyNotification: implement new levels (publishes to 'notifications' topic) - ChapterScrapingStarted: carry mangaTitle + chapterNumber, now dispatched - ScrapeChapterHandler: dispatch ChapterScrapingStarted before scraping loop - ScrapingEventSubscriber: wire NotificationInterface for started/scraped/failed events - useMercureNotifications: new global Vue composable subscribing to 'notifications' topic - App.vue: mount useMercureNotifications() at app root - SendTestNotificationCommand: `app:notify:test --type --message` for dev/prod testing Co-Authored-By: Claude Sonnet 4.6 --- assets/vue/app/App.vue | 3 + .../composables/useMercureNotifications.js | 45 +++++++++++++++ src/Command/SendTestNotificationCommand.php | 55 +++++++++++++++++++ .../CommandHandler/ScrapeChapterHandler.php | 8 ++- .../Domain/Event/ChapterScrapingStarted.php | 12 +++- .../ScrapingEventSubscriber.php | 50 +++++++++-------- .../Domain/Contract/NotificationInterface.php | 13 ++--- .../Service/SymfonyNotification.php | 20 ++++--- .../ScrapeChapterHandlerTest.php | 15 +++-- 9 files changed, 171 insertions(+), 50 deletions(-) create mode 100644 assets/vue/app/shared/composables/useMercureNotifications.js create mode 100644 src/Command/SendTestNotificationCommand.php diff --git a/assets/vue/app/App.vue b/assets/vue/app/App.vue index ef20952..6219e3b 100644 --- a/assets/vue/app/App.vue +++ b/assets/vue/app/App.vue @@ -5,6 +5,9 @@ diff --git a/config/packages/messenger.yaml b/config/packages/messenger.yaml index cdf9b6d..3fffec8 100644 --- a/config/packages/messenger.yaml +++ b/config/packages/messenger.yaml @@ -29,7 +29,7 @@ framework: 'App\Domain\Manga\Application\Command\RefreshMangaChapters': commands # Events spécifiques (pour compatibilité, peuvent être supprimés si tous implémentent AsyncDomainEvent) - 'App\Domain\Scraping\Domain\Event\ChapterScrapingStarted': events + # ChapterScrapingStarted est synchrone pour que la notif "démarrage" arrive AVANT le scraping 'App\Domain\Scraping\Domain\Event\ChapterScrapingCompleted': events 'App\Domain\Scraping\Domain\Event\ChapterScrapingFailed': events 'App\Domain\Manga\Domain\Event\ChapterReadyForScraping': events