Compare commits
	
		
			10 Commits
		
	
	
		
			feature/fi
			...
			f3d63ca0e3
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | f3d63ca0e3 | ||
|   | abcddaba9d | ||
| c1637b9e20 | |||
|   | 598081acea | ||
|   | 6d884d0d8b | ||
|   | 4d43ac70cd | ||
| 3b42b60757 | |||
| 4cea65632b | |||
| a9981b6eb3 | |||
| a09540f20a | 
| @@ -1,5 +1,5 @@ | |||||||
| using Core.Thalos.Adapters; | using Core.Thalos.Application.UseCases.Modules.Ports; | ||||||
| using Core.Thalos.Application.UseCases.Modules.Ports; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Modules.Input | namespace Core.Thalos.Application.UseCases.Modules.Input | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Modules.Input | namespace Core.Thalos.Application.UseCases.Modules.Input | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Modules.Input | namespace Core.Thalos.Application.UseCases.Modules.Input | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Core.Thalos.Adapters; | using Core.Thalos.Application.UseCases.Modules.Input; | ||||||
| using Core.Thalos.Application.UseCases.Modules.Input; |  | ||||||
| using Core.Thalos.Application.UseCases.Modules.Ports; | using Core.Thalos.Application.UseCases.Modules.Ports; | ||||||
|  | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.External.Clients; | using Core.Thalos.External.Clients; | ||||||
| using Core.Thalos.External.Clients.Requests; | using Core.Thalos.External.Clients.Requests; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Modules.Ports | namespace Core.Thalos.Application.UseCases.Modules.Ports | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| using Core.Thalos.Adapters; | using Core.Thalos.Application.UseCases.Permissions.Ports; | ||||||
| using Core.Thalos.Application.UseCases.Permissions.Ports; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Permissions.Input | namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Constants; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Permissions.Input | namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||||
|   | |||||||
| @@ -1,5 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Constants; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Adapters.Common.Enums; |  | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Permissions.Input | namespace Core.Thalos.Application.UseCases.Permissions.Input | ||||||
| @@ -10,7 +9,7 @@ namespace Core.Thalos.Application.UseCases.Permissions.Input | |||||||
|         public string Name { get; set; } = null!; |         public string Name { get; set; } = null!; | ||||||
|         public string? Description { get; set; } |         public string? Description { get; set; } | ||||||
|         public AccessLevelEnum? AccessLevel { get; set; } = null!; |         public AccessLevelEnum? AccessLevel { get; set; } = null!; | ||||||
|         public StatusEnum Status { get; set; } |         public Blueprint.Mongo.StatusEnum Status { get; set; } | ||||||
|         public bool Validate() |         public bool Validate() | ||||||
|         { |         { | ||||||
|             return Id != null; |             return Id != null; | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Core.Thalos.Adapters; | using Core.Thalos.Application.UseCases.Permissions.Input; | ||||||
| using Core.Thalos.Application.UseCases.Permissions.Input; |  | ||||||
| using Core.Thalos.Application.UseCases.Permissions.Ports; | using Core.Thalos.Application.UseCases.Permissions.Ports; | ||||||
|  | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.External.Clients; | using Core.Thalos.External.Clients; | ||||||
| using Core.Thalos.External.Clients.Requests; | using Core.Thalos.External.Clients.Requests; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Permissions.Ports | namespace Core.Thalos.Application.UseCases.Permissions.Ports | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| using Core.Thalos.Adapters; | using Core.Thalos.Application.UseCases.Roles.Ports; | ||||||
| using Core.Thalos.Application.UseCases.Roles.Ports; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Roles.Input | namespace Core.Thalos.Application.UseCases.Roles.Input | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Blueprint.Mongo; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Roles.Input | namespace Core.Thalos.Application.UseCases.Roles.Input | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using System.Text.Json.Serialization; | using System.Text.Json.Serialization; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Roles.Input | namespace Core.Thalos.Application.UseCases.Roles.Input | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using System.Text.Json.Serialization; | using System.Text.Json.Serialization; | ||||||
|  |  | ||||||
| @@ -14,7 +14,7 @@ namespace Core.Thalos.Application.UseCases.Roles.Input | |||||||
|         public ApplicationsEnum[]? Applications { get; set; } |         public ApplicationsEnum[]? Applications { get; set; } | ||||||
|         public string[] Modules { get; set; } = null!; |         public string[] Modules { get; set; } = null!; | ||||||
|         public string[] Permissions { get; set; } = null!; |         public string[] Permissions { get; set; } = null!; | ||||||
|         public StatusEnum Status { get; set; } |         public Blueprint.Mongo.StatusEnum Status { get; set; } | ||||||
|  |  | ||||||
|         public bool Validate() |         public bool Validate() | ||||||
|         { |         { | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Roles.Ports | namespace Core.Thalos.Application.UseCases.Roles.Ports | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Core.Thalos.Adapters; | using Core.Thalos.Application.UseCases.Roles.Input; | ||||||
| using Core.Thalos.Application.UseCases.Roles.Input; |  | ||||||
| using Core.Thalos.Application.UseCases.Roles.Ports; | using Core.Thalos.Application.UseCases.Roles.Ports; | ||||||
|  | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.External.Clients; | using Core.Thalos.External.Clients; | ||||||
| using Core.Thalos.External.Clients.Requests; | using Core.Thalos.External.Clients.Requests; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| using Core.Blueprint.Storage.Adapters; | using Core.Blueprint.Storage.Adapters; | ||||||
| using Core.Thalos.Adapters; |  | ||||||
| using Core.Thalos.Application.UseCases.Users.Ports; | using Core.Thalos.Application.UseCases.Users.Ports; | ||||||
|  | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Mvc; | 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; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Users.Input | 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.Blueprint.Storage.Adapters; | ||||||
| using Core.Thalos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Application.UseCases.Users.Ports | 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.Application.UseCases.Users.Ports; | ||||||
|  | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.External.Clients; | using Core.Thalos.External.Clients; | ||||||
| using Core.Thalos.External.Clients.Requests; | using Core.Thalos.External.Clients.Requests; | ||||||
| using FluentValidation; | using FluentValidation; | ||||||
| @@ -15,10 +15,6 @@ namespace Core.Thalos.Application.UseCases.Users | |||||||
|         IComponentHandler<GetUserRequest>, |         IComponentHandler<GetUserRequest>, | ||||||
|         IComponentHandler<GetUserByEmailRequest>, |         IComponentHandler<GetUserByEmailRequest>, | ||||||
|         IComponentHandler<CreateUserRequest>, |         IComponentHandler<CreateUserRequest>, | ||||||
|         IComponentHandler<AddProjectToUserRequest>, |  | ||||||
|         IComponentHandler<RemoveProjectFromUserRequest>, |  | ||||||
|         IComponentHandler<AddCompanyToUserRequest>, |  | ||||||
|         IComponentHandler<RemoveCompanyFromUserRequest>, |  | ||||||
|         IComponentHandler<LoginUserRequest>, |         IComponentHandler<LoginUserRequest>, | ||||||
|         IComponentHandler<LogoutUserRequest>, |         IComponentHandler<LogoutUserRequest>, | ||||||
|         IComponentHandler<ValidateUserExistenceRequest>, |         IComponentHandler<ValidateUserExistenceRequest>, | ||||||
| @@ -177,8 +173,6 @@ namespace Core.Thalos.Application.UseCases.Users | |||||||
|                     MiddleName = command.MiddleName, |                     MiddleName = command.MiddleName, | ||||||
|                     LastName = command.LastName, |                     LastName = command.LastName, | ||||||
|                     RoleId = command.RoleId, |                     RoleId = command.RoleId, | ||||||
|                     Companies = command.Companies, |  | ||||||
|                     Projects = command.Projects, |  | ||||||
|                 }; |                 }; | ||||||
|  |  | ||||||
|                 var result = await _thalosDALService.CreateUserAsync(request, command.SendInvitation, cancellationToken).ConfigureAwait(false); |                 var result = await _thalosDALService.CreateUserAsync(request, command.SendInvitation, cancellationToken).ConfigureAwait(false); | ||||||
| @@ -217,8 +211,6 @@ namespace Core.Thalos.Application.UseCases.Users | |||||||
|                     MiddleName = command.MiddleName, |                     MiddleName = command.MiddleName, | ||||||
|                     LastName = command.LastName, |                     LastName = command.LastName, | ||||||
|                     RoleId = command.RoleId, |                     RoleId = command.RoleId, | ||||||
|                     Companies = command.Companies, |  | ||||||
|                     Projects = command.Projects |  | ||||||
|                 }; |                 }; | ||||||
|  |  | ||||||
|                 var result = await _thalosDALService.UpdateUserAsync(request, request.Id, cancellationToken).ConfigureAwait(false); |                 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) |         public async ValueTask ExecuteAsync(GetTokenAdapterRequest command, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
|             try |             try | ||||||
|   | |||||||
| @@ -1,7 +1,4 @@ | |||||||
| using Core.Blueprint.Storage.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Adapters; |  | ||||||
| using Core.Thalos.Adapters.Common.Constants; |  | ||||||
| using Core.Thalos.Adapters.Common.Enums; |  | ||||||
| using Core.Thalos.External.Clients.Requests; | using Core.Thalos.External.Clients.Requests; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| using Refit; | using Refit; | ||||||
| @@ -35,23 +32,11 @@ namespace Core.Thalos.External.Clients | |||||||
|         Task<UserAdapter> LogoutUserAsync([FromRoute] string email, CancellationToken cancellationToken = default); |         Task<UserAdapter> LogoutUserAsync([FromRoute] string email, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|         [Patch("/v1/User/" + Routes.ChangeStatus)] |         [Patch("/v1/User/" + Routes.ChangeStatus)] | ||||||
|         Task<UserAdapter> ChangeUserStatusAsync([FromRoute] string id, StatusEnum newStatus, CancellationToken cancellationToken = default); |         Task<UserAdapter> ChangeUserStatusAsync([FromRoute] string id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|         [Get("/v1/User/{email}/GetTokenAdapter")] |         [Get("/v1/User/{email}/GetTokenAdapter")] | ||||||
|         Task<TokenAdapter> GetTokenAdapter([FromRoute] string email, CancellationToken cancellationToken = default); |         Task<TokenAdapter> GetTokenAdapter([FromRoute] string email, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|         [Post("/v1/User/" + Routes.AddCompany)] |  | ||||||
|         Task<UserAdapter> AddCompanyToUserAsync([FromRoute] string userId, [FromRoute] string companyId, CancellationToken cancellationToken = default); |  | ||||||
|  |  | ||||||
|         [Delete("/v1/User/" + Routes.RemoveCompany)] |  | ||||||
|         Task<UserAdapter> RemoveCompanyToUserAsync([FromRoute] string userId, [FromRoute] string companyId, CancellationToken cancellationToken = default); |  | ||||||
|  |  | ||||||
|         [Post("/v1/User/" + Routes.AddProject)] |  | ||||||
|         Task<UserAdapter> AddProjectToUserAsync([FromRoute] string userId, [FromRoute] string projectId, CancellationToken cancellationToken = default); |  | ||||||
|  |  | ||||||
|         [Delete("/v1/User/" + Routes.RemoveProject)] |  | ||||||
|         Task<UserAdapter> RemoveProjectToUserAsync([FromRoute] string userId, [FromRoute] string projectId, CancellationToken cancellationToken = default); |  | ||||||
|  |  | ||||||
|         [Get("/v1/Role")] |         [Get("/v1/Role")] | ||||||
|         Task<IEnumerable<RoleAdapter>> GetAllRolesAsync(CancellationToken cancellationToken = default); |         Task<IEnumerable<RoleAdapter>> GetAllRolesAsync(CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
| @@ -65,7 +50,7 @@ namespace Core.Thalos.External.Clients | |||||||
|         Task<RoleAdapter> UpdateRoleAsync([FromBody] RoleAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); |         Task<RoleAdapter> UpdateRoleAsync([FromBody] RoleAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|         [Patch("/v1/Role/" + Routes.ChangeStatus)] |         [Patch("/v1/Role/" + Routes.ChangeStatus)] | ||||||
|         Task<RoleAdapter> ChangeRoleStatusAsync([FromRoute] string id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken = default); |         Task<RoleAdapter> ChangeRoleStatusAsync([FromRoute] string id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|         [Post("/v1/Role/" + Routes.AddApplication)] |         [Post("/v1/Role/" + Routes.AddApplication)] | ||||||
|         Task<RoleAdapter> AddApplicationToRoleAsync([FromRoute] string RoleId, [FromRoute] ApplicationsEnum application, CancellationToken cancellationToken = default); |         Task<RoleAdapter> AddApplicationToRoleAsync([FromRoute] string RoleId, [FromRoute] ApplicationsEnum application, CancellationToken cancellationToken = default); | ||||||
| @@ -89,7 +74,7 @@ namespace Core.Thalos.External.Clients | |||||||
|         Task<PermissionAdapter> UpdatePermissionAsync([FromBody] PermissionAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); |         Task<PermissionAdapter> UpdatePermissionAsync([FromBody] PermissionAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|         [Patch("/v1/Permission/" + Routes.ChangeStatus)] |         [Patch("/v1/Permission/" + Routes.ChangeStatus)] | ||||||
|         Task<PermissionAdapter> ChangeStatusPermissionAsync([FromRoute] string id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken = default); |         Task<PermissionAdapter> ChangeStatusPermissionAsync([FromRoute] string id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|         [Get("/v1/Module")] |         [Get("/v1/Module")] | ||||||
|         Task<IEnumerable<ModuleAdapter>> GetAllModulesAsync(CancellationToken cancellationToken = default); |         Task<IEnumerable<ModuleAdapter>> GetAllModulesAsync(CancellationToken cancellationToken = default); | ||||||
| @@ -107,6 +92,6 @@ namespace Core.Thalos.External.Clients | |||||||
|         Task<ModuleAdapter> UpdateModuleAsync([FromBody] ModuleAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); |         Task<ModuleAdapter> UpdateModuleAsync([FromBody] ModuleAdapter entity, [FromRoute] string id, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|         [Patch("/v1/Module/" + Routes.ChangeStatus)] |         [Patch("/v1/Module/" + Routes.ChangeStatus)] | ||||||
|         Task<ModuleAdapter> ChangeStatusModuleAsync([FromRoute] string id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken = default); |         Task<ModuleAdapter> ChangeStatusModuleAsync([FromRoute] string id, [FromRoute] Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using System.Text.Json.Serialization; | using System.Text.Json.Serialization; | ||||||
|  |  | ||||||
| namespace Core.Thalos.External.Clients.Requests | namespace Core.Thalos.External.Clients.Requests | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Constants; | using Core.Thalos.BuildingBlocks; | ||||||
|  |  | ||||||
| namespace Core.Thalos.External.Clients.Requests | namespace Core.Thalos.External.Clients.Requests | ||||||
| { | { | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using System.Text.Json.Serialization; | using System.Text.Json.Serialization; | ||||||
|  |  | ||||||
| namespace Core.Thalos.External.Clients.Requests | namespace Core.Thalos.External.Clients.Requests | ||||||
|   | |||||||
| @@ -7,7 +7,5 @@ | |||||||
|         public string? MiddleName { get; set; } |         public string? MiddleName { get; set; } | ||||||
|         public string LastName { get; set; } = null!; |         public string LastName { get; set; } = null!; | ||||||
|         public string RoleId { get; set; } = null!; |         public string RoleId { get; set; } = null!; | ||||||
|         public string[] Companies { get; set; } = null!; |  | ||||||
|         public string[]? Projects { get; set; } |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -7,8 +7,8 @@ | |||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="Core.Blueprint.Storage" Version="1.0.0" /> |     <PackageReference Include="Core.Blueprint.Storage" Version="1.0.1" /> | ||||||
|     <PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.0.2" /> |     <PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.0.8" /> | ||||||
|     <PackageReference Include="Lib.Architecture.BuildingBlocks" Version="1.0.0" /> |     <PackageReference Include="Lib.Architecture.BuildingBlocks" Version="1.0.0" /> | ||||||
|     <PackageReference Include="Refit" Version="8.0.0" /> |     <PackageReference Include="Refit" Version="8.0.0" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   | |||||||
| @@ -1,9 +1,7 @@ | |||||||
| using Asp.Versioning; | using Asp.Versioning; | ||||||
| using Core.Thalos.Adapters; |  | ||||||
| using Core.Thalos.Adapters.Attributes; |  | ||||||
| using Core.Thalos.Adapters.Common.Constants; |  | ||||||
| using Core.Thalos.Application.UseCases.Modules.Input; | using Core.Thalos.Application.UseCases.Modules.Input; | ||||||
| using Core.Thalos.Application.UseCases.Modules.Ports; | using Core.Thalos.Application.UseCases.Modules.Ports; | ||||||
|  | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| @@ -17,6 +15,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|     [Route("api/v{api-version:apiVersion}/[controller]")] |     [Route("api/v{api-version:apiVersion}/[controller]")] | ||||||
|     [Produces("application/json")] |     [Produces("application/json")] | ||||||
|     [ApiController] |     [ApiController] | ||||||
|  |     [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|     public class ModuleController : ControllerBase |     public class ModuleController : ControllerBase | ||||||
|     { |     { | ||||||
|         private readonly IComponentHandler<GetModuleRequest> getModuleHandler; |         private readonly IComponentHandler<GetModuleRequest> getModuleHandler; | ||||||
| @@ -60,8 +59,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("ModuleManagement.Read, RoleManagement.Read")] | ||||||
|         //[Permission("ModuleManagement.Read, RoleManagement.Read")] |  | ||||||
|         public async Task<IActionResult> GetAllModulesAsync(CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllModulesAsync(CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             await getAllModulesHandler.ExecuteAsync(new GetAllModulesRequest { }, cancellationToken).ConfigureAwait(false); |             await getAllModulesHandler.ExecuteAsync(new GetAllModulesRequest { }, cancellationToken).ConfigureAwait(false); | ||||||
| @@ -91,8 +89,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("ModuleManagement.Read")] | ||||||
|         //[Permission("ModuleManagement.Read")] |  | ||||||
|         public async Task<IActionResult> GetAllModulesByListAsync([FromBody] GetAllModulesByListRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllModulesByListAsync([FromBody] GetAllModulesByListRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|  |  | ||||||
| @@ -118,8 +115,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("ModuleManagement.Read")] | ||||||
|         //[Permission("ModuleManagement.Read")] |  | ||||||
|         public async Task<IActionResult> GetModuleById([FromBody] GetModuleRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetModuleById([FromBody] GetModuleRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|  |  | ||||||
| @@ -144,8 +140,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("ModuleManagement.Write")] | ||||||
|         //[Permission("ModuleManagement.Write")] |  | ||||||
|         public async Task<IActionResult> CreateModuleAsync([FromBody] CreateModuleRequest newModule, CancellationToken cancellationToken = default) |         public async Task<IActionResult> CreateModuleAsync([FromBody] CreateModuleRequest newModule, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
|             await createModuleHandler.ExecuteAsync(newModule, cancellationToken).ConfigureAwait(false); |             await createModuleHandler.ExecuteAsync(newModule, cancellationToken).ConfigureAwait(false); | ||||||
| @@ -164,8 +159,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("ModuleManagement.Write")] | ||||||
|         //[Permission("ModuleManagement.Write")] |  | ||||||
|         public async Task<IActionResult> UpdateModuleAsync([FromBody] UpdateModuleRequest request, CancellationToken cancellationToken = default) |         public async Task<IActionResult> UpdateModuleAsync([FromBody] UpdateModuleRequest request, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
|             await updateModuleHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); |             await updateModuleHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); | ||||||
| @@ -185,8 +179,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("ModuleManagement.Write")] | ||||||
|         //[Permission("ModuleManagement.Write")] |  | ||||||
|         public async Task<IActionResult> ChangeModuleStatusAsync([FromBody] ChangeModuleStatusRequest request, |         public async Task<IActionResult> ChangeModuleStatusAsync([FromBody] ChangeModuleStatusRequest request, | ||||||
|                                                                      CancellationToken cancellationToken) |                                                                      CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|   | |||||||
| @@ -1,9 +1,7 @@ | |||||||
| using Asp.Versioning; | using Asp.Versioning; | ||||||
| using Core.Thalos.Adapters; |  | ||||||
| using Core.Thalos.Adapters.Attributes; |  | ||||||
| using Core.Thalos.Adapters.Common.Constants; |  | ||||||
| using Core.Thalos.Application.UseCases.Permissions.Input; | using Core.Thalos.Application.UseCases.Permissions.Input; | ||||||
| using Core.Thalos.Application.UseCases.Permissions.Ports; | using Core.Thalos.Application.UseCases.Permissions.Ports; | ||||||
|  | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| @@ -17,6 +15,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|     [Route("api/v{api-version:apiVersion}/[controller]")] |     [Route("api/v{api-version:apiVersion}/[controller]")] | ||||||
|     [Produces("application/json")] |     [Produces("application/json")] | ||||||
|     [ApiController] |     [ApiController] | ||||||
|  |     [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|     public class PermissionController : ControllerBase |     public class PermissionController : ControllerBase | ||||||
|     { |     { | ||||||
|         private readonly IComponentHandler<GetPermissionRequest> getPermissionHandler; |         private readonly IComponentHandler<GetPermissionRequest> getPermissionHandler; | ||||||
| @@ -60,8 +59,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("PermissionManagement.Read, RoleManagement.Read")] | ||||||
|         //[Permission("PermissionManagement.Read, RoleManagement.Read")] |  | ||||||
|         public async Task<IActionResult> GetAllPermissionsAsync(CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllPermissionsAsync(CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             await getAllPermissionsHandler.ExecuteAsync(new GetAllPermissionsRequest { }, cancellationToken).ConfigureAwait(false); |             await getAllPermissionsHandler.ExecuteAsync(new GetAllPermissionsRequest { }, cancellationToken).ConfigureAwait(false); | ||||||
| @@ -91,8 +89,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("PermissionManagement.Read")] | ||||||
|         //[Permission("PermissionManagement.Read")] |  | ||||||
|         public async Task<IActionResult> GetAllPermissionsByListAsync([FromBody] GetAllPermissionsByListRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllPermissionsByListAsync([FromBody] GetAllPermissionsByListRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|  |  | ||||||
| @@ -118,8 +115,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("PermissionManagement.Read")] | ||||||
|         //[Permission("PermissionManagement.Read")] |  | ||||||
|         public async Task<IActionResult> GetPermissionById([FromBody] GetPermissionRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetPermissionById([FromBody] GetPermissionRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|  |  | ||||||
| @@ -144,8 +140,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("PermissionManagement.Write")] | ||||||
|         //[Permission("PermissionManagement.Write")] |  | ||||||
|         public async Task<IActionResult> CreatePermissionAsync([FromBody] CreatePermissionRequest newPermission, CancellationToken cancellationToken = default) |         public async Task<IActionResult> CreatePermissionAsync([FromBody] CreatePermissionRequest newPermission, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
|             await createPermissionHandler.ExecuteAsync(newPermission, cancellationToken).ConfigureAwait(false); |             await createPermissionHandler.ExecuteAsync(newPermission, cancellationToken).ConfigureAwait(false); | ||||||
| @@ -164,8 +159,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("PermissionManagement.Write")] | ||||||
|         //[Permission("PermissionManagement.Write")] |  | ||||||
|         public async Task<IActionResult> UpdatePermissionAsync([FromBody] UpdatePermissionRequest request, CancellationToken cancellationToken = default) |         public async Task<IActionResult> UpdatePermissionAsync([FromBody] UpdatePermissionRequest request, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
|             await updatePermissionHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); |             await updatePermissionHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); | ||||||
| @@ -185,8 +179,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("PermissionManagement.Write")] | ||||||
|         //[Permission("PermissionManagement.Write")] |  | ||||||
|         public async Task<IActionResult> ChangePermissionStatusAsync([FromBody] ChangePermissionStatusRequest request, |         public async Task<IActionResult> ChangePermissionStatusAsync([FromBody] ChangePermissionStatusRequest request, | ||||||
|                                                                      CancellationToken cancellationToken) |                                                                      CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|   | |||||||
| @@ -1,8 +1,7 @@ | |||||||
| using Asp.Versioning; | using Asp.Versioning; | ||||||
| using Core.Thalos.Adapters.Attributes; |  | ||||||
| using Core.Thalos.Adapters.Common.Constants; |  | ||||||
| using Core.Thalos.Application.UseCases.Roles.Input; | using Core.Thalos.Application.UseCases.Roles.Input; | ||||||
| using Core.Thalos.Application.UseCases.Roles.Ports; | using Core.Thalos.Application.UseCases.Roles.Ports; | ||||||
|  | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| @@ -16,7 +15,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|     [Route("api/v{api-version:apiVersion}/[controller]")] |     [Route("api/v{api-version:apiVersion}/[controller]")] | ||||||
|     [Produces("application/json")] |     [Produces("application/json")] | ||||||
|     [ApiController] |     [ApiController] | ||||||
|     //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |     [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|     public class RoleController : ControllerBase |     public class RoleController : ControllerBase | ||||||
|     { |     { | ||||||
|         private readonly IComponentHandler<GetRoleRequest> getRoleHandler; |         private readonly IComponentHandler<GetRoleRequest> getRoleHandler; | ||||||
| @@ -63,8 +62,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("RoleManagement.Read")] | ||||||
|         //[Permission("RoleManagement.Read")] |  | ||||||
|         public async Task<IActionResult> GetAllRolesAsync(CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllRolesAsync(CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             await getAllRolesHandler.ExecuteAsync(new GetAllRolesRequest { }, cancellationToken).ConfigureAwait(false); |             await getAllRolesHandler.ExecuteAsync(new GetAllRolesRequest { }, cancellationToken).ConfigureAwait(false); | ||||||
| @@ -84,8 +82,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("RoleManagement.Read")] | ||||||
|         //[Permission("RoleManagement.Read")] |  | ||||||
|         public async Task<IActionResult> GetRoleById([FromBody] GetRoleRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetRoleById([FromBody] GetRoleRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid role identifier"); } |             if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid role identifier"); } | ||||||
| @@ -106,8 +103,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("RoleManagement.Write")] | ||||||
|         //[Permission("RoleManagement.Write")] |  | ||||||
|         public async Task<IActionResult> CreateRoleAsync([FromBody] CreateRoleRequest newRole, CancellationToken cancellationToken = default) |         public async Task<IActionResult> CreateRoleAsync([FromBody] CreateRoleRequest newRole, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
|             await createRoleHandler.ExecuteAsync(newRole, cancellationToken).ConfigureAwait(false); |             await createRoleHandler.ExecuteAsync(newRole, cancellationToken).ConfigureAwait(false); | ||||||
| @@ -126,8 +122,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("RoleManagement.Write")] | ||||||
|         //[Permission("RoleManagement.Write")] |  | ||||||
|         public async Task<IActionResult> UpdateRoleAsync([FromBody] UpdateRoleRequest entity, CancellationToken cancellationToken = default) |         public async Task<IActionResult> UpdateRoleAsync([FromBody] UpdateRoleRequest entity, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
|             await updateRoleHandler.ExecuteAsync(entity, cancellationToken).ConfigureAwait(false); |             await updateRoleHandler.ExecuteAsync(entity, cancellationToken).ConfigureAwait(false); | ||||||
| @@ -147,8 +142,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("RoleManagement.Write")] | ||||||
|         //[Permission("RoleManagement.Write")] |  | ||||||
|         public async Task<IActionResult> ChageRoleStatusAsync(ChangeRoleStatusRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> ChageRoleStatusAsync(ChangeRoleStatusRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid role identifier"); } |             if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid role identifier"); } | ||||||
| @@ -170,8 +164,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("RoleManagement.Write")] | ||||||
|         //[Permission("RoleManagement.Write")] |  | ||||||
|         public async Task<IActionResult> AddApplicationToRoleAsync(AddApplicationToRoleRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> AddApplicationToRoleAsync(AddApplicationToRoleRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             if (string.IsNullOrEmpty(request.RoleId)) { return BadRequest("Invalid role identifier"); } |             if (string.IsNullOrEmpty(request.RoleId)) { return BadRequest("Invalid role identifier"); } | ||||||
| @@ -193,8 +186,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Permission("RoleManagement.Write")] | ||||||
|         //[Permission("RoleManagement.Write")] |  | ||||||
|         public async Task<IActionResult> RemoveApplicationToRoleAsync(RemoveApplicationFromRoleRequest request, |         public async Task<IActionResult> RemoveApplicationToRoleAsync(RemoveApplicationFromRoleRequest request, | ||||||
|                                                                    CancellationToken cancellationToken) |                                                                    CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|   | |||||||
| @@ -1,9 +1,7 @@ | |||||||
| using Asp.Versioning; | using Asp.Versioning; | ||||||
| using Core.Thalos.Adapters; |  | ||||||
| using Core.Thalos.Adapters.Attributes; |  | ||||||
| using Core.Thalos.Adapters.Common.Constants; |  | ||||||
| using Core.Thalos.Application.UseCases.Users.Input; | using Core.Thalos.Application.UseCases.Users.Input; | ||||||
| using Core.Thalos.Application.UseCases.Users.Ports; | using Core.Thalos.Application.UseCases.Users.Ports; | ||||||
|  | using Core.Thalos.BuildingBlocks; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| @@ -25,10 +23,6 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         private readonly IComponentHandler<CreateUserRequest> createUserHandler; |         private readonly IComponentHandler<CreateUserRequest> createUserHandler; | ||||||
|         private readonly IComponentHandler<UpdateUserRequest> updateUserHandler; |         private readonly IComponentHandler<UpdateUserRequest> updateUserHandler; | ||||||
|         private readonly IComponentHandler<ChangeUserStatusRequest> ChangeUserStatusHandler; |         private readonly IComponentHandler<ChangeUserStatusRequest> ChangeUserStatusHandler; | ||||||
|         private readonly IComponentHandler<AddCompanyToUserRequest> addCompanyToUserHandler; |  | ||||||
|         private readonly IComponentHandler<RemoveCompanyFromUserRequest> removeCompanyFromUserHandler; |  | ||||||
|         private readonly IComponentHandler<AddProjectToUserRequest> addProjectToUserHandler; |  | ||||||
|         private readonly IComponentHandler<RemoveProjectFromUserRequest> removeProjectFromUserHandler; |  | ||||||
|         private readonly IComponentHandler<LoginUserRequest> loginUserHandler; |         private readonly IComponentHandler<LoginUserRequest> loginUserHandler; | ||||||
|         private readonly IComponentHandler<LogoutUserRequest> logoutUserHandler; |         private readonly IComponentHandler<LogoutUserRequest> logoutUserHandler; | ||||||
|         private readonly IComponentHandler<ValidateUserExistenceRequest> validateUserHandler; |         private readonly IComponentHandler<ValidateUserExistenceRequest> validateUserHandler; | ||||||
| @@ -45,10 +39,6 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|             IComponentHandler<CreateUserRequest> createUserHandler, |             IComponentHandler<CreateUserRequest> createUserHandler, | ||||||
|             IComponentHandler<UpdateUserRequest> updateUserHandler, |             IComponentHandler<UpdateUserRequest> updateUserHandler, | ||||||
|             IComponentHandler<ChangeUserStatusRequest> changeUserStatusHandler, |             IComponentHandler<ChangeUserStatusRequest> changeUserStatusHandler, | ||||||
|             IComponentHandler<AddCompanyToUserRequest> addCompanyToUserHandler, |  | ||||||
|             IComponentHandler<RemoveCompanyFromUserRequest> removeCompanyFromUserHandler, |  | ||||||
|             IComponentHandler<AddProjectToUserRequest> addProjectToUserHandler, |  | ||||||
|             IComponentHandler<RemoveProjectFromUserRequest> removeProjectFromUserHandler, |  | ||||||
|             IComponentHandler<LoginUserRequest> loginUserHandler, |             IComponentHandler<LoginUserRequest> loginUserHandler, | ||||||
|             IComponentHandler<LogoutUserRequest> logoutUserHandler, |             IComponentHandler<LogoutUserRequest> logoutUserHandler, | ||||||
|             IComponentHandler<ValidateUserExistenceRequest> validateUserHandler, |             IComponentHandler<ValidateUserExistenceRequest> validateUserHandler, | ||||||
| @@ -62,10 +52,6 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|             this.getAllUsersHandler = getAllUsersHandler; |             this.getAllUsersHandler = getAllUsersHandler; | ||||||
|             this.getUserHandler = getUserHandler; |             this.getUserHandler = getUserHandler; | ||||||
|             this.getUserByEmailHandler = getUserByEmailHandler; |             this.getUserByEmailHandler = getUserByEmailHandler; | ||||||
|             this.addCompanyToUserHandler = addCompanyToUserHandler; |  | ||||||
|             this.removeCompanyFromUserHandler = removeCompanyFromUserHandler; |  | ||||||
|             this.addProjectToUserHandler = addProjectToUserHandler; |  | ||||||
|             this.removeProjectFromUserHandler = removeProjectFromUserHandler; |  | ||||||
|             this.loginUserHandler = loginUserHandler; |             this.loginUserHandler = loginUserHandler; | ||||||
|             this.logoutUserHandler = logoutUserHandler; |             this.logoutUserHandler = logoutUserHandler; | ||||||
|             this.validateUserHandler = validateUserHandler; |             this.validateUserHandler = validateUserHandler; | ||||||
| @@ -84,8 +70,8 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         //[Permission("UserManagement.Read")] |         [Permission("UserManagement.Read")] | ||||||
|         public async Task<IActionResult> GetAllUsersAsync(CancellationToken cancellationToken) |         public async Task<IActionResult> GetAllUsersAsync(CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             await getAllUsersHandler.ExecuteAsync(new GetAllUsersRequest { }, cancellationToken).ConfigureAwait(false); |             await getAllUsersHandler.ExecuteAsync(new GetAllUsersRequest { }, cancellationToken).ConfigureAwait(false); | ||||||
| @@ -105,8 +91,8 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         //[Permission("UserManagement.Read")] |         [Permission("UserManagement.Read")] | ||||||
|         public async Task<IActionResult> GetUserById([FromBody] GetUserRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetUserById([FromBody] GetUserRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid user identifier"); } |             if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid user identifier"); } | ||||||
| @@ -128,7 +114,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.AzureScheme}")] |         [Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")] | ||||||
|         public async Task<IActionResult> GetUserByEmail([FromBody] GetUserByEmailRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetUserByEmail([FromBody] GetUserByEmailRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } |             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } | ||||||
| @@ -150,8 +136,8 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         //[Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|         public async Task<IActionResult> CreateUserAsync([FromBody] CreateUserRequest newUser, CancellationToken cancellationToken = default) |         public async Task<IActionResult> CreateUserAsync([FromBody] CreateUserRequest newUser, CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
|             await createUserHandler.ExecuteAsync(newUser, cancellationToken).ConfigureAwait(false); |             await createUserHandler.ExecuteAsync(newUser, cancellationToken).ConfigureAwait(false); | ||||||
| @@ -170,8 +156,8 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         //[Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|         public async Task<IActionResult> UpdateUserAsync([FromBody] UpdateUserRequest request, |         public async Task<IActionResult> UpdateUserAsync([FromBody] UpdateUserRequest request, | ||||||
|                                                          CancellationToken cancellationToken = default) |                                                          CancellationToken cancellationToken = default) | ||||||
|         { |         { | ||||||
| @@ -191,7 +177,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.AzureScheme}")] |         [Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")] | ||||||
|         public async Task<IActionResult> LoginUserAsync([FromBody] LoginUserRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> LoginUserAsync([FromBody] LoginUserRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } |             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } | ||||||
| @@ -233,8 +219,8 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |         [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] | ||||||
|         //[Permission("UserManagement.Write")] |         [Permission("UserManagement.Write")] | ||||||
|         public async Task<IActionResult> ChangeUserStatusAsync([FromBody] ChangeUserStatusRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> ChangeUserStatusAsync([FromBody] ChangeUserStatusRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid user identifier"); } |             if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid user identifier"); } | ||||||
| @@ -244,107 +230,6 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|             return port.ViewModel; |             return port.ViewModel; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         /// <summary> |  | ||||||
|         /// Adds a company to the user's list of companies. |  | ||||||
|         /// </summary> |  | ||||||
|         [HttpPost] |  | ||||||
|         [Route("AddCompany")] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status200OK)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status204NoContent)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |  | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |  | ||||||
|         //[Permission("UserManagement.Write")] |  | ||||||
|         public async Task<IActionResult> AddCompanyToUserAsync([FromBody] AddCompanyToUserRequest request, |  | ||||||
|                                                                CancellationToken cancellationToken) |  | ||||||
|         { |  | ||||||
|             if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); } |  | ||||||
|             if (string.IsNullOrEmpty(request.CompanyId)) { return BadRequest("Invalid company identifier"); } |  | ||||||
|  |  | ||||||
|             await addCompanyToUserHandler.ExecuteAsync(request, cancellationToken); |  | ||||||
|  |  | ||||||
|             return port.ViewModel; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         /// <summary> |  | ||||||
|         /// Removes a company from the user's list of companies. |  | ||||||
|         /// </summary> |  | ||||||
|         [HttpDelete] |  | ||||||
|         [Route("RemoveCompany")] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status200OK)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status204NoContent)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |  | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |  | ||||||
|         //[Permission("UserManagement.Write")] |  | ||||||
|         public async Task<IActionResult> RemoveCompanyFromUserAsync([FromBody] RemoveCompanyFromUserRequest request, |  | ||||||
|                                                                    CancellationToken cancellationToken) |  | ||||||
|         { |  | ||||||
|             if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); } |  | ||||||
|             if (string.IsNullOrEmpty(request.CompanyId)) { return BadRequest("Invalid company identifier"); } |  | ||||||
|  |  | ||||||
|             await removeCompanyFromUserHandler.ExecuteAsync(request, cancellationToken); |  | ||||||
|  |  | ||||||
|             return port.ViewModel; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         /// <summary> |  | ||||||
|         /// Adds a project to the user's list of projects. |  | ||||||
|         /// </summary> |  | ||||||
|         [HttpPost] |  | ||||||
|         [Route("AddProject")] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status200OK)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status204NoContent)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |  | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |  | ||||||
|         //[Permission("UserManagement.Write")] |  | ||||||
|         public async Task<IActionResult> AddProjectToUserAsync([FromBody] AddProjectToUserRequest request, |  | ||||||
|                                                               CancellationToken cancellationToken) |  | ||||||
|         { |  | ||||||
|             if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); } |  | ||||||
|             if (string.IsNullOrEmpty(request.ProjectId)) { return BadRequest("Invalid project identifier"); } |  | ||||||
|  |  | ||||||
|             await addProjectToUserHandler.ExecuteAsync(request, cancellationToken); |  | ||||||
|  |  | ||||||
|             return port.ViewModel; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         /// <summary> |  | ||||||
|         /// Removes a project from the user's list of projects. |  | ||||||
|         /// </summary> |  | ||||||
|         [HttpDelete] |  | ||||||
|         [Route("RemoveProject")] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status200OK)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status204NoContent)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] |  | ||||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] |  | ||||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] |  | ||||||
|         //[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)] |  | ||||||
|         //[Permission("UserManagement.Write")] |  | ||||||
|         public async Task<IActionResult> RemoveProjectFromUserAsync([FromBody] RemoveProjectFromUserRequest request, |  | ||||||
|                                                                    CancellationToken cancellationToken) |  | ||||||
|         { |  | ||||||
|  |  | ||||||
|             if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); } |  | ||||||
|             if (string.IsNullOrEmpty(request.ProjectId)) { return BadRequest("Invalid project identifier"); } |  | ||||||
|  |  | ||||||
|             await removeProjectFromUserHandler.ExecuteAsync(request, cancellationToken); |  | ||||||
|  |  | ||||||
|             return port.ViewModel; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// Validates if a user exists on the database. |         /// Validates if a user exists on the database. | ||||||
|         /// </summary> |         /// </summary> | ||||||
| @@ -373,7 +258,7 @@ namespace Core.Thalos.Service.API.Controllers | |||||||
|         [HttpPost] |         [HttpPost] | ||||||
|         [Route("GetTokenAdapter")] |         [Route("GetTokenAdapter")] | ||||||
|         [ProducesResponseType(typeof(TokenAdapter), StatusCodes.Status200OK)] |         [ProducesResponseType(typeof(TokenAdapter), StatusCodes.Status200OK)] | ||||||
|         //[Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.AzureScheme}")] |         [Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")] | ||||||
|         public async Task<IActionResult> GetTokenAdapter([FromBody] GetTokenAdapterRequest request, CancellationToken cancellationToken) |         public async Task<IActionResult> GetTokenAdapter([FromBody] GetTokenAdapterRequest request, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } |             if (string.IsNullOrEmpty(request.Email)) { return BadRequest("Invalid user email"); } | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ | |||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="Blueprint.Logging" Version="0.0.2" /> |     <PackageReference Include="Core.Blueprint.Logging" Version="1.0.1" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|   | |||||||
| @@ -35,10 +35,6 @@ namespace Core.Thalos.Service.API.Extensions | |||||||
|             services.AddScoped<IComponentHandler<LoginUserRequest>, UserHandler>(); |             services.AddScoped<IComponentHandler<LoginUserRequest>, UserHandler>(); | ||||||
|             services.AddScoped<IComponentHandler<LogoutUserRequest>, UserHandler>(); |             services.AddScoped<IComponentHandler<LogoutUserRequest>, UserHandler>(); | ||||||
|             services.AddScoped<IComponentHandler<GetUserByEmailRequest>, UserHandler>(); |             services.AddScoped<IComponentHandler<GetUserByEmailRequest>, UserHandler>(); | ||||||
|             services.AddScoped<IComponentHandler<AddCompanyToUserRequest>, UserHandler>(); |  | ||||||
|             services.AddScoped<IComponentHandler<RemoveCompanyFromUserRequest>, UserHandler>(); |  | ||||||
|             services.AddScoped<IComponentHandler<AddProjectToUserRequest>, UserHandler>(); |  | ||||||
|             services.AddScoped<IComponentHandler<RemoveProjectFromUserRequest>, UserHandler>(); |  | ||||||
|             services.AddScoped<IComponentHandler<ValidateUserExistenceRequest>, UserHandler>(); |             services.AddScoped<IComponentHandler<ValidateUserExistenceRequest>, UserHandler>(); | ||||||
|             services.AddScoped<IComponentHandler<GetTokenAdapterRequest>, UserHandler>(); |             services.AddScoped<IComponentHandler<GetTokenAdapterRequest>, UserHandler>(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,99 +0,0 @@ | |||||||
| using Asp.Versioning.ApiExplorer; |  | ||||||
| using Microsoft.Extensions.Options; |  | ||||||
| using Microsoft.OpenApi.Models; |  | ||||||
| using Swashbuckle.AspNetCore.SwaggerGen; |  | ||||||
| using Swashbuckle.AspNetCore.SwaggerUI; |  | ||||||
|  |  | ||||||
| namespace Core.Thalos.Service.API.Extensions |  | ||||||
| { |  | ||||||
|     public static class SwaggerExtensions |  | ||||||
|     { |  | ||||||
|         public static void AddSwagger(this IServiceCollection services, IConfiguration configuration) |  | ||||||
|         { |  | ||||||
|             services.AddEndpointsApiExplorer(); |  | ||||||
|             AddSwaggerGen(services, configuration); |  | ||||||
|             services.AddTransient<IConfigureOptions<SwaggerGenOptions>, ConfigureSwaggerOptions>(); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         /// <summary> |  | ||||||
|         /// Configures Swagger generation with OAuth2 security and XML comments. |  | ||||||
|         /// </summary> |  | ||||||
|         /// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param> |  | ||||||
|         /// <param name="configuration">The <see cref="IConfiguration"/> containing Swagger and OAuth2 configuration settings.</param> |  | ||||||
|         public static void AddSwaggerGen(this IServiceCollection services, IConfiguration configuration) |  | ||||||
|         { |  | ||||||
|             services.AddSwaggerGen(c => |  | ||||||
|             { |  | ||||||
|                 c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme |  | ||||||
|                 { |  | ||||||
|                     Description = "JWT Authorization header using the Bearer scheme", |  | ||||||
|                     Name = "Authorization", |  | ||||||
|                     In = ParameterLocation.Header, |  | ||||||
|                     Type = SecuritySchemeType.Http, |  | ||||||
|                     Scheme = "bearer", |  | ||||||
|                     BearerFormat = "JWT" |  | ||||||
|                 }); |  | ||||||
|  |  | ||||||
|                 c.AddSecurityRequirement(new OpenApiSecurityRequirement |  | ||||||
|                 { |  | ||||||
|                     { |  | ||||||
|                         new OpenApiSecurityScheme |  | ||||||
|                         { |  | ||||||
|                             Reference = new OpenApiReference |  | ||||||
|                             { |  | ||||||
|                                 Type = ReferenceType.SecurityScheme, |  | ||||||
|                                 Id = "Bearer" |  | ||||||
|                             } |  | ||||||
|                         }, |  | ||||||
|                         Array.Empty<string>() |  | ||||||
|                     } |  | ||||||
|                 }); |  | ||||||
|             }); |  | ||||||
|         } |  | ||||||
|         public static void ConfigureSwagger(this WebApplication app) |  | ||||||
|         { |  | ||||||
|             //Swagger Stuff Goes Here |  | ||||||
|  |  | ||||||
|             app.UseSwagger(); |  | ||||||
|             app.UseSwaggerUI(options => |  | ||||||
|             { |  | ||||||
|                 foreach (var version in app.DescribeApiVersions().Select(version => version.GroupName)) |  | ||||||
|                     options.SwaggerEndpoint($"/swagger/{version}/swagger.json", version); |  | ||||||
|  |  | ||||||
|                 options.DisplayRequestDuration(); |  | ||||||
|                 options.EnableTryItOutByDefault(); |  | ||||||
|                 options.DocExpansion(DocExpansion.None); |  | ||||||
|             }); |  | ||||||
|  |  | ||||||
|             //  app.MapGet("/", () => Results.Redirect("/swagger/index.html")).WithTags(string.Empty); |  | ||||||
|         } |  | ||||||
|         public static IServiceCollection AddVersioning(this IServiceCollection services) |  | ||||||
|         { |  | ||||||
|             services.AddApiVersioning(options => options.ReportApiVersions = true) |  | ||||||
|                    .AddApiExplorer(options => |  | ||||||
|                    { |  | ||||||
|                        options.GroupNameFormat = "'v'VVV"; |  | ||||||
|                        options.SubstituteApiVersionInUrl = true; |  | ||||||
|                    }); |  | ||||||
|  |  | ||||||
|             return services; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|     public class ConfigureSwaggerOptions(IApiVersionDescriptionProvider provider) : IConfigureOptions<SwaggerGenOptions> |  | ||||||
|     { |  | ||||||
|         private readonly IApiVersionDescriptionProvider _provider = provider; |  | ||||||
|  |  | ||||||
|         public void Configure(SwaggerGenOptions options) |  | ||||||
|         { |  | ||||||
|             foreach (var description in _provider.ApiVersionDescriptions) |  | ||||||
|                 options.SwaggerDoc(description.GroupName, new() |  | ||||||
|                 { |  | ||||||
|                     Title = AppDomain.CurrentDomain.FriendlyName, |  | ||||||
|                     Version = description.ApiVersion.ToString() |  | ||||||
|                 }); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|             options.CustomSchemaIds(type => type.ToString().Replace("+", ".")); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,5 +1,7 @@ | |||||||
|  | using Core.Blueprint.KeyVault.Configuration; | ||||||
| using Core.Blueprint.Logging.Configuration; | using Core.Blueprint.Logging.Configuration; | ||||||
| using Core.Thalos.Adapters.Extensions; | using Core.Thalos.BuildingBlocks; | ||||||
|  | using Core.Thalos.BuildingBlocks.Configuration; | ||||||
| using Core.Thalos.External.ClientConfiguration; | using Core.Thalos.External.ClientConfiguration; | ||||||
| using Core.Thalos.Service.API.Extensions; | using Core.Thalos.Service.API.Extensions; | ||||||
| using Microsoft.AspNetCore.HttpLogging; | using Microsoft.AspNetCore.HttpLogging; | ||||||
| @@ -8,18 +10,21 @@ using System.Text.Json.Serialization; | |||||||
|  |  | ||||||
| var builder = WebApplication.CreateBuilder(args); | var builder = WebApplication.CreateBuilder(args); | ||||||
|  |  | ||||||
| //var authSettings = AuthHelper.GetAuthSettings(builder, "thalos_service"); |  | ||||||
|  |  | ||||||
| //builder.Services.ConfigureAuthentication(builder.Configuration, authSettings); |  | ||||||
|  |  | ||||||
| builder.Services.AddLogs(builder); |  | ||||||
|  |  | ||||||
| builder.Services.AddEndpointsApiExplorer(); |  | ||||||
| builder.Services.AddSwaggerGen(); |  | ||||||
| builder.Configuration | builder.Configuration | ||||||
|     .AddUserSecrets(Assembly.GetExecutingAssembly()) |     .AddUserSecrets(Assembly.GetExecutingAssembly()) | ||||||
|     .AddEnvironmentVariables(); |     .AddEnvironmentVariables(); | ||||||
|  |  | ||||||
|  | var services = builder.Services.AddKeyVault(builder.Configuration); | ||||||
|  |  | ||||||
|  | var authSettings = await AuthHelper.GetAuthSettings(builder.Services, builder, "thalos_common"); | ||||||
|  |  | ||||||
|  | builder.Services.ConfigureAuthentication(builder.Configuration, authSettings); | ||||||
|  |  | ||||||
|  | builder.Services.AddLogs(builder); | ||||||
|  |  | ||||||
|  | builder.Services.AddEndpointsApiExplorer(); | ||||||
|  | builder.Services.AddSwaggerGen(builder.Configuration, "Core.Thalos.Service.API.xml", authSettings); | ||||||
|  | builder.Services.AddVersioning(builder.Configuration); | ||||||
| builder.Services.RegisterExternalLayer(builder.Configuration); | builder.Services.RegisterExternalLayer(builder.Configuration); | ||||||
| builder.Services.AddServiceConfigurationLayer(); | builder.Services.AddServiceConfigurationLayer(); | ||||||
| builder.Services.AddResponseCompression(); | builder.Services.AddResponseCompression(); | ||||||
| @@ -44,11 +49,6 @@ builder.Host.ConfigureServices((context, services) => | |||||||
|         options.SerializerOptions.Converters.Add(new JsonStringEnumConverter()); |         options.SerializerOptions.Converters.Add(new JsonStringEnumConverter()); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     services |  | ||||||
|         .AddEndpointsApiExplorer() |  | ||||||
|         .AddVersioning() |  | ||||||
|         .AddSwagger(builder.Configuration); |  | ||||||
|  |  | ||||||
|     services.AddHealthChecks(); |     services.AddHealthChecks(); | ||||||
|     services.AddHttpLogging(options => options.LoggingFields = HttpLoggingFields.All); |     services.AddHttpLogging(options => options.LoggingFields = HttpLoggingFields.All); | ||||||
|  |  | ||||||
| @@ -66,20 +66,22 @@ builder.Host.ConfigureServices((context, services) => | |||||||
|  |  | ||||||
| var app = builder.Build(); | var app = builder.Build(); | ||||||
|  |  | ||||||
|  | app.UseLogging(builder.Configuration); | ||||||
|  | app.UseSwaggerUI(builder.Configuration, authSettings); | ||||||
|  | app.ConfigureSwagger(builder.Configuration); | ||||||
|  |  | ||||||
| app.UseRouting(); | app.UseRouting(); | ||||||
| app.UseSwagger(); |  | ||||||
| app.UseSwaggerUI(); |  | ||||||
| app.UseAuthentication(); |  | ||||||
| app.UseAuthorization(); |  | ||||||
| app.MapControllers(); |  | ||||||
| app.UseCors(); | app.UseCors(); | ||||||
| app.ConfigureSwagger(); |  | ||||||
| app.UseHttpsRedirection(); | app.UseHttpsRedirection(); | ||||||
| app.UseStaticFiles(); | app.UseStaticFiles(); | ||||||
| app.UseResponseCompression(); | app.UseResponseCompression(); | ||||||
| app.UseOutputCache(); | app.UseOutputCache(); | ||||||
| app.UseResponseCaching(); | app.UseResponseCaching(); | ||||||
| app.UseLogging(builder.Configuration); |  | ||||||
|  | app.UseAuthentication(); | ||||||
|  | app.UseAuthorization(); | ||||||
|  |  | ||||||
|  | app.MapControllers(); | ||||||
| app.MapHealthChecks("/health"); | app.MapHealthChecks("/health"); | ||||||
|  |  | ||||||
| app.Run(); | app.Run(); | ||||||
|   | |||||||
| @@ -8,5 +8,18 @@ | |||||||
|   "AllowedHosts": "*", |   "AllowedHosts": "*", | ||||||
|   "LocalGateways": { |   "LocalGateways": { | ||||||
|     "ThalosDAL": "https://localhost:7031/api" |     "ThalosDAL": "https://localhost:7031/api" | ||||||
|  |   }, | ||||||
|  |   "ServiceSettings": { | ||||||
|  |     "ApplicationName": "thalos", | ||||||
|  |     "LayerName": "service" | ||||||
|  |   }, | ||||||
|  |   "Vault": { | ||||||
|  |     "Address": "http://100.123.31.103:8200", | ||||||
|  |     "Token": "hvs.e37LQvLuPhTd5ALS5QQ03Cwm", | ||||||
|  |     "SecretMount": "secret" | ||||||
|  |   }, | ||||||
|  |   "IdentityProviders": { | ||||||
|  |     "Google": true, | ||||||
|  |     "Azure": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -5,8 +5,5 @@ | |||||||
|       "Microsoft.AspNetCore": "Warning" |       "Microsoft.AspNetCore": "Warning" | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "AllowedHosts": "*", |   "AllowedHosts": "*" | ||||||
|   "Endpoints": { |  | ||||||
|     "AppConfigurationURI": "https://sandbox-hci-usc-appcg.azconfig.io" |  | ||||||
|   } |  | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user