diff --git a/Directory.Packages.props b/Directory.Packages.props index c5be29b..67e66c4 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -38,7 +38,7 @@ - + diff --git a/src/Pandatech.VerticalSlices/Domain/EntityFilters/UserEntityFilter.cs b/src/Pandatech.VerticalSlices/Domain/EntityFilters/UserEntityFilter.cs index be1baa8..ffa2ca3 100644 --- a/src/Pandatech.VerticalSlices/Domain/EntityFilters/UserEntityFilter.cs +++ b/src/Pandatech.VerticalSlices/Domain/EntityFilters/UserEntityFilter.cs @@ -2,7 +2,7 @@ using PandaTech.IEnumerableFilters.Converters; using Pandatech.VerticalSlices.Domain.Entities; using Pandatech.VerticalSlices.Domain.Enums; -using Pandatech.VerticalSlices.DTOs.User; +using Pandatech.VerticalSlices.z._Old_way.DTOs; namespace Pandatech.VerticalSlices.Domain.EntityFilters; diff --git a/src/Pandatech.VerticalSlices/Features/Auth/Contracts/Authenticate/IdentityCookies.cs b/src/Pandatech.VerticalSlices/Features/Auth/Contracts/Authenticate/IdentityCookies.cs index 04237a2..ab2a8b2 100644 --- a/src/Pandatech.VerticalSlices/Features/Auth/Contracts/Authenticate/IdentityCookies.cs +++ b/src/Pandatech.VerticalSlices/Features/Auth/Contracts/Authenticate/IdentityCookies.cs @@ -1,4 +1,4 @@ -namespace Pandatech.VerticalSlices.DTOs.Inner; +namespace Pandatech.VerticalSlices.Features.Auth.Contracts.Authenticate; public class IdentityCookies { diff --git a/src/Pandatech.VerticalSlices/Features/Auth/Helpers/CookieHelper.cs b/src/Pandatech.VerticalSlices/Features/Auth/Helpers/CookieHelper.cs index d1b30a6..487a5f0 100644 --- a/src/Pandatech.VerticalSlices/Features/Auth/Helpers/CookieHelper.cs +++ b/src/Pandatech.VerticalSlices/Features/Auth/Helpers/CookieHelper.cs @@ -1,4 +1,4 @@ -using Pandatech.VerticalSlices.DTOs.Inner; +using Pandatech.VerticalSlices.Features.Auth.Contracts.Authenticate; using Pandatech.VerticalSlices.Features.Auth.Contracts.Login; using Pandatech.VerticalSlices.Features.Auth.Contracts.RefreshToken; using Pandatech.VerticalSlices.SharedKernel.Extensions; diff --git a/src/Pandatech.VerticalSlices/Infrastructure/Extensions/SerilogExtension.cs b/src/Pandatech.VerticalSlices/Infrastructure/Extensions/SerilogExtension.cs index b1d8da3..2e2021c 100644 --- a/src/Pandatech.VerticalSlices/Infrastructure/Extensions/SerilogExtension.cs +++ b/src/Pandatech.VerticalSlices/Infrastructure/Extensions/SerilogExtension.cs @@ -6,70 +6,70 @@ namespace Pandatech.VerticalSlices.Infrastructure.Extensions; public static class SerilogExtension { - public static WebApplicationBuilder AddSerilog(this WebApplicationBuilder builder) - { - var configuration = builder.Configuration; - var indexName = configuration["ElasticIndexName"]!; - var elasticSearchUrl = configuration.GetConnectionString("ElasticSearch")!; + public static WebApplicationBuilder AddSerilog(this WebApplicationBuilder builder) + { + var configuration = builder.Configuration; + var indexName = configuration["ElasticIndexName"]!; + var elasticSearchUrl = configuration.GetConnectionString("ElasticSearch")!; - var loggerConfig = new LoggerConfiguration() - .Enrich.FromLogContext() - .Enrich.WithMachineName() - .Filter.ByExcluding(logEvent => logEvent.ShouldExcludeHangfireDashboardLogs()) - .ReadFrom.Configuration(configuration); + var loggerConfig = new LoggerConfiguration() + .Enrich.FromLogContext() + .Enrich.WithMachineName() + .Filter.ByExcluding(logEvent => logEvent.ShouldExcludeHangfireDashboardLogs()) + .ReadFrom.Configuration(configuration); - ConfigureEnvironmentSpecificSettings(builder.Environment, loggerConfig, elasticSearchUrl, indexName); + ConfigureEnvironmentSpecificSettings(builder.Environment, loggerConfig, elasticSearchUrl, indexName); - Log.Logger = loggerConfig.CreateLogger(); - builder.Logging.ClearProviders(); - builder.Logging.AddSerilog(); - builder.Services.AddSingleton(Log.Logger); - return builder; - } + Log.Logger = loggerConfig.CreateLogger(); + builder.Logging.ClearProviders(); + builder.Logging.AddSerilog(); + builder.Services.AddSingleton(Log.Logger); + return builder; + } - private static void ConfigureEnvironmentSpecificSettings(IHostEnvironment environment, - LoggerConfiguration loggerConfig, string elasticSearchUrl, string indexName) - { - if (environment.IsLocal()) - { - loggerConfig.WriteTo.Console(); - } + private static void ConfigureEnvironmentSpecificSettings(IHostEnvironment environment, + LoggerConfiguration loggerConfig, string elasticSearchUrl, string indexName) + { + if (environment.IsLocal()) + { + loggerConfig.WriteTo.Console(); + } - else if (environment.IsDevelopment()) + else if (environment.IsDevelopment()) - { - loggerConfig.WriteTo.Console(); - ConfigureElasticsearch(loggerConfig, elasticSearchUrl, indexName, environment); - } - else - { - ConfigureElasticsearch(loggerConfig, elasticSearchUrl, indexName, environment); - } - } + { + loggerConfig.WriteTo.Console(); + ConfigureElasticsearch(loggerConfig, elasticSearchUrl, indexName, environment); + } + else + { + ConfigureElasticsearch(loggerConfig, elasticSearchUrl, indexName, environment); + } + } - private static void ConfigureElasticsearch(LoggerConfiguration loggerConfig, string elasticSearchUrl, - string indexName, IHostEnvironment environment) - { - var envName = environment.GetShortEnvironmentName(); + private static void ConfigureElasticsearch(LoggerConfiguration loggerConfig, string elasticSearchUrl, + string indexName, IHostEnvironment environment) + { + var envName = environment.GetShortEnvironmentName(); - var formattedIndexName = !string.IsNullOrEmpty(envName) - ? $"{indexName}-{envName}-logs-{DateTime.UtcNow:yyyy.MM}" - : $"{indexName}-logs-{DateTime.UtcNow:yyyy.MM}"; + var formattedIndexName = !string.IsNullOrEmpty(envName) + ? $"{indexName}-{envName}-logs-{DateTime.UtcNow:yyyy.MM}" + : $"{indexName}-logs-{DateTime.UtcNow:yyyy.MM}"; - loggerConfig.WriteTo.Elasticsearch(elasticSearchUrl, - indexFormat: formattedIndexName, - autoRegisterTemplate: true, - detectElasticsearchVersion: true, - numberOfShards: 5, - numberOfReplicas: 1, - bufferBaseFilename: "./logs/elastic-buffer", - bufferFileSizeLimitBytes: 1024 * 1024 * 16); // 16 MB each buffer file - } + loggerConfig.WriteTo.Elasticsearch(elasticSearchUrl, + indexFormat: formattedIndexName, + autoRegisterTemplate: true, + detectElasticsearchVersion: true, + numberOfShards: 5, + numberOfReplicas: 1, + bufferBaseFilename: "./logs/elastic-buffer", + bufferFileSizeLimitBytes: 1024 * 1024 * 16); // 16 MB each buffer file + } - private static bool ShouldExcludeHangfireDashboardLogs(this LogEvent logEvent) - { - return logEvent.Properties.TryGetValue("RequestPath", out var requestPathValue) - && requestPathValue is ScalarValue requestPath - && requestPath.Value?.ToString()?.Contains("/hangfire") == true; - } + private static bool ShouldExcludeHangfireDashboardLogs(this LogEvent logEvent) + { + return logEvent.Properties.TryGetValue("RequestPath", out var requestPathValue) + && requestPathValue is ScalarValue requestPath + && requestPath.Value?.ToString()?.Contains("/hangfire") == true; + } } diff --git a/src/Pandatech.VerticalSlices/Program.cs b/src/Pandatech.VerticalSlices/Program.cs index d133ed9..25f9a2a 100644 --- a/src/Pandatech.VerticalSlices/Program.cs +++ b/src/Pandatech.VerticalSlices/Program.cs @@ -17,7 +17,7 @@ .RegisterAllServices() .AddSwagger() .AddResponseCrafter() - .AddMediatrWithValidatorBehaviors() + .AddMediatrWithBehaviors() .RegisterPandaVaultEndpoint(); //optional builder.Services.AddCarter(); @@ -48,7 +48,7 @@ //todo Delete health checks and other configs of unrelated services. For example you might not need RMQ or Redis in this project. //todo Update all Nuget packages. //todo Include all required configurations in appsettings{environment}.json. -//todo Update ReadMe.md file. +//todo Update ReadMm.md file. //Delete below rows if you have no integration Pandatech.VerticalSlices.Tests in your solution. diff --git a/src/Pandatech.VerticalSlices/SharedKernel/Extensions/MediatRExtension.cs b/src/Pandatech.VerticalSlices/SharedKernel/Extensions/MediatRExtension.cs index f6a2f71..52e5213 100644 --- a/src/Pandatech.VerticalSlices/SharedKernel/Extensions/MediatRExtension.cs +++ b/src/Pandatech.VerticalSlices/SharedKernel/Extensions/MediatRExtension.cs @@ -6,7 +6,7 @@ namespace Pandatech.VerticalSlices.SharedKernel.Extensions; public static class MediatrExtension { - public static WebApplicationBuilder AddMediatrWithValidatorBehaviors(this WebApplicationBuilder builder) + public static WebApplicationBuilder AddMediatrWithBehaviors(this WebApplicationBuilder builder) { var assembly = typeof(Program).Assembly; builder.Services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(assembly)); diff --git a/src/Pandatech.VerticalSlices/SharedKernel/SharedEndpoints/OptionalEndpoints.cs b/src/Pandatech.VerticalSlices/SharedKernel/SharedEndpoints/OptionalEndpoints.cs index f21a2f3..dab9af8 100644 --- a/src/Pandatech.VerticalSlices/SharedKernel/SharedEndpoints/OptionalEndpoints.cs +++ b/src/Pandatech.VerticalSlices/SharedKernel/SharedEndpoints/OptionalEndpoints.cs @@ -9,11 +9,12 @@ namespace Pandatech.VerticalSlices.SharedKernel.SharedEndpoints; public static class OptionalEndpoints { private const string TagName = "above-board"; + public static void MapPandaOptionalEndpoints(this WebApplication app) { if (!app.Environment.IsProduction()) { - app.MapPandaVaultApi(TagName); + app.MapPandaVaultApi($"/{TagName}/configuration", TagName, ApiHelper.GroupNameMain); } if (app.Environment.IsLocal()) @@ -26,7 +27,8 @@ private static WebApplication MapDatabaseResetApi(this WebApplication app) { app.MapGet("/above-board/reset-database", ([FromServices] DatabaseHelper helper) => helper.ResetDatabase()) - .WithTags("above-board"); + .WithTags("above-board") + .WithGroupName(ApiHelper.GroupNameMain); return app; diff --git a/src/Pandatech.VerticalSlices/z. Old way/DTOs/GetUserDto.cs b/src/Pandatech.VerticalSlices/z. Old way/DTOs/GetUserDto.cs index a5b75b0..c0f3008 100644 --- a/src/Pandatech.VerticalSlices/z. Old way/DTOs/GetUserDto.cs +++ b/src/Pandatech.VerticalSlices/z. Old way/DTOs/GetUserDto.cs @@ -1,7 +1,7 @@ using BaseConverter.Attributes; using Pandatech.VerticalSlices.Domain.Enums; -namespace Pandatech.VerticalSlices.DTOs.User +namespace Pandatech.VerticalSlices.z._Old_way.DTOs { public class GetUserDto { diff --git a/src/Pandatech.VerticalSlices/z. Old way/DTOs/RolesSelect.cs b/src/Pandatech.VerticalSlices/z. Old way/DTOs/RolesSelect.cs index b6f3ffc..6a2eddf 100644 --- a/src/Pandatech.VerticalSlices/z. Old way/DTOs/RolesSelect.cs +++ b/src/Pandatech.VerticalSlices/z. Old way/DTOs/RolesSelect.cs @@ -1,6 +1,6 @@ using Pandatech.VerticalSlices.Domain.Enums; -namespace Pandatech.VerticalSlices.DTOs.User +namespace Pandatech.VerticalSlices.z._Old_way.DTOs { public class RolesSelect { diff --git a/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdatePasswordDto.cs b/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdatePasswordDto.cs index 568376c..7fa3010 100644 --- a/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdatePasswordDto.cs +++ b/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdatePasswordDto.cs @@ -1,6 +1,6 @@ using BaseConverter.Attributes; -namespace Pandatech.VerticalSlices.DTOs.User +namespace Pandatech.VerticalSlices.z._Old_way.DTOs { public class UpdatePasswordDto { diff --git a/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdateStatusDto.cs b/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdateStatusDto.cs index 60d838b..6936149 100644 --- a/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdateStatusDto.cs +++ b/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdateStatusDto.cs @@ -2,7 +2,7 @@ using BaseConverter.Attributes; using Pandatech.VerticalSlices.Domain.Enums; -namespace Pandatech.VerticalSlices.DTOs.User +namespace Pandatech.VerticalSlices.z._Old_way.DTOs { public class UpdateStatusDto { diff --git a/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdateUserDto.cs b/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdateUserDto.cs index 45385f8..c4e3bfc 100644 --- a/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdateUserDto.cs +++ b/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdateUserDto.cs @@ -2,7 +2,7 @@ using BaseConverter.Attributes; using Pandatech.VerticalSlices.Domain.Enums; -namespace Pandatech.VerticalSlices.DTOs.User +namespace Pandatech.VerticalSlices.z._Old_way.DTOs { public class UpdateUserDto { diff --git a/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdateUserStatusDto.cs b/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdateUserStatusDto.cs index 25372f6..db5de76 100644 --- a/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdateUserStatusDto.cs +++ b/src/Pandatech.VerticalSlices/z. Old way/DTOs/UpdateUserStatusDto.cs @@ -2,7 +2,7 @@ using BaseConverter.Attributes; using Pandatech.VerticalSlices.Domain.Enums; -namespace Pandatech.VerticalSlices.DTOs.User +namespace Pandatech.VerticalSlices.z._Old_way.DTOs { public class UpdateUserStatusDto { diff --git a/src/Pandatech.VerticalSlices/z. Old way/UserService.cs b/src/Pandatech.VerticalSlices/z. Old way/UserService.cs index f907643..96b5fd6 100644 --- a/src/Pandatech.VerticalSlices/z. Old way/UserService.cs +++ b/src/Pandatech.VerticalSlices/z. Old way/UserService.cs @@ -6,12 +6,12 @@ using PandaTech.IEnumerableFilters.Extensions; using Pandatech.VerticalSlices.Domain.EntityFilters; using Pandatech.VerticalSlices.Domain.Enums; -using Pandatech.VerticalSlices.DTOs.User; using Pandatech.VerticalSlices.Infrastructure.Contexts; +using Pandatech.VerticalSlices.z._Old_way.DTOs; using ResponseCrafter.Dtos; using ResponseCrafter.StandardHttpExceptions; -namespace Pandatech.VerticalSlices.Services.Implementations; +namespace Pandatech.VerticalSlices.z._Old_way; public class UserService( Argon2Id argon2Id,