using Chatbot.Api.Application.Commands; using Chatbot.Api.Application.Events; using Chatbot.Api.Domain.Repositories; using MediatR; using System.Threading; using System.Threading.Tasks; namespace Chatbot.Api.Application.CommandHandlers { public class CloseChatHandler : IRequestHandler { private readonly IChatRepository _chatRepository; public CloseChatHandler(IChatRepository chatRepository) { _chatRepository = chatRepository; } public async Task Handle(CloseChat request, CancellationToken cancellationToken) { await _chatRepository.CloseChat(request.ChatId); return new ChatClosed(request.ChatId); } } }