using Chatbot.Api.Application.Commands; using Chatbot.Api.Application.Queries; using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; namespace Chatbot.Api.Controllers { [Authorize] [ApiController] [Route("chat")] public class ChatController : ControllerBase { private readonly IMediator _mediator; public ChatController(IMediator mediator) { _mediator = mediator; } [HttpGet("initialize/{sessionId}")] public async Task GetChat([FromRoute] GetChat.Query query) { var result = await _mediator.Send(query); return Ok(result); } [HttpPost("message")] public async Task SaveChatMessage([FromBody] SaveChatMessage saveChatMessage) { var result = await _mediator.Send(saveChatMessage); return Ok(result); } } }