39 lines
1008 B
C#
39 lines
1008 B
C#
using ColaFlow.Modules.Identity.Application.Commands.Login;
|
|
using MediatR;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace ColaFlow.API.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("api/[controller]")]
|
|
public class AuthController : ControllerBase
|
|
{
|
|
private readonly IMediator _mediator;
|
|
|
|
public AuthController(IMediator mediator)
|
|
{
|
|
_mediator = mediator;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Login with email and password
|
|
/// </summary>
|
|
[HttpPost("login")]
|
|
public async Task<IActionResult> Login([FromBody] LoginCommand command)
|
|
{
|
|
var result = await _mediator.Send(command);
|
|
return Ok(result);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get current user (requires authentication)
|
|
/// </summary>
|
|
[HttpGet("me")]
|
|
// [Authorize] // TODO: Add after JWT middleware is configured
|
|
public async Task<IActionResult> GetCurrentUser()
|
|
{
|
|
// TODO: Implement after JWT middleware
|
|
return Ok(new { message = "Current user endpoint - to be implemented" });
|
|
}
|
|
}
|