Revise authentication and remove unnecessary code

This commit is contained in:
Sergio Matias Urquin
2025-07-27 19:33:19 -06:00
parent 598081acea
commit abcddaba9d
44 changed files with 81 additions and 495 deletions

View File

@@ -1,6 +1,6 @@
using Core.Blueprint.Storage.Adapters;
using Core.Thalos.Adapters;
using Core.Thalos.Application.UseCases.Users.Ports;
using Core.Thalos.BuildingBlocks;
using Lib.Architecture.BuildingBlocks;
using Microsoft.AspNetCore.Mvc;

View File

@@ -1,12 +0,0 @@
using Lib.Architecture.BuildingBlocks;
namespace Core.Thalos.Application.UseCases.Users.Input
{
public class AcceptUserConsentFormRequest : ICommand
{
public bool Validate()
{
return true;
}
}
}

View File

@@ -1,14 +0,0 @@
using Lib.Architecture.BuildingBlocks;
namespace Core.Thalos.Application.UseCases.Users.Input
{
public class AddCompanyToUserRequest : Notificator, ICommand
{
public string UserId { get; set; }
public string CompanyId { get; set; }
public bool Validate()
{
return true;
}
}
}

View File

@@ -1,14 +0,0 @@
using Lib.Architecture.BuildingBlocks;
namespace Core.Thalos.Application.UseCases.Users.Input
{
public class AddProjectToUserRequest : Notificator, ICommand
{
public string UserId { get; set; }
public string ProjectId { get; set; }
public bool Validate()
{
return true;
}
}
}

View File

@@ -1,4 +1,4 @@
using Core.Thalos.Adapters.Common.Enums;
using Core.Blueprint.Mongo;
using Lib.Architecture.BuildingBlocks;
namespace Core.Thalos.Application.UseCases.Users.Input

View File

@@ -1,12 +0,0 @@
using Lib.Architecture.BuildingBlocks;
namespace Core.Thalos.Application.UseCases.Users.Input
{
public class GetConsentFormPDFRequest : ICommand
{
public bool Validate()
{
return true;
}
}
}

View File

@@ -1,14 +0,0 @@
using Lib.Architecture.BuildingBlocks;
namespace Core.Thalos.Application.UseCases.Users.Input
{
public class RemoveCompanyFromUserRequest : Notificator, ICommand
{
public string UserId { get; set; }
public string CompanyId { get; set; }
public bool Validate()
{
return true;
}
}
}

View File

@@ -1,14 +0,0 @@
using Lib.Architecture.BuildingBlocks;
namespace Core.Thalos.Application.UseCases.Users.Input
{
public class RemoveProjectFromUserRequest : Notificator, ICommand
{
public string UserId { get; set; }
public string ProjectId { get; set; }
public bool Validate()
{
return true;
}
}
}

View File

@@ -1,5 +1,5 @@
using Core.Blueprint.Storage.Adapters;
using Core.Thalos.Adapters;
using Core.Thalos.BuildingBlocks;
using Lib.Architecture.BuildingBlocks;
namespace Core.Thalos.Application.UseCases.Users.Ports

View File

@@ -1,6 +1,6 @@
using Core.Thalos.Adapters;
using Core.Thalos.Application.UseCases.Users.Input;
using Core.Thalos.Application.UseCases.Users.Input;
using Core.Thalos.Application.UseCases.Users.Ports;
using Core.Thalos.BuildingBlocks;
using Core.Thalos.External.Clients;
using Core.Thalos.External.Clients.Requests;
using FluentValidation;
@@ -15,10 +15,6 @@ namespace Core.Thalos.Application.UseCases.Users
IComponentHandler<GetUserRequest>,
IComponentHandler<GetUserByEmailRequest>,
IComponentHandler<CreateUserRequest>,
IComponentHandler<AddProjectToUserRequest>,
IComponentHandler<RemoveProjectFromUserRequest>,
IComponentHandler<AddCompanyToUserRequest>,
IComponentHandler<RemoveCompanyFromUserRequest>,
IComponentHandler<LoginUserRequest>,
IComponentHandler<LogoutUserRequest>,
IComponentHandler<ValidateUserExistenceRequest>,
@@ -177,8 +173,6 @@ namespace Core.Thalos.Application.UseCases.Users
MiddleName = command.MiddleName,
LastName = command.LastName,
RoleId = command.RoleId,
Companies = command.Companies,
Projects = command.Projects,
};
var result = await _thalosDALService.CreateUserAsync(request, command.SendInvitation, cancellationToken).ConfigureAwait(false);
@@ -217,8 +211,6 @@ namespace Core.Thalos.Application.UseCases.Users
MiddleName = command.MiddleName,
LastName = command.LastName,
RoleId = command.RoleId,
Companies = command.Companies,
Projects = command.Projects
};
var result = await _thalosDALService.UpdateUserAsync(request, request.Id, cancellationToken).ConfigureAwait(false);
@@ -281,94 +273,6 @@ namespace Core.Thalos.Application.UseCases.Users
}
}
public async ValueTask ExecuteAsync(AddCompanyToUserRequest command, CancellationToken cancellationToken = default)
{
try
{
ArgumentNullException.ThrowIfNull(command);
var result = await _thalosDALService.AddCompanyToUserAsync(command.UserId, command.CompanyId, cancellationToken).ConfigureAwait(false);
if (result == null)
{
_port.NoContentSuccess();
return;
}
_port.Success(result);
}
catch (Exception ex)
{
ApiResponseHelper.EvaluatePort(ex, _port);
}
}
public async ValueTask ExecuteAsync(RemoveCompanyFromUserRequest command, CancellationToken cancellationToken = default)
{
try
{
ArgumentNullException.ThrowIfNull(command);
var result = await _thalosDALService.RemoveCompanyToUserAsync(command.UserId, command.CompanyId, cancellationToken).ConfigureAwait(false);
if (result == null)
{
_port.NoContentSuccess();
return;
}
_port.Success(result);
}
catch (Exception ex)
{
ApiResponseHelper.EvaluatePort(ex, _port);
}
}
public async ValueTask ExecuteAsync(AddProjectToUserRequest command, CancellationToken cancellationToken = default)
{
try
{
ArgumentNullException.ThrowIfNull(command);
var result = await _thalosDALService.AddProjectToUserAsync(command.UserId, command.ProjectId, cancellationToken).ConfigureAwait(false);
if (result == null)
{
_port.NoContentSuccess();
return;
}
_port.Success(result);
}
catch (Exception ex)
{
ApiResponseHelper.EvaluatePort(ex, _port);
}
}
public async ValueTask ExecuteAsync(RemoveProjectFromUserRequest command, CancellationToken cancellationToken = default)
{
try
{
ArgumentNullException.ThrowIfNull(command);
var result = await _thalosDALService.RemoveProjectToUserAsync(command.UserId, command.ProjectId, cancellationToken).ConfigureAwait(false);
if (result == null)
{
_port.NoContentSuccess();
return;
}
_port.Success(result);
}
catch (Exception ex)
{
ApiResponseHelper.EvaluatePort(ex, _port);
}
}
public async ValueTask ExecuteAsync(GetTokenAdapterRequest command, CancellationToken cancellationToken = default)
{
try