Revise authentication and remove unnecessary code
This commit is contained in:
		| @@ -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; | ||||
|  | ||||
|   | ||||
| @@ -1,12 +0,0 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
|  | ||||
| namespace Core.Thalos.Application.UseCases.Users.Input | ||||
| { | ||||
|     public class AcceptUserConsentFormRequest : ICommand | ||||
|     { | ||||
|         public bool Validate() | ||||
|         { | ||||
|             return true; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -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; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -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; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -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 | ||||
|   | ||||
| @@ -1,12 +0,0 @@ | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
|  | ||||
| namespace Core.Thalos.Application.UseCases.Users.Input | ||||
| { | ||||
|     public class GetConsentFormPDFRequest : ICommand | ||||
|     { | ||||
|         public bool Validate() | ||||
|         { | ||||
|             return true; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -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; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -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; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sergio Matias Urquin
					Sergio Matias Urquin