예제 #1
0
        public async Task HandleAsync(RemarkDeleted @event)
        => await _handler
        .Run(async() =>
        {
            var remark = await _repository.GetByIdAsync(@event.RemarkId);
            if (remark.HasNoValue)
            {
                return;
            }

            await _repository.DeleteAsync(remark.Value);
            await _groupRemarkRepository.DeleteAllForRemarkAsync(@event.RemarkId);
            await _remarkCache.DeleteAsync(@event.RemarkId, deleteGeo: true, deleteLatest: true);
            await _userCache.DeleteRemarkAsync(remark.Value.Author.UserId, @event.RemarkId);
        })
        .OnError((ex, logger) =>
        {
            logger.Error(ex, $"Error occured while handling {@event.GetType().Name} event");
        })
        .ExecuteAsync();