ProyectoGrupal/dolibarr-bff/DoliMiddlewareApi/Controllers/AuthController.cs

20 lines
682 B
C#

using DoliMiddlewareApi.Dtos.command;
using DoliMiddlewareApi.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace DoliMiddlewareApi.Controllers;
[ApiController]
[Route("api/[controller]")]
public class AuthController(AuthApplicationService authAppService) : ControllerBase
{
[HttpPost("login")]
[ProducesResponseType(typeof(LoginResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)]
public async Task<ActionResult<LoginResponse>> Login([FromBody] CreateTokenDto dto)
{
var result = await authAppService.LoginAsync(dto);
return Ok(result);
}
}