23 lines
885 B
C#
23 lines
885 B
C#
using FictionArchive.Service.NovelService.Models.IntegrationEvents;
|
|
using FictionArchive.Service.Shared.Services.EventBus;
|
|
|
|
namespace FictionArchive.Service.NovelService.Services.EventHandlers;
|
|
|
|
public class NovelUpdateRequestedEventHandler : IIntegrationEventHandler<NovelUpdateRequestedEvent>
|
|
{
|
|
private readonly ILogger<NovelUpdateRequestedEventHandler> _logger;
|
|
private readonly IEventBus _eventBus;
|
|
private readonly NovelUpdateService _novelUpdateService;
|
|
|
|
public NovelUpdateRequestedEventHandler(ILogger<NovelUpdateRequestedEventHandler> logger, IEventBus eventBus, NovelUpdateService novelUpdateService)
|
|
{
|
|
_logger = logger;
|
|
_eventBus = eventBus;
|
|
_novelUpdateService = novelUpdateService;
|
|
}
|
|
|
|
public async Task Handle(NovelUpdateRequestedEvent @event)
|
|
{
|
|
await _novelUpdateService.ImportNovel(@event.NovelUrl);
|
|
}
|
|
} |