2026-08-13 23:12:57 +07:00
|
|
|
using MediatR;
|
2026-08-13 23:10:22 +07:00
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Mws.Application.Auth;
|
|
|
|
|
|
|
|
|
|
namespace Mws.Api.Controllers;
|
|
|
|
|
|
|
|
|
|
[ApiController]
|
|
|
|
|
[Route("api/auth")]
|
|
|
|
|
[AllowAnonymous]
|
2026-08-13 23:12:57 +07:00
|
|
|
public class AuthController(ISender sender) : ControllerBase
|
2026-08-13 23:10:22 +07:00
|
|
|
{
|
|
|
|
|
[HttpPost("login")]
|
|
|
|
|
public async Task<ActionResult<LoginResponse>> Login([FromBody] LoginRequest request, CancellationToken ct)
|
|
|
|
|
{
|
2026-08-13 23:12:57 +07:00
|
|
|
var response = await sender.Send(new LoginCommand(request), ct);
|
2026-08-13 23:10:22 +07:00
|
|
|
return Ok(response);
|
|
|
|
|
}
|
2026-08-13 23:12:57 +07:00
|
|
|
}
|