Revise TBB and authentication logic
This commit is contained in:
		| @@ -5,15 +5,13 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
| using Asp.Versioning; | using Asp.Versioning; | ||||||
| using Core.Blueprint.Mongo; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Adapters; |  | ||||||
| using Core.Thalos.Adapters.Attributes; |  | ||||||
| using Core.Thalos.Adapters.Common.Constants; |  | ||||||
| using Core.Thalos.Provider.Contracts; | using Core.Thalos.Provider.Contracts; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| using Microsoft.Graph; | using Microsoft.Graph; | ||||||
| using ModuleRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.ModuleRequest; | using ModuleRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.ModuleRequest; | ||||||
|  | using StatusEnum = Core.Blueprint.Mongo.StatusEnum; | ||||||
|  |  | ||||||
| namespace LSA.Core.Thalos.API.Controllers | namespace LSA.Core.Thalos.API.Controllers | ||||||
| { | { | ||||||
|   | |||||||
| @@ -5,15 +5,13 @@ | |||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
| using Asp.Versioning; | using Asp.Versioning; | ||||||
| using Core.Blueprint.Mongo; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Adapters; |  | ||||||
| using Core.Thalos.Adapters.Attributes; |  | ||||||
| using Core.Thalos.Adapters.Common.Constants; |  | ||||||
| using Core.Thalos.Provider.Contracts; | using Core.Thalos.Provider.Contracts; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| using Microsoft.Graph; | using Microsoft.Graph; | ||||||
| using PermissionRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.PermissionRequest; | using PermissionRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.PermissionRequest; | ||||||
|  | using StatusEnum = Core.Blueprint.Mongo.StatusEnum; | ||||||
|  |  | ||||||
| namespace LSA.Core.Thalos.API.Controllers | namespace LSA.Core.Thalos.API.Controllers | ||||||
| { | { | ||||||
|   | |||||||
| @@ -4,10 +4,7 @@ | |||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| using Asp.Versioning; | using Asp.Versioning; | ||||||
| using Core.Thalos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Adapters.Attributes; |  | ||||||
| using Core.Thalos.Adapters.Common.Constants; |  | ||||||
| using Core.Thalos.Adapters.Common.Enums; |  | ||||||
| using Core.Thalos.Domain.Contexts.Onboarding.Request; | using Core.Thalos.Domain.Contexts.Onboarding.Request; | ||||||
| using Core.Thalos.Provider.Contracts; | using Core.Thalos.Provider.Contracts; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
|   | |||||||
| @@ -4,14 +4,12 @@ | |||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| using Asp.Versioning; | using Asp.Versioning; | ||||||
| using Core.Blueprint.Mongo; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Adapters; |  | ||||||
| using Core.Thalos.Adapters.Attributes; |  | ||||||
| using Core.Thalos.Adapters.Common.Constants; |  | ||||||
| using Core.Thalos.Provider.Contracts; | using Core.Thalos.Provider.Contracts; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| using Microsoft.Graph; | using Microsoft.Graph; | ||||||
|  | using StatusEnum = Core.Blueprint.Mongo.StatusEnum; | ||||||
| using UserRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.UserRequest; | using UserRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.UserRequest; | ||||||
|  |  | ||||||
| namespace LSA.Core.Thalos.API.Controllers | namespace LSA.Core.Thalos.API.Controllers | ||||||
|   | |||||||
| @@ -1,104 +0,0 @@ | |||||||
| using Asp.Versioning.ApiExplorer; |  | ||||||
| using Microsoft.Extensions.Options; |  | ||||||
| using Microsoft.Graph.ExternalConnectors; |  | ||||||
| using Microsoft.OpenApi.Any; |  | ||||||
| using Microsoft.OpenApi.Models; |  | ||||||
| using Swashbuckle.AspNetCore.SwaggerGen; |  | ||||||
| using Swashbuckle.AspNetCore.SwaggerUI; |  | ||||||
|  |  | ||||||
| namespace Core.Thalos.DAL.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>(); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         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) |  | ||||||
|         { |  | ||||||
|             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); |  | ||||||
|             }); |  | ||||||
|         } |  | ||||||
|         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 : IConfigureOptions<SwaggerGenOptions> |  | ||||||
|     { |  | ||||||
|         private readonly IApiVersionDescriptionProvider _provider; |  | ||||||
|  |  | ||||||
|         public ConfigureSwaggerOptions(IApiVersionDescriptionProvider provider) |  | ||||||
|         { |  | ||||||
|             _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() |  | ||||||
|                 }); |  | ||||||
|  |  | ||||||
|             //Map ALL Values Format TODO |  | ||||||
|             options.MapType<DateOnly>(() => new() |  | ||||||
|             { |  | ||||||
|                 Format = "date", |  | ||||||
|                 Example = new OpenApiString(DateOnly.MinValue.ToString()) |  | ||||||
|             }); |  | ||||||
|  |  | ||||||
|             options.CustomSchemaIds(type => type.ToString().Replace("+", ".")); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,9 +1,9 @@ | |||||||
| using Core.Blueprint.DAL.Mongo.Configuration; | using Core.Blueprint.DAL.Mongo.Configuration; | ||||||
|  | using Core.Blueprint.KeyVault.Configuration; | ||||||
| using Core.Blueprint.Logging.Configuration; | using Core.Blueprint.Logging.Configuration; | ||||||
| using Core.Blueprint.Redis.Configuration; | using Core.Blueprint.Redis.Configuration; | ||||||
| using Core.Thalos.Adapters.Extensions; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.BuildingBlocks.Authentication.Extensions; | using Core.Thalos.BuildingBlocks.Configuration; | ||||||
| using Core.Thalos.DAL.API.Extensions; |  | ||||||
| using Core.Thalos.Provider; | using Core.Thalos.Provider; | ||||||
| using Microsoft.AspNetCore.HttpLogging; | using Microsoft.AspNetCore.HttpLogging; | ||||||
| using System.Reflection; | using System.Reflection; | ||||||
| @@ -11,14 +11,19 @@ using System.Text.Json.Serialization; | |||||||
|  |  | ||||||
| var builder = WebApplication.CreateBuilder(args); | var builder = WebApplication.CreateBuilder(args); | ||||||
|  |  | ||||||
| builder.Services.ConfigureAuthentication(builder.Configuration); |  | ||||||
|  |  | ||||||
| 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.AddEndpointsApiExplorer(); | ||||||
|  | builder.Services.AddSwaggerGen(builder.Configuration, "Core.Thalos.DAL.API.xml", authSettings); | ||||||
|  | builder.Services.AddVersioning(builder.Configuration); | ||||||
| builder.Services.AddResponseCompression(); | builder.Services.AddResponseCompression(); | ||||||
| builder.Services.AddProblemDetails(); | builder.Services.AddProblemDetails(); | ||||||
| builder.Services.AddMemoryCache(); | builder.Services.AddMemoryCache(); | ||||||
| @@ -45,11 +50,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,11 +66,10 @@ builder.Host.ConfigureServices((context, services) => | |||||||
|  |  | ||||||
| var app = builder.Build(); | var app = builder.Build(); | ||||||
|  |  | ||||||
| app.UseSwagger(); | app.UseSwaggerUI(builder.Configuration, authSettings); | ||||||
| app.UseSwaggerUI(); |  | ||||||
| app.MapControllers(); | app.MapControllers(); | ||||||
| app.UseCors(); | app.UseCors(); | ||||||
| app.ConfigureSwagger(); | app.ConfigureSwagger(builder.Configuration); | ||||||
| app.UseHttpsRedirection(); | app.UseHttpsRedirection(); | ||||||
| app.UseStaticFiles(); | app.UseStaticFiles(); | ||||||
| app.UseRouting(); | app.UseRouting(); | ||||||
|   | |||||||
| @@ -22,5 +22,14 @@ | |||||||
|   "ServiceSettings": { |   "ServiceSettings": { | ||||||
|     "ApplicationName": "thalos", |     "ApplicationName": "thalos", | ||||||
|     "LayerName": "dal" |     "LayerName": "dal" | ||||||
|  |   }, | ||||||
|  |   "Vault": { | ||||||
|  |     "Address": "http://100.123.31.103:8200", | ||||||
|  |     "Token": "hvs.e37LQvLuPhTd5ALS5QQ03Cwm", | ||||||
|  |     "SecretMount": "secret" | ||||||
|  |   }, | ||||||
|  |   "IdentityProviders": { | ||||||
|  |     "Google": true, | ||||||
|  |     "Azure":  true | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -4,32 +4,5 @@ | |||||||
|       "Default": "Information", |       "Default": "Information", | ||||||
|       "Microsoft.AspNetCore": "Warning" |       "Microsoft.AspNetCore": "Warning" | ||||||
|     } |     } | ||||||
|   }, |  | ||||||
|   "AllowedHosts": "*", |  | ||||||
|   "ConnectionStrings": { |  | ||||||
|     "MongoDB": "mongodb://admin_agile:Admin%40agileWebs@portainer.white-enciso.pro:27017/?authMechanism=SCRAM-SHA-256", |  | ||||||
|     "Redis": "localhost:6379" |  | ||||||
|   }, |  | ||||||
|   "MongoDb": { |  | ||||||
|     "DatabaseName": "Thalos", |  | ||||||
|     "LocalAudience": "" |  | ||||||
|   }, |  | ||||||
|   "DetailedErrors": true, |  | ||||||
|   "UseRedisCache": true, |  | ||||||
|   "CacheSettings": { |  | ||||||
|     "DefaultCacheDurationInMinutes": 3 |  | ||||||
|   }, |  | ||||||
|   "Authentication": { |  | ||||||
|     "Google": { |  | ||||||
|       "ClientId": "128345072002-mtfdgpcur44o9tbd7q6e0bb9qnp2crfp.apps.googleusercontent.com", |  | ||||||
|       "ClientSecret": "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", |  | ||||||
|       "ApplicationName": "Thalos", |  | ||||||
|       "RedirectUri": "https://localhost:7239/api/v1/Authentication/callback" |  | ||||||
|   } |   } | ||||||
|   }, |  | ||||||
|   "JwtIssuerOptions": { |  | ||||||
|     "Audience": "https://localhost:7239/", |  | ||||||
|     "Issuer": "webApi" |  | ||||||
|   }, |  | ||||||
|   "SecretKey": "iNivDmHLpUA223sqsfhqGbMRdRj1PVkH1" |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ | |||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using MongoDB.Bson; | using MongoDB.Bson; | ||||||
| using MongoDB.Bson.Serialization.Attributes; | using MongoDB.Bson.Serialization.Attributes; | ||||||
| using System.Text.Json.Serialization; | using System.Text.Json.Serialization; | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ | |||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
| using Core.Thalos.Adapters.Common.Constants; | using Core.Thalos.BuildingBlocks; | ||||||
| using MongoDB.Bson; | using MongoDB.Bson; | ||||||
| using MongoDB.Bson.Serialization.Attributes; | using MongoDB.Bson.Serialization.Attributes; | ||||||
| using System.Text.Json.Serialization; | using System.Text.Json.Serialization; | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ | |||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
|  |  | ||||||
| using Core.Thalos.Adapters.Common.Enums; | using Core.Thalos.BuildingBlocks; | ||||||
| using MongoDB.Bson; | using MongoDB.Bson; | ||||||
| using MongoDB.Bson.Serialization.Attributes; | using MongoDB.Bson.Serialization.Attributes; | ||||||
| using System.Text.Json.Serialization; | using System.Text.Json.Serialization; | ||||||
|   | |||||||
| @@ -7,7 +7,8 @@ | |||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.0.5" /> |     <PackageReference Include="Core.Blueprint.KeyVault" Version="1.0.3" /> | ||||||
|  |     <PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.0.7" /> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|  |  | ||||||
| </Project> | </Project> | ||||||
|   | |||||||
| @@ -3,8 +3,7 @@ | |||||||
| //     AgileWebs | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| using Core.Blueprint.Mongo; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Adapters; |  | ||||||
| using Core.Thalos.Domain.Contexts.Onboarding.Request; | using Core.Thalos.Domain.Contexts.Onboarding.Request; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Provider.Contracts | namespace Core.Thalos.Provider.Contracts | ||||||
| @@ -50,7 +49,7 @@ namespace Core.Thalos.Provider.Contracts | |||||||
|         /// <returns>The <see cref="ModuleAdapter"/> updated entity.</returns> |         /// <returns>The <see cref="ModuleAdapter"/> updated entity.</returns> | ||||||
|         /// <returns>A <see cref="{Task{ModuleAdapter}}"/> representing |         /// <returns>A <see cref="{Task{ModuleAdapter}}"/> representing | ||||||
|         /// the asynchronous execution of the service.</returns> |         /// the asynchronous execution of the service.</returns> | ||||||
|         ValueTask<ModuleAdapter> ChangeModuleStatus(string id, StatusEnum newStatus, CancellationToken cancellationToken); |         ValueTask<ModuleAdapter> ChangeModuleStatus(string id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken); | ||||||
|  |  | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// Updates a Module by id. |         /// Updates a Module by id. | ||||||
|   | |||||||
| @@ -3,8 +3,7 @@ | |||||||
| //     AgileWebs | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| using Core.Blueprint.Mongo; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Adapters; |  | ||||||
| using Core.Thalos.Domain.Contexts.Onboarding.Request; | using Core.Thalos.Domain.Contexts.Onboarding.Request; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Provider.Contracts | namespace Core.Thalos.Provider.Contracts | ||||||
| @@ -50,7 +49,7 @@ namespace Core.Thalos.Provider.Contracts | |||||||
|         /// <returns>The <see cref="PermissionAdapter"/> updated entity.</returns> |         /// <returns>The <see cref="PermissionAdapter"/> updated entity.</returns> | ||||||
|         /// <returns>A <see cref="{Task{PermissionAdapter}}"/> representing |         /// <returns>A <see cref="{Task{PermissionAdapter}}"/> representing | ||||||
|         /// the asynchronous execution of the service.</returns> |         /// the asynchronous execution of the service.</returns> | ||||||
|         ValueTask<PermissionAdapter> ChangePermissionStatus(string id, StatusEnum newStatus, CancellationToken cancellationToken); |         ValueTask<PermissionAdapter> ChangePermissionStatus(string id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken); | ||||||
|  |  | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// Updates a Permission by id. |         /// Updates a Permission by id. | ||||||
|   | |||||||
| @@ -3,8 +3,7 @@ | |||||||
| //     AgileWebs | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| using Core.Thalos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Adapters.Common.Enums; |  | ||||||
| using Core.Thalos.Domain.Contexts.Onboarding.Request; | using Core.Thalos.Domain.Contexts.Onboarding.Request; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Provider.Contracts | namespace Core.Thalos.Provider.Contracts | ||||||
|   | |||||||
| @@ -3,8 +3,7 @@ | |||||||
| //     AgileWebs | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| using Core.Blueprint.Mongo; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Adapters; |  | ||||||
| using Core.Thalos.Domain.Contexts.Onboarding.Request; | using Core.Thalos.Domain.Contexts.Onboarding.Request; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Provider.Contracts | namespace Core.Thalos.Provider.Contracts | ||||||
| @@ -58,7 +57,7 @@ namespace Core.Thalos.Provider.Contracts | |||||||
|         /// <param name="newStatus">The new status of the user.</param> |         /// <param name="newStatus">The new status of the user.</param> | ||||||
|         /// <returns>A <see cref="{Task{UserAdapter}}"/> representing |         /// <returns>A <see cref="{Task{UserAdapter}}"/> representing | ||||||
|         /// the asynchronous execution of the service.</returns> |         /// the asynchronous execution of the service.</returns> | ||||||
|         ValueTask<UserAdapter> ChangeUserStatus(string id, StatusEnum newStatus, CancellationToken cancellationToken); |         ValueTask<UserAdapter> ChangeUserStatus(string id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken); | ||||||
|  |  | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// Updates a User by id. |         /// Updates a User by id. | ||||||
|   | |||||||
| @@ -3,15 +3,15 @@ | |||||||
| //     AgileWebs | //     AgileWebs | ||||||
| // </copyright> | // </copyright> | ||||||
| // *********************************************************************** | // *********************************************************************** | ||||||
| using Core.Thalos.Adapters; |  | ||||||
| using Core.Blueprint.Mongo; | using Core.Blueprint.Mongo; | ||||||
|  | using Core.Blueprint.Redis; | ||||||
|  | using Core.Blueprint.Redis.Helpers; | ||||||
|  | using Core.Thalos.BuildingBlocks; | ||||||
|  | using Core.Thalos.Domain.Contexts.Onboarding.Request; | ||||||
|  | using Core.Thalos.Provider.Contracts; | ||||||
| using Mapster; | using Mapster; | ||||||
| using Microsoft.Extensions.Options; | using Microsoft.Extensions.Options; | ||||||
| using MongoDB.Driver; | using MongoDB.Driver; | ||||||
| using Core.Thalos.Provider.Contracts; |  | ||||||
| using Core.Thalos.Domain.Contexts.Onboarding.Request; |  | ||||||
| using Core.Blueprint.Redis; |  | ||||||
| using Core.Blueprint.Redis.Helpers; |  | ||||||
|  |  | ||||||
| namespace Core.Thalos.Provider.Providers.Onboarding | namespace Core.Thalos.Provider.Providers.Onboarding | ||||||
| { | { | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ | |||||||
| using Core.Blueprint.Mongo; | using Core.Blueprint.Mongo; | ||||||
| using Core.Blueprint.Redis; | using Core.Blueprint.Redis; | ||||||
| using Core.Blueprint.Redis.Helpers; | using Core.Blueprint.Redis.Helpers; | ||||||
| using Core.Thalos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Domain.Contexts.Onboarding.Request; | using Core.Thalos.Domain.Contexts.Onboarding.Request; | ||||||
| using Core.Thalos.Provider.Contracts; | using Core.Thalos.Provider.Contracts; | ||||||
| using Mapster; | using Mapster; | ||||||
| @@ -128,7 +128,7 @@ namespace Core.Thalos.Provider.Providers.Onboarding | |||||||
|         /// <param name="newStatus">The new status of the permission.</param> |         /// <param name="newStatus">The new status of the permission.</param> | ||||||
|         /// <returns>A <see cref="{Task{PermissionAdapter}}"/> representing |         /// <returns>A <see cref="{Task{PermissionAdapter}}"/> representing | ||||||
|         /// the asynchronous execution of the service.</returns> |         /// the asynchronous execution of the service.</returns> | ||||||
|         public async ValueTask<PermissionAdapter> ChangePermissionStatus(string id, StatusEnum newStatus, CancellationToken cancellationToken) |         public async ValueTask<PermissionAdapter> ChangePermissionStatus(string id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken) | ||||||
|         { |         { | ||||||
|             var entity = await repository.FindByIdAsync(id); |             var entity = await repository.FindByIdAsync(id); | ||||||
|             entity.Status = newStatus; |             entity.Status = newStatus; | ||||||
|   | |||||||
| @@ -6,18 +6,12 @@ | |||||||
| using Core.Blueprint.Mongo; | using Core.Blueprint.Mongo; | ||||||
| using Core.Blueprint.Redis; | using Core.Blueprint.Redis; | ||||||
| using Core.Blueprint.Redis.Helpers; | using Core.Blueprint.Redis.Helpers; | ||||||
| using Core.Thalos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Adapters.Common.Enums; |  | ||||||
| using Core.Thalos.Domain.Contexts.Onboarding.Request; | using Core.Thalos.Domain.Contexts.Onboarding.Request; | ||||||
| using Core.Thalos.Provider.Contracts; | using Core.Thalos.Provider.Contracts; | ||||||
| using Mapster; | using Mapster; | ||||||
| using Microsoft.Extensions.Options; | using Microsoft.Extensions.Options; | ||||||
| using Microsoft.Graph; |  | ||||||
| using MongoDB.Bson; |  | ||||||
| using MongoDB.Bson.Serialization; |  | ||||||
| using MongoDB.Driver; | using MongoDB.Driver; | ||||||
| using System.ComponentModel.Design; |  | ||||||
| using System.Text.RegularExpressions; |  | ||||||
|  |  | ||||||
| namespace Core.Thalos.Provider.Providers.Onboarding | namespace Core.Thalos.Provider.Providers.Onboarding | ||||||
| { | { | ||||||
|   | |||||||
| @@ -7,15 +7,13 @@ | |||||||
| using Core.Blueprint.Mongo; | using Core.Blueprint.Mongo; | ||||||
| using Core.Blueprint.Redis; | using Core.Blueprint.Redis; | ||||||
| using Core.Blueprint.Redis.Helpers; | using Core.Blueprint.Redis.Helpers; | ||||||
| using Core.Thalos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Adapters.Common.Enums; |  | ||||||
| using Core.Thalos.Provider.Contracts; | using Core.Thalos.Provider.Contracts; | ||||||
| using Mapster; | using Mapster; | ||||||
| using Microsoft.Extensions.Options; | using Microsoft.Extensions.Options; | ||||||
| using MongoDB.Bson; | using MongoDB.Bson; | ||||||
| using MongoDB.Bson.Serialization; | using MongoDB.Bson.Serialization; | ||||||
| using MongoDB.Driver; | using MongoDB.Driver; | ||||||
| using System.Reflection; |  | ||||||
| using System.Text.RegularExpressions; | using System.Text.RegularExpressions; | ||||||
|  |  | ||||||
| namespace Core.Thalos.Provider.Providers.Onboarding | namespace Core.Thalos.Provider.Providers.Onboarding | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| using Core.Blueprint.Mongo; | using Core.Blueprint.Mongo; | ||||||
| using Core.Thalos.Adapters; | using Core.Thalos.BuildingBlocks; | ||||||
| using Core.Thalos.Provider.Contracts; | using Core.Thalos.Provider.Contracts; | ||||||
| using Core.Thalos.Provider.Providers.Onboarding; | using Core.Thalos.Provider.Providers.Onboarding; | ||||||
| using Microsoft.Extensions.Configuration; | using Microsoft.Extensions.Configuration; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user