Removing duplicated lines - wip

This commit is contained in:
2025-06-19 00:30:16 +02:00
parent e1a249c07a
commit 8bc50f8135
14 changed files with 581 additions and 626 deletions

View File

@@ -6,6 +6,7 @@ using BasicDotnetTemplate.MainProject.Models.Api.Request.Auth;
using BasicDotnetTemplate.MainProject.Models.Api.Response;
using BasicDotnetTemplate.MainProject.Models.Api.Response.Auth;
using BasicDotnetTemplate.MainProject.Services;
using BasicDotnetTemplate.MainProject.Core.Filters;
namespace BasicDotnetTemplate.MainProject.Controllers
{
@@ -21,29 +22,16 @@ namespace BasicDotnetTemplate.MainProject.Controllers
this._authService = authService;
}
[ModelStateValidationHandledByFilterAttribute]
[HttpPost("authenticate")]
[ProducesResponseType<AuthenticateResponse>(StatusCodes.Status200OK)]
[ProducesResponseType<BaseResponse<object>>(StatusCodes.Status404NotFound)]
[ProducesResponseType<BaseResponse<object>>(StatusCodes.Status400BadRequest)]
[ProducesResponseType<BaseResponse<object>>(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> AuthenticateAsync([FromBody] AuthenticateRequest request)
public async Task<IActionResult> AuthenticateAsync([FromBody] AuthenticateRequest request) //NOSONAR
{
try
{
if (!ModelState.IsValid)
{
return BadRequest(_requestNotWellFormed);
}
if (
request == null ||
request.Data == null ||
String.IsNullOrEmpty(request.Data.Email) ||
String.IsNullOrEmpty(request.Data.Password)
)
{
return BadRequest(_requestNotWellFormed);
}
var data = await this._authService.AuthenticateAsync(request.Data);
if (data == null)