Update doc and todo (#4)

* Updade doc

* Updade doc
This commit is contained in:
Oda
2024-07-20 21:33:50 +07:00
committed by GitHub
parent a43e560d3a
commit 743d04e6c5
12 changed files with 483 additions and 71 deletions

View File

@@ -6,6 +6,9 @@ using Microsoft.AspNetCore.Mvc;
namespace Managing.Api.Controllers;
/// <summary>
/// Provides authentication-related actions, including token creation for user authentication.
/// </summary>
[ApiController]
[Route("[controller]")]
[Produces("application/json")]
@@ -15,6 +18,12 @@ public class UserController : ControllerBase
private readonly IUserService _userService;
private readonly IJwtUtils _jwtUtils;
/// <summary>
/// Initializes a new instance of the <see cref="UserController"/> class.
/// </summary>
/// <param name="config">Configuration settings.</param>
/// <param name="userService">Service for user-related operations.</param>
/// <param name="jwtUtils">Utility for JWT token operations.</param>
public UserController(IConfiguration config, IUserService userService, IJwtUtils jwtUtils)
{
_config = config;
@@ -22,6 +31,11 @@ public class UserController : ControllerBase
_jwtUtils = jwtUtils;
}
/// <summary>
/// Creates a JWT token for a user based on the provided login credentials.
/// </summary>
/// <param name="login">The login request containing user credentials.</param>
/// <returns>A JWT token if authentication is successful; otherwise, an Unauthorized result.</returns>
[AllowAnonymous]
[HttpPost]
public async Task<ActionResult<string>> CreateToken([FromBody] LoginRequest login)
@@ -36,4 +50,4 @@ public class UserController : ControllerBase
return Unauthorized();
}
}
}