diff --git a/KonSoft.sln.DotSettings b/KonSoft.sln.DotSettings index cb0b2c9..cffb367 100644 --- a/KonSoft.sln.DotSettings +++ b/KonSoft.sln.DotSettings @@ -20,4 +20,5 @@ False False SQL + True \ No newline at end of file diff --git a/applications/KonSoft.AuthServer/Dockerfile b/applications/KonSoft.AuthServer/Dockerfile index e3d23a4..ef44ab6 100644 --- a/applications/KonSoft.AuthServer/Dockerfile +++ b/applications/KonSoft.AuthServer/Dockerfile @@ -5,6 +5,16 @@ EXPOSE 8081 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG BUILD_CONFIGURATION=Release +ARG NODE_VERSION=16.13.0 +ARG YARN_VERSION=1.22.15 +RUN apt-get update -yq \ + && apt-get install -yq curl gnupg \ + && curl -sL https://deb.nodesource.com/setup_16.x | bash - \ + && apt-get install -yq nodejs \ + && npm install -g yarn@${YARN_VERSION} \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* +ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["NuGet.Config", "."] COPY ["applications/KonSoft.AuthServer/KonSoft.AuthServer.csproj", "applications/KonSoft.AuthServer/"] @@ -15,6 +25,9 @@ COPY ["shared/KonSoft.Shared.Localization/KonSoft.Shared.Localization.csproj", " RUN dotnet restore "./applications/KonSoft.AuthServer/KonSoft.AuthServer.csproj" COPY . . WORKDIR "/src/applications/KonSoft.AuthServer" +RUN dotnet tool install -g Volo.Abp.Cli \ + && export PATH="$PATH:/root/.dotnet/tools" \ + && abp install-libs RUN dotnet build "./KonSoft.AuthServer.csproj" -c $BUILD_CONFIGURATION -o /app/build # 此阶段用于发布要复制到最终阶段的服务项目 diff --git a/applications/KonSoft.AuthServer/KonSoftAuthServerModule.cs b/applications/KonSoft.AuthServer/KonSoftAuthServerModule.cs index 171c3b1..7529a65 100644 --- a/applications/KonSoft.AuthServer/KonSoftAuthServerModule.cs +++ b/applications/KonSoft.AuthServer/KonSoftAuthServerModule.cs @@ -26,7 +26,7 @@ namespace KonSoft; typeof(AbpAccountApplicationModule), typeof(AbpAccountHttpApiModule), typeof(KonSoftSharedHostingMicroservicesModule) - )] +)] public class KonSoftAuthServerModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -53,7 +53,8 @@ public class KonSoftAuthServerModule : AbpModule PreConfigure(serverBuilder => { - serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", "59464dba-b66e-48cd-8b81-2e4a9c08c977"); + serverBuilder.AddProductionEncryptionAndSigningCertificate("openiddict.pfx", + "59464dba-b66e-48cd-8b81-2e4a9c08c977"); }); } } @@ -77,23 +78,17 @@ public class KonSoftAuthServerModule : AbpModule { options.StyleBundles.Configure( BasicThemeBundles.Styles.Global, - bundle => - { - bundle.AddFiles("/global-styles.css"); - } + bundle => { bundle.AddFiles("/global-styles.css"); } ); }); Configure(options => { - options.IsEnabledForGetRequests = true; - options.ApplicationName = "AuthServer"; + options.IsEnabledForGetRequests = true; + options.ApplicationName = "AuthServer"; }); - Configure(options => - { - options.IsJobExecutionEnabled = false; - }); + Configure(options => { options.IsJobExecutionEnabled = false; }); context.Services.Configure(options => { @@ -138,4 +133,4 @@ public class KonSoftAuthServerModule : AbpModule app.UseAbpSerilogEnrichers(); app.UseConfiguredEndpoints(); } -} +} \ No newline at end of file diff --git a/applications/KonSoft.AuthServer/KonSoftBrandingProvider.cs b/applications/KonSoft.AuthServer/KonSoftBrandingProvider.cs index 56858dd..5721aed 100644 --- a/applications/KonSoft.AuthServer/KonSoftBrandingProvider.cs +++ b/applications/KonSoft.AuthServer/KonSoftBrandingProvider.cs @@ -8,7 +8,7 @@ namespace KonSoft; [Dependency(ReplaceServices = true)] public class KonSoftBrandingProvider : DefaultBrandingProvider { - private IStringLocalizer _localizer; + private readonly IStringLocalizer _localizer; public KonSoftBrandingProvider(IStringLocalizer localizer) { @@ -16,4 +16,4 @@ public class KonSoftBrandingProvider : DefaultBrandingProvider } public override string AppName => _localizer["AppName"]; -} +} \ No newline at end of file diff --git a/applications/KonSoft.AuthServer/Pages/Index.cshtml b/applications/KonSoft.AuthServer/Pages/Index.cshtml index 100f64a..6b961e2 100644 --- a/applications/KonSoft.AuthServer/Pages/Index.cshtml +++ b/applications/KonSoft.AuthServer/Pages/Index.cshtml @@ -1,12 +1,13 @@ @page +@using System.Net +@using KonSoft.Shared.Localization.Localization @using Microsoft.AspNetCore.Http.Extensions @using Microsoft.AspNetCore.Mvc.Localization -@using KonSoft.Pages -@using KonSoft.Shared.Localization.Localization -@using Volo.Abp.Users +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid @using Volo.Abp.AspNetCore.Mvc.UI.Theming @using Volo.Abp.Ui.Branding -@model IndexModel +@using Volo.Abp.Users +@model KonSoft.Pages.IndexModel @inject IHtmlLocalizer L @inject ICurrentUser CurrentUser @inject IBrandingProvider BrandingProvider @@ -45,32 +46,32 @@
-
- @if (CurrentUser.IsAuthenticated) - { - - } - else - { - @L["Login"] - } -
+
+ @if (CurrentUser.IsAuthenticated) + { + + } + else + { + @L["Login"] + } +
- - @if (@Model.Languages != null) + + @if (Model.Languages != null) { @foreach (var language in Model.Languages) { - var languageUrl = Url.Content($"~/Abp/Languages/Switch?culture={language.CultureName}&uiCulture={language.UiCultureName}&returnUrl={System.Net.WebUtility.UrlEncode(Request.GetEncodedPathAndQuery())}"); + var languageUrl = Url.Content($"~/Abp/Languages/Switch?culture={language.CultureName}&uiCulture={language.UiCultureName}&returnUrl={WebUtility.UrlEncode(Request.GetEncodedPathAndQuery())}"); @language.DisplayName } @@ -82,18 +83,18 @@ @if (Model.Applications != null) { -
+
@foreach (var application in Model.Applications) { - + - @{ - var clientUri = application.ClientUri.Contains("Swagger") ? application.ClientUri.EnsureEndsWith('/') + "swagger/index.html" : application.ClientUri; + @{ + var clientUri = application.ClientUri.Contains("Swagger") ? application.ClientUri.EnsureEndsWith('/') + "swagger/index.html" : application.ClientUri; } - + @if (!application.LogoUri.IsNullOrEmpty()) {
@@ -115,4 +116,4 @@
- + \ No newline at end of file diff --git a/applications/KonSoft.AuthServer/Pages/Index.cshtml.cs b/applications/KonSoft.AuthServer/Pages/Index.cshtml.cs index cfa19b7..fa752ca 100644 --- a/applications/KonSoft.AuthServer/Pages/Index.cshtml.cs +++ b/applications/KonSoft.AuthServer/Pages/Index.cshtml.cs @@ -9,6 +9,12 @@ namespace KonSoft.Pages; public class IndexModel : AbpPageModel { + public IndexModel(IOpenIddictApplicationRepository openIdApplicationRepository, ILanguageProvider languageProvider) + { + OpenIdApplicationRepository = openIdApplicationRepository; + LanguageProvider = languageProvider; + } + public List? Applications { get; protected set; } public IReadOnlyList? Languages { get; protected set; } @@ -19,12 +25,6 @@ public class IndexModel : AbpPageModel protected ILanguageProvider LanguageProvider { get; } - public IndexModel(IOpenIddictApplicationRepository openIdApplicationRepository, ILanguageProvider languageProvider) - { - OpenIdApplicationRepository = openIdApplicationRepository; - LanguageProvider = languageProvider; - } - public async Task OnGetAsync() { Applications = await OpenIdApplicationRepository.GetListAsync(); @@ -32,4 +32,4 @@ public class IndexModel : AbpPageModel Languages = await LanguageProvider.GetLanguagesAsync(); CurrentLanguage = CultureInfo.CurrentCulture.DisplayName; } -} +} \ No newline at end of file diff --git a/applications/KonSoft.AuthServer/Program.cs b/applications/KonSoft.AuthServer/Program.cs index 3431a6e..0622452 100644 --- a/applications/KonSoft.AuthServer/Program.cs +++ b/applications/KonSoft.AuthServer/Program.cs @@ -10,7 +10,7 @@ namespace KonSoft; public class Program { - public async static Task Main(string[] args) + public static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() #if DEBUG @@ -53,4 +53,4 @@ public class Program Log.CloseAndFlush(); } } -} +} \ No newline at end of file diff --git a/applications/KonSoft.AuthServer/web.config b/applications/KonSoft.AuthServer/web.config index a0bbf07..f3ab5f0 100644 --- a/applications/KonSoft.AuthServer/web.config +++ b/applications/KonSoft.AuthServer/web.config @@ -1,18 +1,20 @@  + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/applications/KonSoft.BackgroundJobs/Controllers/WeatherForecastController.cs b/applications/KonSoft.BackgroundJobs/Controllers/WeatherForecastController.cs index c3d2a1d..2d04686 100644 --- a/applications/KonSoft.BackgroundJobs/Controllers/WeatherForecastController.cs +++ b/applications/KonSoft.BackgroundJobs/Controllers/WeatherForecastController.cs @@ -1,33 +1,32 @@ using Microsoft.AspNetCore.Mvc; -namespace KonSoft.BackgroundJobs.Controllers +namespace KonSoft.BackgroundJobs.Controllers; + +[ApiController] +[Route("[controller]")] +public class WeatherForecastController : ControllerBase { - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase + private static readonly string[] Summaries = + [ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + ]; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) { - private static readonly string[] Summaries = - [ - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - ]; + _logger = logger; + } - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - - [HttpGet(Name = "GetWeatherForecast")] - public IEnumerable Get() - { - return Enumerable.Range(1, 5).Select(index => new WeatherForecast + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast { Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), TemperatureC = Random.Shared.Next(-20, 55), Summary = Summaries[Random.Shared.Next(Summaries.Length)] }) .ToArray(); - } } -} +} \ No newline at end of file diff --git a/applications/KonSoft.BackgroundJobs/Program.cs b/applications/KonSoft.BackgroundJobs/Program.cs index 48863a6..8264bac 100644 --- a/applications/KonSoft.BackgroundJobs/Program.cs +++ b/applications/KonSoft.BackgroundJobs/Program.cs @@ -22,4 +22,4 @@ app.UseAuthorization(); app.MapControllers(); -app.Run(); +app.Run(); \ No newline at end of file diff --git a/applications/KonSoft.BackgroundJobs/WeatherForecast.cs b/applications/KonSoft.BackgroundJobs/WeatherForecast.cs index 95cf6dc..46a479e 100644 --- a/applications/KonSoft.BackgroundJobs/WeatherForecast.cs +++ b/applications/KonSoft.BackgroundJobs/WeatherForecast.cs @@ -1,13 +1,12 @@ -namespace KonSoft.BackgroundJobs +namespace KonSoft.BackgroundJobs; + +public class WeatherForecast { - public class WeatherForecast - { - public DateOnly Date { get; set; } + public DateOnly Date { get; set; } - public int TemperatureC { get; set; } + public int TemperatureC { get; set; } - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - public string? Summary { get; set; } - } -} + public string? Summary { get; set; } +} \ No newline at end of file diff --git a/applications/KonSoft.BackgroundWorker/Controllers/WeatherForecastController.cs b/applications/KonSoft.BackgroundWorker/Controllers/WeatherForecastController.cs index b2fde33..b394e24 100644 --- a/applications/KonSoft.BackgroundWorker/Controllers/WeatherForecastController.cs +++ b/applications/KonSoft.BackgroundWorker/Controllers/WeatherForecastController.cs @@ -1,33 +1,32 @@ using Microsoft.AspNetCore.Mvc; -namespace KonSoft.BackgroundWorker.Controllers +namespace KonSoft.BackgroundWorker.Controllers; + +[ApiController] +[Route("[controller]")] +public class WeatherForecastController : ControllerBase { - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase + private static readonly string[] Summaries = + [ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + ]; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) { - private static readonly string[] Summaries = - [ - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - ]; + _logger = logger; + } - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - - [HttpGet(Name = "GetWeatherForecast")] - public IEnumerable Get() - { - return Enumerable.Range(1, 5).Select(index => new WeatherForecast + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast { Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), TemperatureC = Random.Shared.Next(-20, 55), Summary = Summaries[Random.Shared.Next(Summaries.Length)] }) .ToArray(); - } } -} +} \ No newline at end of file diff --git a/applications/KonSoft.BackgroundWorker/Program.cs b/applications/KonSoft.BackgroundWorker/Program.cs index 48863a6..8264bac 100644 --- a/applications/KonSoft.BackgroundWorker/Program.cs +++ b/applications/KonSoft.BackgroundWorker/Program.cs @@ -22,4 +22,4 @@ app.UseAuthorization(); app.MapControllers(); -app.Run(); +app.Run(); \ No newline at end of file diff --git a/applications/KonSoft.BackgroundWorker/WeatherForecast.cs b/applications/KonSoft.BackgroundWorker/WeatherForecast.cs index 8a9a070..2d7f56f 100644 --- a/applications/KonSoft.BackgroundWorker/WeatherForecast.cs +++ b/applications/KonSoft.BackgroundWorker/WeatherForecast.cs @@ -1,13 +1,12 @@ -namespace KonSoft.BackgroundWorker +namespace KonSoft.BackgroundWorker; + +public class WeatherForecast { - public class WeatherForecast - { - public DateOnly Date { get; set; } + public DateOnly Date { get; set; } - public int TemperatureC { get; set; } + public int TemperatureC { get; set; } - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - public string? Summary { get; set; } - } -} + public string? Summary { get; set; } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..20b53c4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,39 @@ +services: + internalgateways: + container_name: clean-internalgateways + restart: always + build: + context: . + dockerfile: ./gateways/KonSoft.InternalGateway/Dockerfile + environment: + - ASPNETCORE_ENVIRONMENT=Test + - AgileConfig__AppId=KonSoft.InternalGateway + - AgileConfig__Name=KonSoft.InternalGateway + - AgileConfig__Nodes=https://config.konsoft.top/ + - AgileConfig__Secret=DBE31703-14F9-4B01-893D-900B8380CE04 + + authserver: + container_name: clean-authserver + restart: always + build: + context: . + dockerfile: ./applications/KonSoft.AuthServer/Dockerfile + environment: + - ASPNETCORE_ENVIRONMENT=Test + - AgileConfig__AppId=KonSoft.AuthServer + - AgileConfig__Name=KonSoft.AuthServer + - AgileConfig__Nodes=https://config.konsoft.top/ + - AgileConfig__Secret=DBE31703-14F9-4B01-893D-900B8380CE04 + + adminservice: + container_name: clean-adminservice + restart: always + build: + context: . + dockerfile: ./microservices/KonSoft.Admin.HttpApi.Host/Dockerfile + environment: + - ASPNETCORE_ENVIRONMENT=Test + - AgileConfig__AppId=KonSoft.Admin.HttpApi.Host + - AgileConfig__Name=KonSoft.Admin.HttpApi.Host + - AgileConfig__Nodes=https://config.konsoft.top/ + - AgileConfig__Secret=DBE31703-14F9-4B01-893D-900B8380CE04 \ No newline at end of file diff --git a/gateways/KonSoft.InternalGateway/Controllers/WeatherForecastController.cs b/gateways/KonSoft.InternalGateway/Controllers/WeatherForecastController.cs deleted file mode 100644 index 525870b..0000000 --- a/gateways/KonSoft.InternalGateway/Controllers/WeatherForecastController.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace KonSoft.InternalGateway.Controllers -{ - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase - { - private static readonly string[] Summaries = - [ - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - ]; - - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - - [HttpGet(Name = "GetWeatherForecast")] - public IEnumerable Get() - { - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - }) - .ToArray(); - } - } -} diff --git a/gateways/KonSoft.InternalGateway/Dockerfile b/gateways/KonSoft.InternalGateway/Dockerfile new file mode 100644 index 0000000..19e12f9 --- /dev/null +++ b/gateways/KonSoft.InternalGateway/Dockerfile @@ -0,0 +1,29 @@ +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +USER $APP_UID +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + + +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["NuGet.Config", "."] +COPY ["gateways/KonSoft.InternalGateway/KonSoft.InternalGateway.csproj", "gateways/KonSoft.InternalGateway/"] +COPY ["shared/KonSoft.Shared.Hosting.Gateways/KonSoft.Shared.Hosting.Gateways.csproj", "shared/KonSoft.Shared.Hosting.Gateways/"] +COPY ["shared/KonSoft.Shared.Hosting.AspNetCore/KonSoft.Shared.Hosting.AspNetCore.csproj", "shared/KonSoft.Shared.Hosting.AspNetCore/"] +COPY ["shared/KonSoft.Shared.Hosting/KonSoft.Shared.Hosting.csproj", "shared/KonSoft.Shared.Hosting/"] +COPY ["shared/KonSoft.Shared.Localization/KonSoft.Shared.Localization.csproj", "shared/KonSoft.Shared.Localization/"] +RUN dotnet restore "./gateways/KonSoft.InternalGateway/KonSoft.InternalGateway.csproj" +COPY . . +WORKDIR "/src/gateways/KonSoft.InternalGateway" +RUN dotnet build "./KonSoft.InternalGateway.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./KonSoft.InternalGateway.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "KonSoft.InternalGateway.dll"] \ No newline at end of file diff --git a/gateways/KonSoft.InternalGateway/InternalGatewayModule.cs b/gateways/KonSoft.InternalGateway/InternalGatewayModule.cs new file mode 100644 index 0000000..f046065 --- /dev/null +++ b/gateways/KonSoft.InternalGateway/InternalGatewayModule.cs @@ -0,0 +1,17 @@ +using KonSoft.Shared.Hosting.Gateways; +using Volo.Abp; +using Volo.Abp.Modularity; + +namespace KonSoft.InternalGateway +{ + [DependsOn( + typeof(KonSoftSharedHostingGatewaysModule) + )] + public class InternalGatewayModule : AbpModule + { + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + + } + } +} diff --git a/gateways/KonSoft.InternalGateway/KonSoft.InternalGateway.csproj b/gateways/KonSoft.InternalGateway/KonSoft.InternalGateway.csproj index 5419ef0..4bd0fa3 100644 --- a/gateways/KonSoft.InternalGateway/KonSoft.InternalGateway.csproj +++ b/gateways/KonSoft.InternalGateway/KonSoft.InternalGateway.csproj @@ -4,10 +4,18 @@ net8.0 enable enable + 98521e87-fe4a-4555-8c3b-e83559a64e03 + Linux + ..\.. - + + + + + + diff --git a/gateways/KonSoft.InternalGateway/Program.cs b/gateways/KonSoft.InternalGateway/Program.cs index 48863a6..ae03f33 100644 --- a/gateways/KonSoft.InternalGateway/Program.cs +++ b/gateways/KonSoft.InternalGateway/Program.cs @@ -1,25 +1,37 @@ -var builder = WebApplication.CreateBuilder(args); +using KonSoft.InternalGateway; +using KonSoft.Shared.Hosting.AspNetCore; +using Serilog; -// Add services to the container. +var assemblyName = typeof(Program).Assembly.GetName().Name!; +SerilogConfigurationHelper.Configure(assemblyName); -builder.Services.AddControllers(); -// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); - -var app = builder.Build(); - -// Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) +try { - app.UseSwagger(); - app.UseSwaggerUI(); + var builder = WebApplication.CreateBuilder(args); + builder.Configuration + .AddAgileConfig(option => + { + option.ENV = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Development"; + }); + builder.Host + .AddAppSettingsSecretsJson() + .UseAutofac() + .UseSerilog(); + builder.Services.AddReverseProxy() + .LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")); + await builder.AddApplicationAsync(); + var app = builder.Build(); + await app.InitializeApplicationAsync(); + await app.RunAsync(); + + return 0; } - -app.UseHttpsRedirection(); - -app.UseAuthorization(); - -app.MapControllers(); - -app.Run(); +catch (Exception ex) +{ + Log.Fatal(ex, $"{assemblyName} terminated unexpectedly!"); + return 1; +} +finally +{ + await Log.CloseAndFlushAsync(); +} \ No newline at end of file diff --git a/gateways/KonSoft.InternalGateway/Properties/launchSettings.json b/gateways/KonSoft.InternalGateway/Properties/launchSettings.json index 407c599..ed7fdeb 100644 --- a/gateways/KonSoft.InternalGateway/Properties/launchSettings.json +++ b/gateways/KonSoft.InternalGateway/Properties/launchSettings.json @@ -1,33 +1,24 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:15968", - "sslPort": 44395 - } - }, +{ "profiles": { "http": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://localhost:5090", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5090" }, "https": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "https://localhost:7264;http://localhost:5090", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7264;http://localhost:5090" }, "IIS Express": { "commandName": "IISExpress", @@ -36,6 +27,26 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Container (Dockerfile)": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "environmentVariables": { + "ASPNETCORE_HTTPS_PORTS": "8081", + "ASPNETCORE_HTTP_PORTS": "8080" + }, + "publishAllPorts": true, + "useSSL": true + } + }, + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:15968", + "sslPort": 44395 } } -} +} \ No newline at end of file diff --git a/gateways/KonSoft.InternalGateway/WeatherForecast.cs b/gateways/KonSoft.InternalGateway/WeatherForecast.cs deleted file mode 100644 index 3905db0..0000000 --- a/gateways/KonSoft.InternalGateway/WeatherForecast.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace KonSoft.InternalGateway -{ - public class WeatherForecast - { - public DateOnly Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } - } -} diff --git a/gateways/KonSoft.InternalGateway/appsettings.json b/gateways/KonSoft.InternalGateway/appsettings.json index 10f68b8..8b93288 100644 --- a/gateways/KonSoft.InternalGateway/appsettings.json +++ b/gateways/KonSoft.InternalGateway/appsettings.json @@ -1,9 +1,8 @@ { - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" + "AgileConfig": { + "appId": "KonSoft.InternalGateway", + "name": "KonSoft.InternalGateway", + "nodes": "https://config.konsoft.top/", + "secret": "DBE31703-14F9-4B01-893D-900B8380CE04" + } } diff --git a/gateways/KonSoft.PublicGateway/Controllers/WeatherForecastController.cs b/gateways/KonSoft.PublicGateway/Controllers/WeatherForecastController.cs index 1af2048..4eee9a9 100644 --- a/gateways/KonSoft.PublicGateway/Controllers/WeatherForecastController.cs +++ b/gateways/KonSoft.PublicGateway/Controllers/WeatherForecastController.cs @@ -1,33 +1,32 @@ using Microsoft.AspNetCore.Mvc; -namespace KonSoft.PublicGateway.Controllers +namespace KonSoft.PublicGateway.Controllers; + +[ApiController] +[Route("[controller]")] +public class WeatherForecastController : ControllerBase { - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase + private static readonly string[] Summaries = + [ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + ]; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) { - private static readonly string[] Summaries = - [ - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - ]; + _logger = logger; + } - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - - [HttpGet(Name = "GetWeatherForecast")] - public IEnumerable Get() - { - return Enumerable.Range(1, 5).Select(index => new WeatherForecast + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast { Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), TemperatureC = Random.Shared.Next(-20, 55), Summary = Summaries[Random.Shared.Next(Summaries.Length)] }) .ToArray(); - } } -} +} \ No newline at end of file diff --git a/gateways/KonSoft.PublicGateway/Program.cs b/gateways/KonSoft.PublicGateway/Program.cs index 48863a6..8264bac 100644 --- a/gateways/KonSoft.PublicGateway/Program.cs +++ b/gateways/KonSoft.PublicGateway/Program.cs @@ -22,4 +22,4 @@ app.UseAuthorization(); app.MapControllers(); -app.Run(); +app.Run(); \ No newline at end of file diff --git a/gateways/KonSoft.PublicGateway/WeatherForecast.cs b/gateways/KonSoft.PublicGateway/WeatherForecast.cs index 2577b66..6784d2b 100644 --- a/gateways/KonSoft.PublicGateway/WeatherForecast.cs +++ b/gateways/KonSoft.PublicGateway/WeatherForecast.cs @@ -1,13 +1,12 @@ -namespace KonSoft.PublicGateway +namespace KonSoft.PublicGateway; + +public class WeatherForecast { - public class WeatherForecast - { - public DateOnly Date { get; set; } + public DateOnly Date { get; set; } - public int TemperatureC { get; set; } + public int TemperatureC { get; set; } - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - public string? Summary { get; set; } - } -} + public string? Summary { get; set; } +} \ No newline at end of file diff --git a/microservices/KonSoft.Admin.HttpApi.Host/AdminHttpApiHostModule.cs b/microservices/KonSoft.Admin.HttpApi.Host/AdminHttpApiHostModule.cs index f142e0c..3f2fc14 100644 --- a/microservices/KonSoft.Admin.HttpApi.Host/AdminHttpApiHostModule.cs +++ b/microservices/KonSoft.Admin.HttpApi.Host/AdminHttpApiHostModule.cs @@ -23,9 +23,9 @@ public class AdminHttpApiHostModule : AbpModule var configuration = context.Services.GetConfiguration(); SwaggerConfigurationHelper.ConfigureWithOidc( - context: context, - authority: configuration["AuthServer:Authority"]!, - scopes: ["AdministrationService"], + context, + configuration["AuthServer:Authority"]!, + ["AdministrationService"], discoveryEndpoint: configuration["AuthServer:MetadataAddress"], apiTitle: "Administration Service API" ); @@ -69,9 +69,15 @@ public class AdminHttpApiHostModule : AbpModule options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); options.OAuthScopes("Admin"); }); - + app.UseAuditing(); app.UseAbpSerilogEnrichers(); app.UseConfiguredEndpoints(); } -} + + //public override async Task OnPostApplicationInitializationAsync(ApplicationInitializationContext context) + //{ + // await context.ServiceProvider.GetRequiredService() + // .CheckAndApplyDatabaseMigrationsAsync(); + //} +} \ No newline at end of file diff --git a/microservices/KonSoft.Admin.HttpApi.Host/Controllers/HomeController.cs b/microservices/KonSoft.Admin.HttpApi.Host/Controllers/HomeController.cs index caf536b..d815119 100644 --- a/microservices/KonSoft.Admin.HttpApi.Host/Controllers/HomeController.cs +++ b/microservices/KonSoft.Admin.HttpApi.Host/Controllers/HomeController.cs @@ -9,4 +9,4 @@ public class HomeController : AbpController { return Redirect("~/swagger"); } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.Admin.HttpApi.Host/DbMigrations/AdminDataSeedContributor.cs b/microservices/KonSoft.Admin.HttpApi.Host/DbMigrations/AdminDataSeedContributor.cs new file mode 100644 index 0000000..195c5ab --- /dev/null +++ b/microservices/KonSoft.Admin.HttpApi.Host/DbMigrations/AdminDataSeedContributor.cs @@ -0,0 +1,13 @@ +using System.Threading.Tasks; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; + +namespace KonSoft.Admin.DbMigrations; + +public class AdminDataSeedContributor : IDataSeedContributor, ITransientDependency +{ + public Task SeedAsync(DataSeedContext context) + { + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/microservices/KonSoft.Admin.HttpApi.Host/DbMigrations/AdminDataSeeder.cs b/microservices/KonSoft.Admin.HttpApi.Host/DbMigrations/AdminDataSeeder.cs deleted file mode 100644 index 5b125bf..0000000 --- a/microservices/KonSoft.Admin.HttpApi.Host/DbMigrations/AdminDataSeeder.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Threading.Tasks; -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; - -namespace KonSoft.Admin.DbMigrations -{ - public class AdminDataSeeder : IDataSeedContributor, ITransientDependency - { - public Task SeedAsync(DataSeedContext context) - { - return Task.CompletedTask; - } - } -} diff --git a/microservices/KonSoft.Admin.HttpApi.Host/DbMigrations/AdminPendingEfCoreMigrationsChecker.cs b/microservices/KonSoft.Admin.HttpApi.Host/DbMigrations/AdminPendingEfCoreMigrationsChecker.cs index 508e8be..b1d722c 100644 --- a/microservices/KonSoft.Admin.HttpApi.Host/DbMigrations/AdminPendingEfCoreMigrationsChecker.cs +++ b/microservices/KonSoft.Admin.HttpApi.Host/DbMigrations/AdminPendingEfCoreMigrationsChecker.cs @@ -6,21 +6,20 @@ using Volo.Abp.EventBus.Distributed; using Volo.Abp.MultiTenancy; using Volo.Abp.Uow; -namespace KonSoft.Admin.DbMigrations +namespace KonSoft.Admin.DbMigrations; + +public class AdminPendingEfCoreMigrationsChecker : PendingEfCoreMigrationsChecker { - public class AdminPendingEfCoreMigrationsChecker : PendingEfCoreMigrationsChecker + public AdminPendingEfCoreMigrationsChecker(IUnitOfWorkManager unitOfWorkManager, + IServiceProvider serviceProvider, + ICurrentTenant currentTenant, + IDistributedEventBus distributedEventBus, + IAbpDistributedLock abpDistributedLock) : base(unitOfWorkManager, + serviceProvider, + currentTenant, + distributedEventBus, + abpDistributedLock, + "Clean") { - public AdminPendingEfCoreMigrationsChecker(IUnitOfWorkManager unitOfWorkManager, - IServiceProvider serviceProvider, - ICurrentTenant currentTenant, - IDistributedEventBus distributedEventBus, - IAbpDistributedLock abpDistributedLock) : base(unitOfWorkManager, - serviceProvider, - currentTenant, - distributedEventBus, - abpDistributedLock, - "Clean") - { - } } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.Admin.HttpApi.Host/Dockerfile b/microservices/KonSoft.Admin.HttpApi.Host/Dockerfile index 582ca45..183f46b 100644 --- a/microservices/KonSoft.Admin.HttpApi.Host/Dockerfile +++ b/microservices/KonSoft.Admin.HttpApi.Host/Dockerfile @@ -4,7 +4,6 @@ WORKDIR /app EXPOSE 8080 -# 此阶段用于生成服务项目 FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src diff --git a/microservices/KonSoft.Admin.HttpApi.Host/KonSoft.Admin.HttpApi.Host.csproj b/microservices/KonSoft.Admin.HttpApi.Host/KonSoft.Admin.HttpApi.Host.csproj index 5debc82..cee14aa 100644 --- a/microservices/KonSoft.Admin.HttpApi.Host/KonSoft.Admin.HttpApi.Host.csproj +++ b/microservices/KonSoft.Admin.HttpApi.Host/KonSoft.Admin.HttpApi.Host.csproj @@ -17,6 +17,10 @@ + + + + diff --git a/microservices/KonSoft.Admin.HttpApi.Host/Program.cs b/microservices/KonSoft.Admin.HttpApi.Host/Program.cs index f357a71..1189def 100644 --- a/microservices/KonSoft.Admin.HttpApi.Host/Program.cs +++ b/microservices/KonSoft.Admin.HttpApi.Host/Program.cs @@ -1,8 +1,8 @@ -using KonSoft.Admin; +using System; +using KonSoft.Admin; using KonSoft.Shared.Hosting.AspNetCore; using Microsoft.AspNetCore.Builder; using Serilog; -using System; var assemblyName = typeof(Program).Assembly.GetName().Name!; diff --git a/microservices/KonSoft.Admin.HttpApi.Host/Properties/launchSettings.json b/microservices/KonSoft.Admin.HttpApi.Host/Properties/launchSettings.json index dfbbc2f..4660c69 100644 --- a/microservices/KonSoft.Admin.HttpApi.Host/Properties/launchSettings.json +++ b/microservices/KonSoft.Admin.HttpApi.Host/Properties/launchSettings.json @@ -1,5 +1,4 @@ { - "$schema": "http://json.schemastore.org/launchsettings.json", "profiles": { "http": { "commandName": "Project", @@ -8,6 +7,18 @@ "ASPNETCORE_ENVIRONMENT": "Development" }, "applicationUrl": "https://localhost:44354" + }, + "Container (Dockerfile)": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "environmentVariables": { + "ASPNETCORE_HTTPS_PORTS": "8081", + "ASPNETCORE_HTTP_PORTS": "8080" + }, + "publishAllPorts": true, + "useSSL": true } - } + }, + "$schema": "http://json.schemastore.org/launchsettings.json" } \ No newline at end of file diff --git a/microservices/KonSoft.Admin.HttpApi.Host/appsettings.json b/microservices/KonSoft.Admin.HttpApi.Host/appsettings.json index 5ea53ed..c1df4ef 100644 --- a/microservices/KonSoft.Admin.HttpApi.Host/appsettings.json +++ b/microservices/KonSoft.Admin.HttpApi.Host/appsettings.json @@ -1,29 +1,13 @@ { - "App": { - "CorsOrigins": "https://*.KonSoft.top" - }, - "ConnectionStrings": { - "Default": "Host=1.94.99.47;Port=26666;Database=Clean;User ID=postgres;Password=zzx7845zzx;" - }, - "Redis": { - "Configuration": "1.94.99.47:26668" + "AgileConfig": { + "appId": "KonSoft.Admin.HttpApi.Host", + "name": "KonSoft.Admin.HttpApi.Host", + "nodes": "https://config.konsoft.top/", + "secret": "DBE31703-14F9-4B01-893D-900B8380CE04" }, "AuthServer": { - "Authority": "https://localhost:44397", + "Authority": "https://localhost:44322", "RequireHttpsMetadata": true, "SwaggerClientId": "Admin_Swagger" - }, - "StringEncryption": { - "DefaultPassPhrase": "g3NdNOyDR9oYj0gK" - }, - "RabbitMQ": { - "Connections": { - "Default": { - "HostName": "1.94.99.47", - "Port": 26667, - "UserName": "admin", - "Password": "zzx7845zzx" - } - } } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.Admin.HttpApi.Host/web.config b/microservices/KonSoft.Admin.HttpApi.Host/web.config index fc25838..9b0476c 100644 --- a/microservices/KonSoft.Admin.HttpApi.Host/web.config +++ b/microservices/KonSoft.Admin.HttpApi.Host/web.config @@ -1,18 +1,20 @@  + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microservices/KonSoft.Dispatch.HttpApi.Host/Controllers/HomeController.cs b/microservices/KonSoft.Dispatch.HttpApi.Host/Controllers/HomeController.cs index 9c0bb17..5f97226 100644 --- a/microservices/KonSoft.Dispatch.HttpApi.Host/Controllers/HomeController.cs +++ b/microservices/KonSoft.Dispatch.HttpApi.Host/Controllers/HomeController.cs @@ -9,4 +9,4 @@ public class HomeController : AbpController { return Redirect("~/swagger"); } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.Dispatch.HttpApi.Host/DispatchHttpApiHostModule.cs b/microservices/KonSoft.Dispatch.HttpApi.Host/DispatchHttpApiHostModule.cs index 1a2fcb4..8ee6568 100644 --- a/microservices/KonSoft.Dispatch.HttpApi.Host/DispatchHttpApiHostModule.cs +++ b/microservices/KonSoft.Dispatch.HttpApi.Host/DispatchHttpApiHostModule.cs @@ -2,7 +2,6 @@ using KonSoft.Dispatch.EntityFrameworkCore; using KonSoft.Shared.Hosting.AspNetCore; using KonSoft.Shared.Hosting.Microservices; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Volo.Abp; @@ -24,9 +23,9 @@ public class DispatchHttpApiHostModule : AbpModule var configuration = context.Services.GetConfiguration(); SwaggerConfigurationHelper.ConfigureWithOidc( - context: context, - authority: configuration["AuthServer:Authority"]!, - scopes: ["DispatchService"], + context, + configuration["AuthServer:Authority"]!, + ["DispatchService"], discoveryEndpoint: configuration["AuthServer:MetadataAddress"], apiTitle: "Dispatch Service API" ); @@ -75,4 +74,4 @@ public class DispatchHttpApiHostModule : AbpModule app.UseAbpSerilogEnrichers(); app.UseConfiguredEndpoints(); } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.Dispatch.HttpApi.Host/Program.cs b/microservices/KonSoft.Dispatch.HttpApi.Host/Program.cs index caa2139..a4ed304 100644 --- a/microservices/KonSoft.Dispatch.HttpApi.Host/Program.cs +++ b/microservices/KonSoft.Dispatch.HttpApi.Host/Program.cs @@ -10,7 +10,7 @@ namespace KonSoft.Dispatch; public class Program { - public async static Task Main(string[] args) + public static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() #if DEBUG @@ -53,4 +53,4 @@ public class Program Log.CloseAndFlush(); } } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.Dispatch.HttpApi.Host/web.config b/microservices/KonSoft.Dispatch.HttpApi.Host/web.config index 729e3cd..b100f39 100644 --- a/microservices/KonSoft.Dispatch.HttpApi.Host/web.config +++ b/microservices/KonSoft.Dispatch.HttpApi.Host/web.config @@ -1,18 +1,20 @@  + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microservices/KonSoft.Payment.HttpApi.Host/Controllers/HomeController.cs b/microservices/KonSoft.Payment.HttpApi.Host/Controllers/HomeController.cs index 2974e46..1480f62 100644 --- a/microservices/KonSoft.Payment.HttpApi.Host/Controllers/HomeController.cs +++ b/microservices/KonSoft.Payment.HttpApi.Host/Controllers/HomeController.cs @@ -9,4 +9,4 @@ public class HomeController : AbpController { return Redirect("~/swagger"); } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.Payment.HttpApi.Host/PaymentHttpApiHostModule.cs b/microservices/KonSoft.Payment.HttpApi.Host/PaymentHttpApiHostModule.cs index 57bd455..ade593b 100644 --- a/microservices/KonSoft.Payment.HttpApi.Host/PaymentHttpApiHostModule.cs +++ b/microservices/KonSoft.Payment.HttpApi.Host/PaymentHttpApiHostModule.cs @@ -2,7 +2,6 @@ using KonSoft.Payment.EntityFrameworkCore; using KonSoft.Shared.Hosting.AspNetCore; using KonSoft.Shared.Hosting.Microservices; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Volo.Abp; @@ -24,9 +23,9 @@ public class PaymentHttpApiHostModule : AbpModule var configuration = context.Services.GetConfiguration(); SwaggerConfigurationHelper.ConfigureWithOidc( - context: context, - authority: configuration["AuthServer:Authority"]!, - scopes: ["PaymentService"], + context, + configuration["AuthServer:Authority"]!, + ["PaymentService"], discoveryEndpoint: configuration["AuthServer:MetadataAddress"], apiTitle: "Payment Service API" ); @@ -75,4 +74,4 @@ public class PaymentHttpApiHostModule : AbpModule app.UseAbpSerilogEnrichers(); app.UseConfiguredEndpoints(); } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.Payment.HttpApi.Host/Program.cs b/microservices/KonSoft.Payment.HttpApi.Host/Program.cs index dfd86a7..e59121c 100644 --- a/microservices/KonSoft.Payment.HttpApi.Host/Program.cs +++ b/microservices/KonSoft.Payment.HttpApi.Host/Program.cs @@ -10,7 +10,7 @@ namespace KonSoft.Payment; public class Program { - public async static Task Main(string[] args) + public static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() #if DEBUG @@ -53,4 +53,4 @@ public class Program Log.CloseAndFlush(); } } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.Payment.HttpApi.Host/web.config b/microservices/KonSoft.Payment.HttpApi.Host/web.config index d8a82b4..b18b7ca 100644 --- a/microservices/KonSoft.Payment.HttpApi.Host/web.config +++ b/microservices/KonSoft.Payment.HttpApi.Host/web.config @@ -1,18 +1,20 @@  + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microservices/KonSoft.Report.HttpApi.Host/Controllers/HomeController.cs b/microservices/KonSoft.Report.HttpApi.Host/Controllers/HomeController.cs index 1175391..3bbf891 100644 --- a/microservices/KonSoft.Report.HttpApi.Host/Controllers/HomeController.cs +++ b/microservices/KonSoft.Report.HttpApi.Host/Controllers/HomeController.cs @@ -9,4 +9,4 @@ public class HomeController : AbpController { return Redirect("~/swagger"); } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.Report.HttpApi.Host/Program.cs b/microservices/KonSoft.Report.HttpApi.Host/Program.cs index 54c2ba8..1aeeae8 100644 --- a/microservices/KonSoft.Report.HttpApi.Host/Program.cs +++ b/microservices/KonSoft.Report.HttpApi.Host/Program.cs @@ -10,7 +10,7 @@ namespace KonSoft.Report; public class Program { - public async static Task Main(string[] args) + public static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() #if DEBUG @@ -53,4 +53,4 @@ public class Program Log.CloseAndFlush(); } } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.Report.HttpApi.Host/ReportHttpApiHostModule.cs b/microservices/KonSoft.Report.HttpApi.Host/ReportHttpApiHostModule.cs index 3d27148..8289318 100644 --- a/microservices/KonSoft.Report.HttpApi.Host/ReportHttpApiHostModule.cs +++ b/microservices/KonSoft.Report.HttpApi.Host/ReportHttpApiHostModule.cs @@ -2,7 +2,6 @@ using KonSoft.Report.EntityFrameworkCore; using KonSoft.Shared.Hosting.AspNetCore; using KonSoft.Shared.Hosting.Microservices; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Volo.Abp; @@ -24,9 +23,9 @@ public class ReportHttpApiHostModule : AbpModule var configuration = context.Services.GetConfiguration(); SwaggerConfigurationHelper.ConfigureWithOidc( - context: context, - authority: configuration["AuthServer:Authority"]!, - scopes: ["ReportService"], + context, + configuration["AuthServer:Authority"]!, + ["ReportService"], discoveryEndpoint: configuration["AuthServer:MetadataAddress"], apiTitle: "Report Service API" ); @@ -75,4 +74,4 @@ public class ReportHttpApiHostModule : AbpModule app.UseAbpSerilogEnrichers(); app.UseConfiguredEndpoints(); } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.Report.HttpApi.Host/web.config b/microservices/KonSoft.Report.HttpApi.Host/web.config index aee1cd4..3e0193a 100644 --- a/microservices/KonSoft.Report.HttpApi.Host/web.config +++ b/microservices/KonSoft.Report.HttpApi.Host/web.config @@ -1,18 +1,20 @@  + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/microservices/KonSoft.TenantManagement.HttpApi.Host/Controllers/HomeController.cs b/microservices/KonSoft.TenantManagement.HttpApi.Host/Controllers/HomeController.cs index be4fe40..d11861b 100644 --- a/microservices/KonSoft.TenantManagement.HttpApi.Host/Controllers/HomeController.cs +++ b/microservices/KonSoft.TenantManagement.HttpApi.Host/Controllers/HomeController.cs @@ -9,4 +9,4 @@ public class HomeController : AbpController { return Redirect("~/swagger"); } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.TenantManagement.HttpApi.Host/Program.cs b/microservices/KonSoft.TenantManagement.HttpApi.Host/Program.cs index 26cedfb..4b39966 100644 --- a/microservices/KonSoft.TenantManagement.HttpApi.Host/Program.cs +++ b/microservices/KonSoft.TenantManagement.HttpApi.Host/Program.cs @@ -10,7 +10,7 @@ namespace KonSoft.TenantManagement; public class Program { - public async static Task Main(string[] args) + public static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() #if DEBUG @@ -53,4 +53,4 @@ public class Program Log.CloseAndFlush(); } } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.TenantManagement.HttpApi.Host/TenantManagementHttpApiHostModule.cs b/microservices/KonSoft.TenantManagement.HttpApi.Host/TenantManagementHttpApiHostModule.cs index d209b92..b1c51e5 100644 --- a/microservices/KonSoft.TenantManagement.HttpApi.Host/TenantManagementHttpApiHostModule.cs +++ b/microservices/KonSoft.TenantManagement.HttpApi.Host/TenantManagementHttpApiHostModule.cs @@ -2,7 +2,6 @@ using KonSoft.Shared.Hosting.AspNetCore; using KonSoft.Shared.Hosting.Microservices; using KonSoft.TenantManagement.EntityFrameworkCore; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Volo.Abp; @@ -24,9 +23,9 @@ public class TenantManagementHttpApiHostModule : AbpModule var configuration = context.Services.GetConfiguration(); SwaggerConfigurationHelper.ConfigureWithOidc( - context: context, - authority: configuration["AuthServer:Authority"]!, - scopes: ["TenantManagementService"], + context, + configuration["AuthServer:Authority"]!, + ["TenantManagementService"], discoveryEndpoint: configuration["AuthServer:MetadataAddress"], apiTitle: "TenantManagement Service API" ); @@ -75,4 +74,4 @@ public class TenantManagementHttpApiHostModule : AbpModule app.UseAbpSerilogEnrichers(); app.UseConfiguredEndpoints(); } -} +} \ No newline at end of file diff --git a/microservices/KonSoft.TenantManagement.HttpApi.Host/web.config b/microservices/KonSoft.TenantManagement.HttpApi.Host/web.config index 407dc06..f7caf8c 100644 --- a/microservices/KonSoft.TenantManagement.HttpApi.Host/web.config +++ b/microservices/KonSoft.TenantManagement.HttpApi.Host/web.config @@ -1,18 +1,20 @@  + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/AdminApplicationContractsModule.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/AdminApplicationContractsModule.cs index a4da8ef..3343628 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/AdminApplicationContractsModule.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/AdminApplicationContractsModule.cs @@ -25,4 +25,4 @@ public class AdminApplicationContractsModule : AbpModule { AdminDtoExtensions.Configure(); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/AdminDtoExtensions.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/AdminDtoExtensions.cs index 2b4f57c..86a0f2b 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/AdminDtoExtensions.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/AdminDtoExtensions.cs @@ -1,28 +1,26 @@ -using Volo.Abp.Identity; -using Volo.Abp.ObjectExtending; -using Volo.Abp.Threading; +using Volo.Abp.Threading; namespace KonSoft.Admin; public static class AdminDtoExtensions { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { OneTimeRunner.Run(() => { - /* You can add extension properties to DTOs - * defined in the depended modules. - * - * Example: - * - * ObjectExtensionManager.Instance - * .AddOrUpdateProperty("Title"); - * - * See the documentation for more: - * https://docs.abp.io/en/abp/latest/Object-Extensions - */ + /* You can add extension properties to DTOs + * defined in the depended modules. + * + * Example: + * + * ObjectExtensionManager.Instance + * .AddOrUpdateProperty("Title"); + * + * See the documentation for more: + * https://docs.abp.io/en/abp/latest/Object-Extensions + */ }); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/AddressDto.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/AddressDto.cs index 45c2de5..eec00ce 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/AddressDto.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/AddressDto.cs @@ -1,17 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +namespace KonSoft.Admin.Dtos; -namespace KonSoft.Admin.Dtos +public class AddressDto { - public class AddressDto - { - public string ContactName { get; set; } - public string ContactPhone { get; set; } - public string DetailAddress { get; set; } - public string City { get; set; } - public string District { get; set; } - } -} + public string ContactName { get; set; } + public string ContactPhone { get; set; } + public string DetailAddress { get; set; } + public string City { get; set; } + public string District { get; set; } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/CreateOrderDto.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/CreateOrderDto.cs index 171abcf..81dc26d 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/CreateOrderDto.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/CreateOrderDto.cs @@ -1,25 +1,19 @@ using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace KonSoft.Admin.Dtos +namespace KonSoft.Admin.Dtos; + +public class CreateOrderDto { - public class CreateOrderDto - { - [Required] - public Guid CustomerId { get; set; } - [Required] - public Guid ServiceCategoryId { get; set; } - [Required] - public DateTime ServiceTime { get; set; } - [Required] - public decimal Amount { get; set; } - [Required] - public AddressDto Address { get; set; } + [Required] public Guid CustomerId { get; set; } - public string Remark { get; set; } - } -} + [Required] public Guid ServiceCategoryId { get; set; } + + [Required] public DateTime ServiceTime { get; set; } + + [Required] public decimal Amount { get; set; } + + [Required] public AddressDto Address { get; set; } + + public string Remark { get; set; } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/CreateServiceCategoryDto.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/CreateServiceCategoryDto.cs index 73acd6d..3bd5a9e 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/CreateServiceCategoryDto.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/CreateServiceCategoryDto.cs @@ -1,14 +1,9 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace KonSoft.Admin.Dtos +namespace KonSoft.Admin.Dtos; + +public class CreateServiceCategoryDto { - public class CreateServiceCategoryDto - { - public string Name { get; set; } - public Guid? ParentId { get; set; } - } -} + public string Name { get; set; } + public Guid? ParentId { get; set; } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/OrderDto.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/OrderDto.cs index 0bfee44..3dc5e23 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/OrderDto.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/OrderDto.cs @@ -1,26 +1,20 @@ -using KonSoft.Admin.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; +using System; +using KonSoft.Admin.Enums; -namespace KonSoft.Admin.Dtos +namespace KonSoft.Admin.Dtos; + +public class OrderDto { - public class OrderDto - { - public Guid Id { get; set; } - public string OrderSN { get; set; } - public Guid CustomerId { get; set; } - public Guid? WorkerId { get; set; } - public ServiceCategoryDto? ServiceCategory { get; set; } - public DateTime ServiceTime { get; set; } - public OrderStatus Status { get; set; } - public decimal Amount { get; set; } - public decimal PaidAmount { get; set; } - public string PaymentMethod { get; set; } - public AddressDto Address { get; set; } - public string Remark { get; set; } - } -} + public Guid Id { get; set; } + public string OrderSN { get; set; } + public Guid CustomerId { get; set; } + public Guid? WorkerId { get; set; } + public ServiceCategoryDto? ServiceCategory { get; set; } + public DateTime ServiceTime { get; set; } + public OrderStatus Status { get; set; } + public decimal Amount { get; set; } + public decimal PaidAmount { get; set; } + public string PaymentMethod { get; set; } + public AddressDto Address { get; set; } + public string Remark { get; set; } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/PayOrderDto.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/PayOrderDto.cs index d9128bf..d1a4d97 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/PayOrderDto.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/PayOrderDto.cs @@ -1,12 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +namespace KonSoft.Admin.Dtos; -namespace KonSoft.Admin.Dtos +public class PayOrderDto { - public class PayOrderDto - { - } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/ProductDto.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/ProductDto.cs index 43ac051..2a3db90 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/ProductDto.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/ProductDto.cs @@ -1,66 +1,60 @@ - -using System; +using System; using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Linq; -namespace KonSoft.Admin.Dtos +namespace KonSoft.Admin.Dtos; + +public class ProductDto : CreateProductDto { - public class ProductDto: CreateProductDto - { - /// - /// 嵌套子类 - /// - public List Children { get; set; } = new(); - } - - public class CreateProductDto - { - /// - /// 分类名称 - /// - public string Name { get; private set; } - - /// - /// 商品编码 - /// - public string Code { get; private set; } - /// - /// 商品价格 - /// - public decimal Price { get; private set; } - - /// - /// 商品描述 - /// - public string Description { get; private set; } - - /// - /// 分类类型(大类或小类) - /// - public string Type { get; private set; } - - /// - /// 父分类ID - /// - public Guid? ParentId { get; private set; } - - /// - /// 商品状态(在售/下架等) - /// - public string Status { get; private set; } - - /// - /// 排序字段 - /// - public int Order { get; private set; } - } - - public class UpdateProductDto: CreateProductDto - { - public Guid Id { get; set; } - } + /// + /// 嵌套子类 + /// + public List Children { get; set; } = new(); } + +public class CreateProductDto +{ + /// + /// 分类名称 + /// + public string Name { get; private set; } + + /// + /// 商品编码 + /// + public string Code { get; private set; } + + /// + /// 商品价格 + /// + public decimal Price { get; private set; } + + /// + /// 商品描述 + /// + public string Description { get; private set; } + + /// + /// 分类类型(大类或小类) + /// + public string Type { get; private set; } + + /// + /// 父分类ID + /// + public Guid? ParentId { get; private set; } + + /// + /// 商品状态(在售/下架等) + /// + public string Status { get; private set; } + + /// + /// 排序字段 + /// + public int Order { get; private set; } +} + +public class UpdateProductDto : CreateProductDto +{ + public Guid Id { get; set; } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/ServiceCategoryDto.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/ServiceCategoryDto.cs index 27071cc..11c7f77 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/ServiceCategoryDto.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/ServiceCategoryDto.cs @@ -1,17 +1,13 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace KonSoft.Admin.Dtos +namespace KonSoft.Admin.Dtos; + +public class ServiceCategoryDto { - public class ServiceCategoryDto - { - public Guid Id { get; set; } - public string Name { get; set; } - public Guid? ParentId { get; set; } - public int Level { get; set; } - public List Children { get; set; } = new List(); - } -} + public Guid Id { get; set; } + public string Name { get; set; } + public Guid? ParentId { get; set; } + public int Level { get; set; } + public List Children { get; set; } = new(); +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/WorkerDto.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/WorkerDto.cs index befee95..5dfad4b 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/WorkerDto.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/Dtos/WorkerDto.cs @@ -1,17 +1,12 @@ -using KonSoft.Admin.Enums; -using System; +using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Volo.Abp.Application.Dtos; -namespace KonSoft.Admin.Dtos +namespace KonSoft.Admin.Dtos; + +public class WorkerDto : EntityDto { - public class WorkerDto : EntityDto - { - public string Name { get; set; } - public string Phone { get; set; } - public List SkillCategoryIds { get; set; } = new(); // 擅长服务类型 - } -} + public string Name { get; set; } + public string Phone { get; set; } + public List SkillCategoryIds { get; set; } = new(); // 擅长服务类型 +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IOrderAppService.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IOrderAppService.cs index f90cc7c..3750d02 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IOrderAppService.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IOrderAppService.cs @@ -1,28 +1,28 @@ -using KonSoft.Admin.Dtos; -using System; +using System; using System.Threading.Tasks; +using KonSoft.Admin.Dtos; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; -namespace KonSoft.Admin.IApplicationServices +namespace KonSoft.Admin.IApplicationServices; + +public interface IOrderAppService : IApplicationService { - public interface IOrderAppService : IApplicationService - { - /// - /// 创建订单 - /// - /// - /// - Task CreateAsync(CreateOrderDto input); - Task PayAsync(Guid orderId, PayOrderDto input); - Task AssignAsync(Guid orderId, Guid workerId); - Task StartServiceAsync(Guid orderId); - Task CompleteServiceAsync(Guid orderId); - Task ConfirmAsync(Guid orderId); - Task CancelAsync(Guid orderId, string reason); - Task DeleteAsync(params Guid[] ids); - Task EditAsync(OrderDto input); - Task GetAsync(Guid id); - Task> GetListAsync(PagedResultRequestDto input); - } -} + /// + /// 创建订单 + /// + /// + /// + Task CreateAsync(CreateOrderDto input); + + Task PayAsync(Guid orderId, PayOrderDto input); + Task AssignAsync(Guid orderId, Guid workerId); + Task StartServiceAsync(Guid orderId); + Task CompleteServiceAsync(Guid orderId); + Task ConfirmAsync(Guid orderId); + Task CancelAsync(Guid orderId, string reason); + Task DeleteAsync(params Guid[] ids); + Task EditAsync(OrderDto input); + Task GetAsync(Guid id); + Task> GetListAsync(PagedResultRequestDto input); +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IProductAppService.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IProductAppService.cs new file mode 100644 index 0000000..bce6e69 --- /dev/null +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IProductAppService.cs @@ -0,0 +1,16 @@ +using System; +using System.Threading.Tasks; +using KonSoft.Admin.Dtos; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace KonSoft.Admin.IApplicationServices; + +public interface IProductAppService : IApplicationService +{ + Task CreateAsync(CreateProductDto input); + Task UpdateAsync(UpdateProductDto input); + Task DeleteAsync(Guid id); + Task GetAsync(Guid id); + Task> GetListAsync(PagedResultRequestDto input); +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IProductService.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IProductService.cs deleted file mode 100644 index 6f554f2..0000000 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IProductService.cs +++ /dev/null @@ -1,17 +0,0 @@ -using KonSoft.Admin.Dtos; -using System; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; - -namespace KonSoft.Admin.IApplicationServices -{ - public interface IProductService: IApplicationService - { - Task CreateAsync(CreateProductDto input); - Task UpdateAsync(UpdateProductDto input); - Task DeleteAsync(Guid id); - Task GetAsync(Guid id); - Task> GetListAsync(PagedResultRequestDto input); - } -} diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IServiceCategoryAppService.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IServiceCategoryAppService.cs index 5db4a45..530bd1a 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IServiceCategoryAppService.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IServiceCategoryAppService.cs @@ -1,16 +1,13 @@ -using KonSoft.Admin.Dtos; -using System; +using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; +using KonSoft.Admin.Dtos; -namespace KonSoft.Admin.IApplicationServices +namespace KonSoft.Admin.IApplicationServices; + +public interface IServiceCategoryAppService { - public interface IServiceCategoryAppService - { - Task CreateAsync(CreateServiceCategoryDto input); - Task DeleteAsync(Guid id); - Task> GetTreeAsync(); - } -} + Task CreateAsync(CreateServiceCategoryDto input); + Task DeleteAsync(Guid id); + Task> GetTreeAsync(); +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IWorkerAppService.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IWorkerAppService.cs index 0d22702..105a191 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IWorkerAppService.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IWorkerAppService.cs @@ -1,13 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Application.Services; +using Volo.Abp.Application.Services; -namespace KonSoft.Admin.IApplicationServices +namespace KonSoft.Admin.IApplicationServices; + +public interface IWorkerAppService : IApplicationService { - public interface IWorkerAppService : IApplicationService - { - } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IWorkerAssignmentService.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IWorkerAssignmentService.cs index a832d6b..b88c202 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IWorkerAssignmentService.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/IApplicationServices/IWorkerAssignmentService.cs @@ -1,15 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +namespace KonSoft.Admin.IApplicationServices; -namespace KonSoft.Admin.IApplicationServices +public interface IWorkerAssignmentService { - public interface IWorkerAssignmentService - { - - - - } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/Permissions/AdminPermissionDefinitionProvider.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/Permissions/AdminPermissionDefinitionProvider.cs index c11e790..7b22d6d 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/Permissions/AdminPermissionDefinitionProvider.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/Permissions/AdminPermissionDefinitionProvider.cs @@ -17,4 +17,4 @@ public class AdminPermissionDefinitionProvider : PermissionDefinitionProvider { return LocalizableString.Create(name); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application.Contracts/Permissions/AdminPermissions.cs b/modules/admin/src/KonSoft.Admin.Application.Contracts/Permissions/AdminPermissions.cs index 5fe4774..895f2e9 100644 --- a/modules/admin/src/KonSoft.Admin.Application.Contracts/Permissions/AdminPermissions.cs +++ b/modules/admin/src/KonSoft.Admin.Application.Contracts/Permissions/AdminPermissions.cs @@ -6,4 +6,4 @@ public static class AdminPermissions //Add your own permission names. Example: //public const string MyPermission1 = GroupName + ".MyPermission1"; -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application/AdminAppService.cs b/modules/admin/src/KonSoft.Admin.Application/AdminAppService.cs index 58ac913..321536a 100644 --- a/modules/admin/src/KonSoft.Admin.Application/AdminAppService.cs +++ b/modules/admin/src/KonSoft.Admin.Application/AdminAppService.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using KonSoft.Admin.Localization; +using KonSoft.Admin.Localization; using Volo.Abp.Application.Services; namespace KonSoft.Admin; @@ -14,4 +11,4 @@ public abstract class AdminAppService : ApplicationService { LocalizationResource = typeof(AdminResource); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application/AdminApplicationAutoMapperProfile.cs b/modules/admin/src/KonSoft.Admin.Application/AdminApplicationAutoMapperProfile.cs index 1fc6ee0..115d8b3 100644 --- a/modules/admin/src/KonSoft.Admin.Application/AdminApplicationAutoMapperProfile.cs +++ b/modules/admin/src/KonSoft.Admin.Application/AdminApplicationAutoMapperProfile.cs @@ -1,6 +1,7 @@ using AutoMapper; using KonSoft.Admin.Dtos; using KonSoft.Admin.Entities; +using KonSoft.Admin.ValueObjects; namespace KonSoft.Admin; @@ -17,4 +18,4 @@ public class AdminApplicationAutoMapperProfile : Profile CreateMap(); CreateMap(); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application/AdminApplicationModule.cs b/modules/admin/src/KonSoft.Admin.Application/AdminApplicationModule.cs index 4b8589a..af7691e 100644 --- a/modules/admin/src/KonSoft.Admin.Application/AdminApplicationModule.cs +++ b/modules/admin/src/KonSoft.Admin.Application/AdminApplicationModule.cs @@ -18,14 +18,11 @@ namespace KonSoft.Admin; typeof(AbpTenantManagementApplicationModule), typeof(AbpFeatureManagementApplicationModule), typeof(AbpSettingManagementApplicationModule) - )] +)] public class AdminApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => - { - options.AddMaps(); - }); + Configure(options => { options.AddMaps(); }); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/OrderAppService.cs b/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/OrderAppService.cs index 1134803..7768805 100644 --- a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/OrderAppService.cs +++ b/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/OrderAppService.cs @@ -1,165 +1,167 @@ -using KonSoft.Admin.Dtos; -using KonSoft.Admin.Entities; -using KonSoft.Admin.IApplicationServices; -using KonSoft.Admin.Repositories; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using KonSoft.Admin.Dtos; +using KonSoft.Admin.Entities; +using KonSoft.Admin.IApplicationServices; +using KonSoft.Admin.IRepositories; +using KonSoft.Admin.ValueObjects; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; -namespace KonSoft.Admin.ApplicationServices +namespace KonSoft.Admin.ApplicationServices; + +public class OrderAppService(IOrderRepository orderRepository) : ApplicationService, IOrderAppService { - public class OrderAppService(IOrderRepository orderRepository) : ApplicationService, IOrderAppService + private readonly IOrderRepository _orderRepository = orderRepository; + + /// + /// 分配师傅 + /// + /// + /// + /// + /// + public async Task AssignAsync(Guid orderId, Guid workerId) { - private readonly IOrderRepository _orderRepository = orderRepository; + var order = await _orderRepository.GetAsync(o => o.Id == orderId); + order.AssignWorker(workerId); + } - /// - /// 分配师傅 - /// - /// - /// - /// - /// - public async Task AssignAsync(Guid orderId, Guid workerId) - { - var order = await _orderRepository.GetAsync(o => o.Id == orderId); - order.AssignWorker(workerId); - } + /// + /// 取消订单 + /// + /// + /// + /// + /// + public async Task CancelAsync(Guid orderId, string reason) + { + var order = await _orderRepository.GetAsync(o => o.Id == orderId); + order.Cancel(reason); + } - /// - /// 取消订单 - /// - /// - /// - /// - /// - public async Task CancelAsync(Guid orderId, string reason) - { - var order = await _orderRepository.GetAsync(o => o.Id == orderId); - order.Cancel(reason); - } + /// + /// 完成订单 + /// + /// + /// + /// + public async Task CompleteServiceAsync(Guid orderId) + { + var order = await _orderRepository.GetAsync(o => o.Id == orderId); + order.CompleteService(); + } - /// - /// 完成订单 - /// - /// - /// - /// - public async Task CompleteServiceAsync(Guid orderId) - { - var order = await _orderRepository.GetAsync(o => o.Id == orderId); - order.CompleteService(); - } + /// + /// 确认订单 + /// + /// + /// + /// + public async Task ConfirmAsync(Guid orderId) + { + var order = await _orderRepository.GetAsync(o => o.Id == orderId); + order.ConfirmCompletion(); + } - /// - /// 确认订单 - /// - /// - /// - /// - public async Task ConfirmAsync(Guid orderId) - { - var order = await _orderRepository.GetAsync(o => o.Id == orderId); - order.ConfirmCompletion(); - } + /// + /// 创建订单 + /// + /// + /// + /// + public async Task CreateAsync(CreateOrderDto input) + { + // 生成订单号 TODO + var orderSN = "SN001"; + var address = ObjectMapper.Map(input.Address); + var order = new Order(input.CustomerId, input.ServiceCategoryId, input.ServiceTime, + input.Amount, address, input.Remark); - /// - /// 创建订单 - /// - /// - /// - /// - public async Task CreateAsync(CreateOrderDto input) - { - // 生成订单号 TODO - var orderSN = "SN001"; - var address = ObjectMapper.Map(input.Address); - var order = new Order(Guid.NewGuid(), orderSN, input.CustomerId, input.ServiceCategoryId, input.ServiceTime, input.Amount, address, input.Remark); + await _orderRepository.InsertAsync(order); + return ObjectMapper.Map(order); + } - await _orderRepository.InsertAsync(order); - return ObjectMapper.Map(order); - } + /// + /// 根据订单ID删除订单 + /// + /// 订单ID + public async Task DeleteAsync(params Guid[] ids) + { + // 根据ID删除订单 + await _orderRepository.DeleteAsync(x => ids.Contains(x.Id)); + } - /// - /// 根据订单ID删除订单 - /// - /// 订单ID - public async Task DeleteAsync(params Guid[] ids) - { - // 根据ID删除订单 - await _orderRepository.DeleteAsync(x => ids.Contains(x.Id)); - } + /// + /// 修改订单信息 + /// + /// 订单DTO对象 + /// s + public async Task EditAsync(OrderDto input) + { + // 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】 + var order = await _orderRepository.FindAsync(o => o.Id == input.Id) ?? + throw new BusinessException("订单找不到").WithData("Id", input.Id); - /// - /// 修改订单信息 - /// - /// 订单DTO对象s - public async Task EditAsync(OrderDto input) - { - // 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】 - var order = await _orderRepository.FindAsync(o => o.Id == input.Id) ?? - throw new BusinessException("订单找不到").WithData("Id", input.Id); + // 将输入的DTO字段映射到订单实体 + ObjectMapper.Map(input, order); - // 将输入的DTO字段映射到订单实体 - ObjectMapper.Map(input, order); + // 更新订单 + await _orderRepository.UpdateAsync(order); + } - // 更新订单 - await _orderRepository.UpdateAsync(order); - } + /// + /// 支付 + /// + /// + /// + /// + /// + public Task PayAsync(Guid orderId, PayOrderDto input) + { + throw new NotImplementedException(); + } - /// - /// 支付 - /// - /// - /// - /// - /// - public Task PayAsync(Guid orderId, PayOrderDto input) - { - throw new NotImplementedException(); - } + /// + /// 开始订单 + /// + /// + /// + /// + public async Task StartServiceAsync(Guid orderId) + { + var order = await _orderRepository.GetAsync(o => o.Id == orderId); + order.StartService(); + } - /// - /// 开始订单 - /// - /// - /// - /// - public async Task StartServiceAsync(Guid orderId) - { - var order = await _orderRepository.GetAsync(o => o.Id == orderId); - order.StartService(); - } + /// + /// 根据订单ID获取单个订单 + /// + public async Task GetAsync(Guid id) + { + // 根据ID从数据库查询订单 + var order = await _orderRepository.GetAsync(o => o.Id == id); - /// - /// 根据订单ID获取单个订单 - /// - public async Task GetAsync(Guid id) - { - // 根据ID从数据库查询订单 - var order = await _orderRepository.GetAsync(o => o.Id == id); + // 转换为OrderDto返回 + return ObjectMapper.Map(order); + } - // 转换为OrderDto返回 - return ObjectMapper.Map(order); - } + /// + /// 获取所有订单列表 + /// + public async Task> GetListAsync(PagedResultRequestDto input) + { + // 查询所有订单 + var orders = await _orderRepository.GetPagedListAsync(input.SkipCount, input.MaxResultCount, "Id"); - /// - /// 获取所有订单列表 - /// - public async Task> GetListAsync(PagedResultRequestDto input) - { - // 查询所有订单 - var orders = await _orderRepository.GetPagedListAsync(input.SkipCount, input.MaxResultCount, "Id"); + var totalCount = await _orderRepository.CountAsync(); - var totalCount = await _orderRepository.CountAsync(); + var orderDtos = ObjectMapper.Map, List>(orders); - var orderDtos = ObjectMapper.Map, List>(orders); - - return new PagedResultDto(totalCount, orderDtos); - } + return new PagedResultDto(totalCount, orderDtos); } } \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/ProductAppAppService.cs b/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/ProductAppAppService.cs new file mode 100644 index 0000000..27f7a23 --- /dev/null +++ b/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/ProductAppAppService.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using KonSoft.Admin.Dtos; +using KonSoft.Admin.Entities; +using KonSoft.Admin.IApplicationServices; +using KonSoft.Admin.IRepositories; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; + +namespace KonSoft.Admin.ApplicationServices; + +public class ProductAppAppService(IProductRepository repository) : ApplicationService, IProductAppService +{ + private readonly IProductRepository repository = repository; + + /// + /// 创建产品 + /// + public async Task CreateAsync(CreateProductDto input) + { + var id = Guid.NewGuid(); + var product = new Product(id, input.Name, input.Code, input.Price, input.Description, input.Type, + input.ParentId, input.Status, input.Order); + await repository.InsertAsync(product); + } + + /// + /// 删除 + /// + public async Task DeleteAsync(Guid id) + { + await repository.DeleteAsync(x => x.Id == id); + } + + /// + /// 查询 + /// + public async Task GetAsync(Guid id) + { + var product = await repository.GetAsync(x => x.Id == id); + return ObjectMapper.Map(product); + } + + /// + /// 查询集合 + /// + /// + /// + public async Task> GetListAsync(PagedResultRequestDto input) + { + var query = await repository.GetPageRootListAsync(input.SkipCount, input.MaxResultCount, + x => x.ParentId == null); + var all = await repository.GetListAsync(x => x.ParentId != null); + foreach (var item in query) + { + BuildChildren(item, all); + } + + var totalCount = await repository.CountAsync(x => x.ParentId == null); + + var productDtos = ObjectMapper.Map, List>(query); + + return new PagedResultDto(totalCount, productDtos); + } + + /// + /// 修改 + /// + /// + /// + public async Task UpdateAsync(UpdateProductDto input) + { + // 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】 + var order = await repository.FindAsync(o => o.Id == input.Id) ?? + throw new BusinessException("商品找不到").WithData("Id", input.Id); + + // 将输入的DTO字段映射到订单实体 + ObjectMapper.Map(input, order); + + // 更新订单 + await repository.UpdateAsync(order); + } + + private static void BuildChildren(Product parent, List all) + { + var children = all + .Where(x => x.ParentId == parent.Id) + .OrderBy(x => x.Order) + .ToList(); + + parent.Children = children; + + foreach (var child in children) + { + BuildChildren(child, all); // 递归 + } + } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/ProductAppService.cs b/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/ProductAppService.cs deleted file mode 100644 index f0e08e3..0000000 --- a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/ProductAppService.cs +++ /dev/null @@ -1,100 +0,0 @@ -using KonSoft.Admin.Dtos; -using KonSoft.Admin.Entities; -using KonSoft.Admin.IApplicationServices; -using KonSoft.Admin.Repositories; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Volo.Abp; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Volo.Abp.Domain.Repositories; - -namespace KonSoft.Admin.ApplicationServices -{ - public class ProductAppService(IProductRepository repository) : ApplicationService, IProductService - { - private readonly IProductRepository repository = repository; - - /// - /// 创建产品 - /// - public async Task CreateAsync(CreateProductDto input) - { - var id = Guid.NewGuid(); - var product = new Product(id, input.Name, input.Code, input.Price, input.Description, input.Type, input.ParentId, input.Status, input.Order); - await repository.InsertAsync(product); - } - - /// - /// 删除 - /// - public async Task DeleteAsync(Guid id) - { - await repository.DeleteAsync(x => x.Id == id); - } - - /// - /// 查询 - /// - public async Task GetAsync(Guid id) - { - var product = await repository.GetAsync(x => x.Id == id); - return ObjectMapper.Map(product); - } - - /// - /// 查询集合 - /// - /// - /// - public async Task> GetListAsync(PagedResultRequestDto input) - { - var query = await repository.GetPageRootListAsync(input.SkipCount, input.MaxResultCount, x => x.ParentId == null); - var all = await repository.GetListAsync(x => x.ParentId != null); - foreach (var item in query) - { - BuildChildren(item, all); - } - var totalCount = await repository.CountAsync(x => x.ParentId == null); - - var productDtos = ObjectMapper.Map, List>(query); - - return new PagedResultDto(totalCount, productDtos); - } - - private static void BuildChildren(Product parent, List all) - { - var children = all - .Where(x => x.ParentId == parent.Id) - .OrderBy(x => x.Order) - .ToList(); - - parent.Children = children; - - foreach (var child in children) - { - BuildChildren(child, all); // 递归 - } - } - - /// - /// 修改 - /// - /// - /// - public async Task UpdateAsync(UpdateProductDto input) - { - // 根据ID查询订单,如果不存在则抛出异常【修改前端必然看到了,数据若查不到提示自定义异常信息】 - var order = await repository.FindAsync(o => o.Id == input.Id) ?? - throw new BusinessException("商品找不到").WithData("Id", input.Id); - - // 将输入的DTO字段映射到订单实体 - ObjectMapper.Map(input, order); - - // 更新订单 - await repository.UpdateAsync(order); - } - } -} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/ServiceCategoryAppService.cs b/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/ServiceCategoryAppService.cs index e3b5fa0..990cd4c 100644 --- a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/ServiceCategoryAppService.cs +++ b/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/ServiceCategoryAppService.cs @@ -1,75 +1,77 @@ -using KonSoft.Admin.Dtos; -using KonSoft.Admin.Entities; -using KonSoft.Admin.IApplicationServices; -using System; +using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; +using KonSoft.Admin.Dtos; +using KonSoft.Admin.Entities; +using KonSoft.Admin.IApplicationServices; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; -namespace KonSoft.Admin.ApplicationServices +namespace KonSoft.Admin.ApplicationServices; + +public class ServiceCategoryAppService : ApplicationService, IServiceCategoryAppService { - public class ServiceCategoryAppService : ApplicationService, IServiceCategoryAppService + private readonly IRepository _repository; + + + public ServiceCategoryAppService(IRepository repository) { - private readonly IRepository _repository; - - - public ServiceCategoryAppService(IRepository repository) - { - _repository = repository; - } - - public async Task CreateAsync(CreateServiceCategoryDto input) - { - ServiceCategory parent = null; - if (input.ParentId.HasValue) - { - parent = await _repository.GetAsync(input.ParentId.Value); - } - - var category = new ServiceCategory(Guid.NewGuid(), input.Name); - category.SetParent(parent); - - - await _repository.InsertAsync(category); - - - return ObjectMapper.Map(category); - } - - public async Task DeleteAsync(Guid id) - { - var hasChildren = await _repository.AnyAsync(c => c.ParentId == id); - if (hasChildren) throw new InvalidOperationException("存在子节点无法删除!"); - - - await _repository.DeleteAsync(o => o.Id == id); - } - - public async Task> GetTreeAsync() - { - var allCategories = await _repository.GetListAsync(); - - // 构建树 - var lookup = allCategories.ToDictionary(c => c.Id, c => ObjectMapper.Map(c)); - var rootList = new List(); - - - foreach (var dto in lookup.Values) - { - if (dto.ParentId.HasValue && lookup.ContainsKey(dto.ParentId.Value)) - { - lookup[dto.ParentId.Value].Children.Add(dto); - } - else - { - rootList.Add(dto); - } - } - - return rootList.OrderBy(c => c.Name).ToList(); - } + _repository = repository; } -} + + public async Task CreateAsync(CreateServiceCategoryDto input) + { + ServiceCategory parent = null; + if (input.ParentId.HasValue) + { + parent = await _repository.GetAsync(input.ParentId.Value); + } + + var category = new ServiceCategory(Guid.NewGuid(), input.Name); + category.SetParent(parent); + + + await _repository.InsertAsync(category); + + + return ObjectMapper.Map(category); + } + + public async Task DeleteAsync(Guid id) + { + var hasChildren = await _repository.AnyAsync(c => c.ParentId == id); + if (hasChildren) + { + throw new InvalidOperationException("存在子节点无法删除!"); + } + + + await _repository.DeleteAsync(o => o.Id == id); + } + + public async Task> GetTreeAsync() + { + var allCategories = await _repository.GetListAsync(); + + // 构建树 + var lookup = + allCategories.ToDictionary(c => c.Id, c => ObjectMapper.Map(c)); + var rootList = new List(); + + + foreach (var dto in lookup.Values) + { + if (dto.ParentId.HasValue && lookup.ContainsKey(dto.ParentId.Value)) + { + lookup[dto.ParentId.Value].Children.Add(dto); + } + else + { + rootList.Add(dto); + } + } + + return rootList.OrderBy(c => c.Name).ToList(); + } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/WorkerAppService.cs b/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/WorkerAppService.cs deleted file mode 100644 index 5ca999c..0000000 --- a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/WorkerAppService.cs +++ /dev/null @@ -1,20 +0,0 @@ -using KonSoft.Admin.Dtos; -using KonSoft.Admin.Entities; -using KonSoft.Admin.IApplicationServices; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Application.Services; -using Volo.Abp.Domain.Repositories; - -namespace KonSoft.Admin.ApplicationServices -{ - public class WorkerAppService : CrudAppService, IWorkerAppService - { - public WorkerAppService(IRepository repository) : base(repository) - { - } - } -} diff --git a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/WorkerAssignmentService.cs b/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/WorkerAssignmentService.cs deleted file mode 100644 index 28283c8..0000000 --- a/modules/admin/src/KonSoft.Admin.Application/ApplicationServices/WorkerAssignmentService.cs +++ /dev/null @@ -1,27 +0,0 @@ -using KonSoft.Admin.Entities; -using KonSoft.Admin.IApplicationServices; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Application.Services; -using Volo.Abp.Domain.Repositories; - -namespace KonSoft.Admin.ApplicationServices -{ - /// - /// 分配家政人员 TODO - /// - public class WorkerAssignmentService : ApplicationService, IWorkerAssignmentService - { - private readonly IRepository _workerRepository; - private readonly IRepository _orderRepository; - - public WorkerAssignmentService(IRepository workerRepository, IRepository orderRepository) - { - _workerRepository = workerRepository; - _orderRepository = orderRepository; - } - } -} diff --git a/modules/admin/src/KonSoft.Admin.Application/Properties/AssemblyInfo.cs b/modules/admin/src/KonSoft.Admin.Application/Properties/AssemblyInfo.cs index 12c97cf..9755293 100644 --- a/modules/admin/src/KonSoft.Admin.Application/Properties/AssemblyInfo.cs +++ b/modules/admin/src/KonSoft.Admin.Application/Properties/AssemblyInfo.cs @@ -1,2 +1,3 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.Admin.Application.Tests")] + +[assembly: InternalsVisibleToAttribute("KonSoft.Admin.Application.Tests")] \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminDomainErrorCodes.cs b/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminDomainErrorCodes.cs index 78050c5..b057d1a 100644 --- a/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminDomainErrorCodes.cs +++ b/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminDomainErrorCodes.cs @@ -3,4 +3,4 @@ public static class AdminDomainErrorCodes { /* You can add your business exception error codes here, as constants */ -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminDomainSharedModule.cs b/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminDomainSharedModule.cs index e998a5d..63ffc7f 100644 --- a/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminDomainSharedModule.cs +++ b/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminDomainSharedModule.cs @@ -23,8 +23,8 @@ namespace KonSoft.Admin; typeof(AbpOpenIddictDomainSharedModule), typeof(AbpPermissionManagementDomainSharedModule), typeof(AbpSettingManagementDomainSharedModule), - typeof(AbpTenantManagementDomainSharedModule) - )] + typeof(AbpTenantManagementDomainSharedModule) +)] public class AdminDomainSharedModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -35,10 +35,7 @@ public class AdminDomainSharedModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => - { - options.FileSets.AddEmbedded(); - }); + Configure(options => { options.FileSets.AddEmbedded(); }); Configure(options => { @@ -55,4 +52,4 @@ public class AdminDomainSharedModule : AbpModule options.MapCodeNamespace("Admin", typeof(AdminResource)); }); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminGlobalFeatureConfigurator.cs b/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminGlobalFeatureConfigurator.cs index 4ca98e9..8fb344c 100644 --- a/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminGlobalFeatureConfigurator.cs +++ b/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminGlobalFeatureConfigurator.cs @@ -4,19 +4,19 @@ namespace KonSoft.Admin; public static class AdminGlobalFeatureConfigurator { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { OneTimeRunner.Run(() => { - /* You can configure (enable/disable) global features of the used modules here. - * - * YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! - * - * Please refer to the documentation to lear more about the Global Features System: - * https://docs.abp.io/en/abp/latest/Global-Features - */ + /* You can configure (enable/disable) global features of the used modules here. + * + * YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! + * + * Please refer to the documentation to lear more about the Global Features System: + * https://docs.abp.io/en/abp/latest/Global-Features + */ }); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminModuleExtensionConfigurator.cs b/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminModuleExtensionConfigurator.cs index 5e99900..87da9dd 100644 --- a/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminModuleExtensionConfigurator.cs +++ b/modules/admin/src/KonSoft.Admin.Domain.Shared/AdminModuleExtensionConfigurator.cs @@ -1,13 +1,10 @@ -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Identity; -using Volo.Abp.ObjectExtending; -using Volo.Abp.Threading; +using Volo.Abp.Threading; namespace KonSoft.Admin; public static class AdminModuleExtensionConfigurator { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { @@ -57,7 +54,7 @@ public static class AdminModuleExtensionConfigurator //validation rules property.Attributes.Add(new RequiredAttribute()); property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4}); - + property.Configuration[IdentityModuleExtensionConsts.ConfigurationNames.AllowUserToEdit] = true; //...other configurations for this property @@ -70,4 +67,4 @@ public static class AdminModuleExtensionConfigurator * https://docs.abp.io/en/abp/latest/Module-Entity-Extensions */ } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain.Shared/Enums/OrderStatus.cs b/modules/admin/src/KonSoft.Admin.Domain.Shared/Enums/OrderStatus.cs index 9689b7b..e6c8335 100644 --- a/modules/admin/src/KonSoft.Admin.Domain.Shared/Enums/OrderStatus.cs +++ b/modules/admin/src/KonSoft.Admin.Domain.Shared/Enums/OrderStatus.cs @@ -1,22 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +namespace KonSoft.Admin.Enums; -namespace KonSoft.Admin.Enums +public enum OrderStatus { - public enum OrderStatus - { - PendingPayment, // 待支付 - PaidWaitingAssign, // 已支付待派单 - AssignedWaitingService, // 已派单待服务 - InService, // 服务中 - WaitingConfirm, // 待用户确认 - Completed, // 已完成 - Canceled, // 已取消 - Refunding, // 退款中 - Refunded // 已退款 - - } -} + PendingPayment, // 待支付 + PaidWaitingAssign, // 已支付待派单 + AssignedWaitingService, // 已派单待服务 + InService, // 服务中 + WaitingConfirm, // 待用户确认 + Completed, // 已完成 + Canceled, // 已取消 + Refunding, // 退款中 + Refunded // 已退款 +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain.Shared/Localization/AdminResource.cs b/modules/admin/src/KonSoft.Admin.Domain.Shared/Localization/AdminResource.cs index 71f6d84..10b65ee 100644 --- a/modules/admin/src/KonSoft.Admin.Domain.Shared/Localization/AdminResource.cs +++ b/modules/admin/src/KonSoft.Admin.Domain.Shared/Localization/AdminResource.cs @@ -5,5 +5,4 @@ namespace KonSoft.Admin.Localization; [LocalizationResourceName("Admin")] public class AdminResource { - -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/AdminConsts.cs b/modules/admin/src/KonSoft.Admin.Domain/AdminConsts.cs index 976eacc..336faa4 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/AdminConsts.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/AdminConsts.cs @@ -3,6 +3,6 @@ public static class AdminConsts { public const string DbTablePrefix = "App"; - - public const string DbSchema = null; -} + public const string DbSchema = ""; + public const string ConnectionStringName = "Default"; +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/AdminDomainModule.cs b/modules/admin/src/KonSoft.Admin.Domain/AdminDomainModule.cs index c410645..74948b6 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/AdminDomainModule.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/AdminDomainModule.cs @@ -7,7 +7,6 @@ using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.Localization; using Volo.Abp.Modularity; -using Volo.Abp.MultiTenancy; using Volo.Abp.OpenIddict; using Volo.Abp.PermissionManagement.Identity; using Volo.Abp.PermissionManagement.OpenIddict; @@ -60,4 +59,4 @@ public class AdminDomainModule : AbpModule context.Services.Replace(ServiceDescriptor.Singleton()); #endif } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/Data/AdminDbMigrationService.cs b/modules/admin/src/KonSoft.Admin.Domain/Data/AdminDbMigrationService.cs index 4b5626c..2828ccc 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/Data/AdminDbMigrationService.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/Data/AdminDbMigrationService.cs @@ -17,12 +17,11 @@ namespace KonSoft.Admin.Data; public class AdminDbMigrationService : ITransientDependency { - public ILogger Logger { get; set; } + private readonly ICurrentTenant _currentTenant; private readonly IDataSeeder _dataSeeder; private readonly IEnumerable _dbSchemaMigrators; private readonly ITenantRepository _tenantRepository; - private readonly ICurrentTenant _currentTenant; public AdminDbMigrationService( IDataSeeder dataSeeder, @@ -38,6 +37,8 @@ public class AdminDbMigrationService : ITransientDependency Logger = NullLogger.Instance; } + public ILogger Logger { get; set; } + public async Task MigrateAsync() { var initialMigrationAdded = AddInitialMigrationIfNotExist(); @@ -52,7 +53,7 @@ public class AdminDbMigrationService : ITransientDependency await MigrateDatabaseSchemaAsync(); await SeedDataAsync(); - Logger.LogInformation($"Successfully completed host database migrations."); + Logger.LogInformation("Successfully completed host database migrations."); var tenants = await _tenantRepository.GetListAsync(includeDetails: true); @@ -101,8 +102,10 @@ public class AdminDbMigrationService : ITransientDependency Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed..."); await _dataSeeder.SeedAsync(new DataSeedContext(tenant?.Id) - .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, IdentityDataSeedContributor.AdminEmailDefaultValue) - .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, IdentityDataSeedContributor.AdminPasswordDefaultValue) + .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, + IdentityDataSeedContributor.AdminEmailDefaultValue) + .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, + IdentityDataSeedContributor.AdminPasswordDefaultValue) ); } @@ -127,10 +130,8 @@ public class AdminDbMigrationService : ITransientDependency AddInitialMigration(); return true; } - else - { - return false; - } + + return false; } catch (Exception e) { @@ -149,7 +150,8 @@ public class AdminDbMigrationService : ITransientDependency private bool MigrationsFolderExists() { var dbMigrationsProjectFolder = GetEntityFrameworkCoreProjectFolderPath(); - return dbMigrationsProjectFolder != null && Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations")); + return dbMigrationsProjectFolder != null && + Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations")); } private void AddInitialMigration() @@ -207,7 +209,8 @@ public class AdminDbMigrationService : ITransientDependency { currentDirectory = Directory.GetParent(currentDirectory.FullName); - if (currentDirectory != null && Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) + if (currentDirectory != null && + Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) { return currentDirectory.FullName; } @@ -215,4 +218,4 @@ public class AdminDbMigrationService : ITransientDependency return null; } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/Data/IAdminDbSchemaMigrator.cs b/modules/admin/src/KonSoft.Admin.Domain/Data/IAdminDbSchemaMigrator.cs index d182021..6989d53 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/Data/IAdminDbSchemaMigrator.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/Data/IAdminDbSchemaMigrator.cs @@ -5,4 +5,4 @@ namespace KonSoft.Admin.Data; public interface IAdminDbSchemaMigrator { Task MigrateAsync(); -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/Data/NullAdminDbSchemaMigrator.cs b/modules/admin/src/KonSoft.Admin.Domain/Data/NullAdminDbSchemaMigrator.cs index 0d1c758..0d9c225 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/Data/NullAdminDbSchemaMigrator.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/Data/NullAdminDbSchemaMigrator.cs @@ -12,4 +12,4 @@ public class NullAdminDbSchemaMigrator : IAdminDbSchemaMigrator, ITransientDepen { return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/Entities/AddressInfo.cs b/modules/admin/src/KonSoft.Admin.Domain/Entities/AddressInfo.cs deleted file mode 100644 index 7c418d4..0000000 --- a/modules/admin/src/KonSoft.Admin.Domain/Entities/AddressInfo.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Domain.Entities; -using Volo.Abp.Domain.Values; - -namespace KonSoft.Admin.Entities -{ - /// - /// 地址 - /// - public class AddressInfo : ValueObject - { - /// - /// 联系人 - /// - public string ContactName { get; private set; } - /// - /// 手机号 - /// - public string ContactPhone { get; private set; } - /// - /// 详细地址 - /// - public string DetailAddress { get; private set; } - /// - /// 城市 - /// - public string City { get; private set; } - /// - /// 区域 - /// - public string District { get; private set; } - - - public AddressInfo() { } - - public AddressInfo(string contactName, string contactPhone, string detailAddress, string city, string district) - { - ContactName = contactName; - ContactPhone = contactPhone; - DetailAddress = detailAddress; - City = city; - District = district; - } - - - protected override IEnumerable GetAtomicValues() - { - yield return ContactName; - yield return ContactPhone; - yield return DetailAddress; - yield return City; - yield return District; - } - - } -} diff --git a/modules/admin/src/KonSoft.Admin.Domain/Entities/HouseholdWorker.cs b/modules/admin/src/KonSoft.Admin.Domain/Entities/HouseholdWorker.cs new file mode 100644 index 0000000..1d608cd --- /dev/null +++ b/modules/admin/src/KonSoft.Admin.Domain/Entities/HouseholdWorker.cs @@ -0,0 +1,24 @@ +using Volo.Abp.Identity; + +namespace KonSoft.Admin.Entities; + +/// +/// 家政服务工人实体 +/// +public class HouseholdWorker : IdentityUser +{ + /// + /// 接单数 + /// + public int OrderCount { get; set; } + + /// + /// 职业 + /// + public required string Profession { get; set; } + + /// + /// 能力范围 + /// + public required string ScopeOfCompetence { get; set; } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/Entities/Order.cs b/modules/admin/src/KonSoft.Admin.Domain/Entities/Order.cs index d0d272f..1bcb9cb 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/Entities/Order.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/Entities/Order.cs @@ -1,157 +1,158 @@ -using KonSoft.Admin.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System; +using KonSoft.Admin.Enums; +using KonSoft.Admin.ValueObjects; using Volo.Abp.Domain.Entities.Auditing; -using Volo.Abp.Identity; -namespace KonSoft.Admin.Entities +namespace KonSoft.Admin.Entities; + +public class Order : FullAuditedAggregateRoot { - public class Order : FullAuditedAggregateRoot + private Order() { - /// - /// 订单编号 - /// - public string OrderSN { get; private set; } - - /// - /// 用户ID - /// - public Guid CustomerId { get; private set; } - /// - /// 家政人员ID - /// - public Guid? WorkerId { get; private set; } - - ///// - ///// 用户ID - ///// - //public virtual IdentityUser Customer { get; private set; } - ///// - ///// 家政人员ID - ///// - //public virtual IdentityUser? Worker { get; private set; } - /// - /// 服务项目ID - /// - public Guid ServiceCategoryId { get; private set; } - - public virtual ServiceCategory ServiceCategory { get; private set; } - - /// - /// 服务预约时间 - /// - public DateTime ServiceTime { get; private set; } - - public OrderStatus Status { get; private set; } - - /// - /// 应付金额 - /// - public decimal Amount { get; private set; } - /// - /// 实付金额 - /// - public decimal PaidAmount { get; private set; } - /// - /// 支付方式 - /// - public string PaymentMethod { get; private set; } - /// - /// 地址 - /// - public AddressInfo Address { get; private set; } - - /// - /// 备注 - /// - public string? Remark { get; private set; } - /// - /// 取消原因 - /// - public string? CancelReason { get; private set; } - - protected Order() { } - - - public Order(Guid id, string orderSN, Guid customerId, Guid serviceCategoryId, DateTime serviceTime, decimal amount, AddressInfo address, string remark = null) - : base(id) - { - OrderSN = orderSN; - CustomerId = customerId; - ServiceCategoryId = serviceCategoryId; - ServiceTime = serviceTime; - Amount = amount; - Address = address; - Remark = remark; - Status = OrderStatus.PendingPayment; - } - - - public void MarkPaid(decimal paidAmount, string method) - { - if (Status != OrderStatus.PendingPayment) - throw new InvalidOperationException("订单不在待付款状态"); - - - PaidAmount = paidAmount; - PaymentMethod = method; - Status = OrderStatus.PaidWaitingAssign; - } - - - public void AssignWorker(Guid workerId) - { - if (Status != OrderStatus.PaidWaitingAssign) - throw new InvalidOperationException("订单无法分配师傅"); - - - WorkerId = workerId; - Status = OrderStatus.AssignedWaitingService; - } - - - public void StartService() - { - if (Status != OrderStatus.AssignedWaitingService) - throw new InvalidOperationException("订单无法开始"); - - - Status = OrderStatus.InService; - } - - - public void CompleteService() - { - if (Status != OrderStatus.InService) - throw new InvalidOperationException("订单未开始服务,无法完成"); - - - Status = OrderStatus.WaitingConfirm; - } - - - public void ConfirmCompletion() - { - if (Status != OrderStatus.WaitingConfirm) - throw new InvalidOperationException("订单无法确认"); - - - Status = OrderStatus.Completed; - } - - - public void Cancel(string reason) - { - // 若已完成或退款中则不可取消 - if (Status == OrderStatus.Completed || Status == OrderStatus.Refunding || Status == OrderStatus.Refunded) - throw new InvalidOperationException("订单无法被取消"); - - - CancelReason = reason; - Status = OrderStatus.Canceled; - } } -} + + + public Order(Guid customerId, Guid serviceCategoryId, DateTime serviceTime, decimal amount, + AddressInfo address, string? remark = null) + { + CustomerId = customerId; + ServiceCategoryId = serviceCategoryId; + ServiceTime = serviceTime; + Amount = amount; + Address = address; + Remark = remark; + Status = OrderStatus.PendingPayment; + } + + /// + /// 用户ID + /// + public Guid CustomerId { get; private set; } + + /// + /// 家政人员ID + /// + public Guid? WorkerId { get; private set; } + + /// + /// 服务项目ID + /// + public Guid ServiceCategoryId { get; private set; } + + /// + /// 服务预约时间 + /// + public DateTime ServiceTime { get; private set; } + + /// + /// 订单状态 + /// + public OrderStatus Status { get; private set; } + + /// + /// 应付金额 + /// + public decimal Amount { get; private set; } + + /// + /// 实付金额 + /// + public decimal PaidAmount { get; private set; } + + /// + /// 支付方式 + /// + public string PaymentMethod { get; private set; } + + /// + /// 地址 + /// + public AddressInfo Address { get; private set; } + + /// + /// 备注 + /// + public string? Remark { get; private set; } + + /// + /// 取消原因 + /// + public string? CancelReason { get; private set; } + + + public void MarkPaid(decimal paidAmount, string method) + { + if (Status != OrderStatus.PendingPayment) + { + throw new InvalidOperationException("订单不在待付款状态"); + } + + + PaidAmount = paidAmount; + PaymentMethod = method; + Status = OrderStatus.PaidWaitingAssign; + } + + + public void AssignWorker(Guid workerId) + { + if (Status != OrderStatus.PaidWaitingAssign) + { + throw new InvalidOperationException("订单无法分配师傅"); + } + + + WorkerId = workerId; + Status = OrderStatus.AssignedWaitingService; + } + + + public void StartService() + { + if (Status != OrderStatus.AssignedWaitingService) + { + throw new InvalidOperationException("订单无法开始"); + } + + + Status = OrderStatus.InService; + } + + + public void CompleteService() + { + if (Status != OrderStatus.InService) + { + throw new InvalidOperationException("订单未开始服务,无法完成"); + } + + + Status = OrderStatus.WaitingConfirm; + } + + + public void ConfirmCompletion() + { + if (Status != OrderStatus.WaitingConfirm) + { + throw new InvalidOperationException("订单无法确认"); + } + + + Status = OrderStatus.Completed; + } + + + public void Cancel(string reason) + { + // 若已完成或退款中则不可取消 + if (Status == OrderStatus.Completed || Status == OrderStatus.Refunding || Status == OrderStatus.Refunded) + { + throw new InvalidOperationException("订单无法被取消"); + } + + + CancelReason = reason; + Status = OrderStatus.Canceled; + } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/Entities/Product.cs b/modules/admin/src/KonSoft.Admin.Domain/Entities/Product.cs index 580460f..404f9f1 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/Entities/Product.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/Entities/Product.cs @@ -1,99 +1,105 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; using Volo.Abp.Domain.Entities.Auditing; -namespace KonSoft.Admin.Entities +namespace KonSoft.Admin.Entities; + +public class Product( + Guid id, + string name, + string code, + decimal price, + string description, + string type, + Guid? parentId, + string status = "在售", + int order = 0) : FullAuditedAggregateRoot(id) { - public class Product(Guid id, string name, string code, decimal price, string description, string type, Guid? parentId, string status = "在售", int order = 0) : FullAuditedAggregateRoot(id) + /// + /// 分类名称 + /// + public string Name { get; private set; } = name; + + /// + /// 商品编码 + /// + public string Code { get; private set; } = code; + + /// + /// 商品价格 + /// + public decimal Price { get; private set; } = price; + + /// + /// 商品描述 + /// + public string Description { get; private set; } = description; + + /// + /// 分类类型(大类或小类) + /// + public string Type { get; private set; } = type; + + /// + /// 父分类ID + /// + public Guid? ParentId { get; private set; } = parentId; + + /// + /// 商品状态(在售/下架等) + /// + public string Status { get; private set; } = status; + + /// + /// 排序字段 + /// + public int Order { get; private set; } = order; + + [NotMapped] public List Children { get; set; } = new(); + + /// + /// 修改商品信息 + /// + public void Update(string name, string code, decimal price, string description, int order) { - /// - /// 分类名称 - /// - public string Name { get; private set; } = name; + Name = name; + Code = code; + Price = price; + Description = description; + Order = order; + } - /// - /// 商品编码 - /// - public string Code { get; private set; } = code; + /// + /// 修改商品分类 + /// + public void ChangeCategory(string type, Guid? parentId) + { + Type = type; + ParentId = parentId; + } - /// - /// 商品价格 - /// - public decimal Price { get; private set; } = price; + /// + /// 上架商品 + /// + public void PutOnSale() + { + Status = "在售"; + } - /// - /// 商品描述 - /// - public string Description { get; private set; } = description; + /// + /// 下架商品 + /// + public void TakeOffSale() + { + Status = "下架"; + } - /// - /// 分类类型(大类或小类) - /// - public string Type { get; private set; } = type; - - /// - /// 父分类ID - /// - public Guid? ParentId { get; private set; } = parentId; - - /// - /// 商品状态(在售/下架等) - /// - public string Status { get; private set; } = status; - - /// - /// 排序字段 - /// - public int Order { get; private set; } = order; - - [NotMapped] - public List Children { get; set; } = new(); - - /// - /// 修改商品信息 - /// - public void Update(string name, string code, decimal price, string description, int order) - { - Name = name; - Code = code; - Price = price; - Description = description; - Order = order; - } - - /// - /// 修改商品分类 - /// - public void ChangeCategory(string type, Guid? parentId) - { - Type = type; - ParentId = parentId; - } - - /// - /// 上架商品 - /// - public void PutOnSale() - { - Status = "在售"; - } - - /// - /// 下架商品 - /// - public void TakeOffSale() - { - Status = "下架"; - } - - /// - /// 修改价格 - /// - public void ChangePrice(decimal newPrice) - { - Price = newPrice; - } + /// + /// 修改价格 + /// + public void ChangePrice(decimal newPrice) + { + Price = newPrice; } } \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/Entities/ServiceCategory.cs b/modules/admin/src/KonSoft.Admin.Domain/Entities/ServiceCategory.cs index 6bcb013..c141425 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/Entities/ServiceCategory.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/Entities/ServiceCategory.cs @@ -1,46 +1,44 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Volo.Abp.Domain.Entities.Auditing; -namespace KonSoft.Admin.Entities +namespace KonSoft.Admin.Entities; + +public class ServiceCategory : FullAuditedAggregateRoot { - public class ServiceCategory : FullAuditedAggregateRoot + protected ServiceCategory() { - public string Name { get; private set; } - public Guid? ParentId { get; private set; } - public string Path { get; private set; } - public int Level { get; private set; } - - protected ServiceCategory() { } - - public ServiceCategory(Guid id, string name) - : base(id) - { - Name = name; - } - - public ServiceCategory(Guid id, string name, Guid? parentId = null, string path = null, int level = 0) : base(id) - { - Name = name; - ParentId = parentId; - Path = path ?? id.ToString(); - Level = level; - } - - - public void UpdateName(string name) => Name = name; - - - public void SetParent(ServiceCategory parent) - { - ParentId = parent?.Id; - Level = (parent?.Level ?? 0) + 1; - Path = parent != null ? $"{parent.Path}/{Id}" : Id.ToString(); - } - - } -} + + public ServiceCategory(Guid id, string name) + : base(id) + { + Name = name; + } + + public ServiceCategory(Guid id, string name, Guid? parentId = null, string path = null, int level = 0) : base(id) + { + Name = name; + ParentId = parentId; + Path = path ?? id.ToString(); + Level = level; + } + + public string Name { get; private set; } + public Guid? ParentId { get; private set; } + public string Path { get; private set; } + public int Level { get; private set; } + + + public void UpdateName(string name) + { + Name = name; + } + + + public void SetParent(ServiceCategory parent) + { + ParentId = parent?.Id; + Level = (parent?.Level ?? 0) + 1; + Path = parent != null ? $"{parent.Path}/{Id}" : Id.ToString(); + } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/Entities/Worker.cs b/modules/admin/src/KonSoft.Admin.Domain/Entities/Worker.cs deleted file mode 100644 index 94aa33f..0000000 --- a/modules/admin/src/KonSoft.Admin.Domain/Entities/Worker.cs +++ /dev/null @@ -1,34 +0,0 @@ -using KonSoft.Admin.Enums; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Domain.Entities.Auditing; - -namespace KonSoft.Admin.Entities -{ - /// - /// 家政人员 - /// - public class Worker : FullAuditedAggregateRoot - { - public string Name { get; private set; } - public string Phone { get; private set; } - public decimal Rating { get; private set; } // 评分 - public List SkillCategoryIds { get; private set; } = new List(); - - public Worker() { } - - - public void UpdateRating(decimal newRating) - { - Rating = newRating; - } - - public bool CanPerform(Guid serviceCategoryId) - { - return SkillCategoryIds.Contains(serviceCategoryId); - } - } -} diff --git a/modules/admin/src/KonSoft.Admin.Domain/IRepositories/IHouseholdWorkerRepository.cs b/modules/admin/src/KonSoft.Admin.Domain/IRepositories/IHouseholdWorkerRepository.cs new file mode 100644 index 0000000..9326980 --- /dev/null +++ b/modules/admin/src/KonSoft.Admin.Domain/IRepositories/IHouseholdWorkerRepository.cs @@ -0,0 +1,8 @@ +using KonSoft.Admin.Entities; +using Volo.Abp.Domain.Repositories; + +namespace KonSoft.Admin.IRepositories; + +public interface IHouseholdWorkerRepository : IRepository +{ +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/IRepositories/IOrderRepository.cs b/modules/admin/src/KonSoft.Admin.Domain/IRepositories/IOrderRepository.cs index 26449f5..53ae5af 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/IRepositories/IOrderRepository.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/IRepositories/IOrderRepository.cs @@ -1,14 +1,8 @@ using KonSoft.Admin.Entities; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; -namespace KonSoft.Admin.Repositories +namespace KonSoft.Admin.IRepositories; + +public interface IOrderRepository : IRepository { - public interface IOrderRepository : IRepository - { - } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/IRepositories/IProductRepository.cs b/modules/admin/src/KonSoft.Admin.Domain/IRepositories/IProductRepository.cs index bbe1aab..041b644 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/IRepositories/IProductRepository.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/IRepositories/IProductRepository.cs @@ -1,14 +1,13 @@ -using KonSoft.Admin.Entities; -using System; +using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Threading.Tasks; +using KonSoft.Admin.Entities; using Volo.Abp.Domain.Repositories; -namespace KonSoft.Admin.Repositories +namespace KonSoft.Admin.IRepositories; + +public interface IProductRepository : IRepository { - public interface IProductRepository : IRepository - { - Task> GetPageRootListAsync(int skipCount, int maxResult, Expression> where); - } -} + Task> GetPageRootListAsync(int skipCount, int maxResult, Expression> where); +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/OpenIddict/OpenIddictDataSeedContributor.cs b/modules/admin/src/KonSoft.Admin.Domain/OpenIddict/OpenIddictDataSeedContributor.cs index 986d4a8..f805d73 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/OpenIddict/OpenIddictDataSeedContributor.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/OpenIddict/OpenIddictDataSeedContributor.cs @@ -23,12 +23,12 @@ namespace KonSoft.Admin.OpenIddict; */ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDependency { + private readonly IAbpApplicationManager _applicationManager; private readonly IConfiguration _configuration; private readonly IOpenIddictApplicationRepository _openIddictApplicationRepository; - private readonly IAbpApplicationManager _applicationManager; private readonly IOpenIddictScopeRepository _openIddictScopeRepository; - private readonly IOpenIddictScopeManager _scopeManager; private readonly IPermissionDataSeeder _permissionDataSeeder; + private readonly IOpenIddictScopeManager _scopeManager; private readonly IStringLocalizer L; public OpenIddictDataSeedContributor( @@ -38,7 +38,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep IOpenIddictScopeRepository openIddictScopeRepository, IOpenIddictScopeManager scopeManager, IPermissionDataSeeder permissionDataSeeder, - IStringLocalizer l ) + IStringLocalizer l) { _configuration = configuration; _openIddictApplicationRepository = openIddictApplicationRepository; @@ -60,7 +60,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep { if (await _openIddictScopeRepository.FindByNameAsync("Admin") == null) { - await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor { + await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor + { Name = "Admin", DisplayName = "Admin API", Resources = { "Admin" } }); } @@ -68,7 +69,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep private async Task CreateApplicationsAsync() { - var commonScopes = new List { + var commonScopes = new List + { OpenIddictConstants.Permissions.Scopes.Address, OpenIddictConstants.Permissions.Scopes.Email, OpenIddictConstants.Permissions.Scopes.Phone, @@ -80,10 +82,6 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var configurationSection = _configuration.GetSection("OpenIddict:Applications"); - - - - // Swagger Client var swaggerClientId = configurationSection["Admin_Swagger:ClientId"]; if (!swaggerClientId.IsNullOrWhiteSpace()) @@ -91,13 +89,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var swaggerRootUrl = configurationSection["Admin_Swagger:RootUrl"]?.TrimEnd('/'); await CreateApplicationAsync( - name: swaggerClientId!, - type: OpenIddictConstants.ClientTypes.Public, - consentType: OpenIddictConstants.ConsentTypes.Implicit, - displayName: "Swagger Application", - secret: null, - grantTypes: [OpenIddictConstants.GrantTypes.AuthorizationCode], - scopes: commonScopes, + swaggerClientId!, + OpenIddictConstants.ClientTypes.Public, + OpenIddictConstants.ConsentTypes.Implicit, + "Swagger Application", + null, + [OpenIddictConstants.GrantTypes.AuthorizationCode], + commonScopes, redirectUri: $"{swaggerRootUrl}/swagger/oauth2-redirect.html", clientUri: swaggerRootUrl ); @@ -131,13 +129,14 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var client = await _openIddictApplicationRepository.FindByClientIdAsync(name); - var application = new AbpApplicationDescriptor { + var application = new AbpApplicationDescriptor + { ClientId = name, ClientType = type, ClientSecret = secret, ConsentType = consentType, DisplayName = displayName, - ClientUri = clientUri, + ClientUri = clientUri }; Check.NotNullOrEmpty(grantTypes, nameof(grantTypes)); @@ -160,7 +159,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Logout); } - var buildInGrantTypes = new[] { + var buildInGrantTypes = new[] + { OpenIddictConstants.GrantTypes.Implicit, OpenIddictConstants.GrantTypes.Password, OpenIddictConstants.GrantTypes.AuthorizationCode, OpenIddictConstants.GrantTypes.ClientCredentials, OpenIddictConstants.GrantTypes.DeviceCode, OpenIddictConstants.GrantTypes.RefreshToken @@ -233,7 +233,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep } } - var buildInScopes = new[] { + var buildInScopes = new[] + { OpenIddictConstants.Permissions.Scopes.Address, OpenIddictConstants.Permissions.Scopes.Email, OpenIddictConstants.Permissions.Scopes.Phone, OpenIddictConstants.Permissions.Scopes.Profile, OpenIddictConstants.Permissions.Scopes.Roles @@ -289,8 +290,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep await _permissionDataSeeder.SeedAsync( ClientPermissionValueProvider.ProviderName, name, - permissions, - null + permissions ); } @@ -302,8 +302,10 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep if (!HasSameRedirectUris(client, application)) { - client.RedirectUris = JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); - client.PostLogoutRedirectUris = JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/'))); + client.RedirectUris = + JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); + client.PostLogoutRedirectUris = + JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/'))); await _applicationManager.UpdateAsync(client.ToModel()); } @@ -317,11 +319,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep private bool HasSameRedirectUris(OpenIddictApplication existingClient, AbpApplicationDescriptor application) { - return existingClient.RedirectUris == JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); + return existingClient.RedirectUris == + JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); } private bool HasSameScopes(OpenIddictApplication existingClient, AbpApplicationDescriptor application) { - return existingClient.Permissions == JsonSerializer.Serialize(application.Permissions.Select(q => q.ToString().TrimEnd('/'))); + return existingClient.Permissions == + JsonSerializer.Serialize(application.Permissions.Select(q => q.ToString().TrimEnd('/'))); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/Properties/AssemblyInfo.cs b/modules/admin/src/KonSoft.Admin.Domain/Properties/AssemblyInfo.cs index 1ed25b9..58c43ff 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/Properties/AssemblyInfo.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/Properties/AssemblyInfo.cs @@ -1,3 +1,4 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.Admin.Domain.Tests")] -[assembly:InternalsVisibleToAttribute("KonSoft.Admin.TestBase")] + +[assembly: InternalsVisibleToAttribute("KonSoft.Admin.Domain.Tests")] +[assembly: InternalsVisibleToAttribute("KonSoft.Admin.TestBase")] \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/Settings/AdminSettingDefinitionProvider.cs b/modules/admin/src/KonSoft.Admin.Domain/Settings/AdminSettingDefinitionProvider.cs index 0920a30..e3e9f67 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/Settings/AdminSettingDefinitionProvider.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/Settings/AdminSettingDefinitionProvider.cs @@ -9,4 +9,4 @@ public class AdminSettingDefinitionProvider : SettingDefinitionProvider //Define your own settings here. Example: //context.Add(new SettingDefinition(AdminSettings.MySetting1)); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/Settings/AdminSettings.cs b/modules/admin/src/KonSoft.Admin.Domain/Settings/AdminSettings.cs index 1d1d09e..14c0ab1 100644 --- a/modules/admin/src/KonSoft.Admin.Domain/Settings/AdminSettings.cs +++ b/modules/admin/src/KonSoft.Admin.Domain/Settings/AdminSettings.cs @@ -6,4 +6,4 @@ public static class AdminSettings //Add your own setting names here. Example: //public const string MySetting1 = Prefix + ".MySetting1"; -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.Domain/ValueObjects/AddressInfo.cs b/modules/admin/src/KonSoft.Admin.Domain/ValueObjects/AddressInfo.cs new file mode 100644 index 0000000..8f52ad0 --- /dev/null +++ b/modules/admin/src/KonSoft.Admin.Domain/ValueObjects/AddressInfo.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; +using Volo.Abp.Domain.Values; + +namespace KonSoft.Admin.ValueObjects; + +/// +/// 地址 +/// +public class AddressInfo : ValueObject +{ + public AddressInfo(string contactName, string contactPhone, string detailAddress, string city, string district) + { + ContactName = contactName; + ContactPhone = contactPhone; + DetailAddress = detailAddress; + City = city; + District = district; + } + + /// + /// 联系人 + /// + public string ContactName { get; private set; } + + /// + /// 手机号 + /// + public string ContactPhone { get; private set; } + + /// + /// 详细地址 + /// + public string DetailAddress { get; private set; } + + /// + /// 城市 + /// + public string City { get; private set; } + + /// + /// 区域 + /// + public string District { get; private set; } + + + protected override IEnumerable GetAtomicValues() + { + yield return ContactName; + yield return ContactPhone; + yield return DetailAddress; + yield return City; + yield return District; + } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminDbContext.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminDbContext.cs index 5f7dcdb..9e107af 100644 --- a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminDbContext.cs +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminDbContext.cs @@ -1,4 +1,4 @@ -using KonSoft.Admin.Entities; +using KonSoft.Admin.EntityFrameworkCore.Configures; using Microsoft.EntityFrameworkCore; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; @@ -18,60 +18,21 @@ namespace KonSoft.Admin.EntityFrameworkCore; [ReplaceDbContext(typeof(IIdentityDbContext))] [ReplaceDbContext(typeof(ITenantManagementDbContext))] -[ConnectionStringName("Default")] +[ConnectionStringName(AdminConsts.ConnectionStringName)] public class AdminDbContext : AbpDbContext, IIdentityDbContext, ITenantManagementDbContext { - /* Add DbSet properties for your Aggregate Roots / Entities here. */ - - #region Entities from the modules - - /* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext - * and replaced them for this DbContext. This allows you to perform JOIN - * queries for the entities of these modules over the repositories easily. You - * typically don't need that for other modules. But, if you need, you can - * implement the DbContext interface of the needed module and use ReplaceDbContext - * attribute just like IIdentityDbContext and ITenantManagementDbContext. - * - * More info: Replacing a DbContext of a module ensures that the related module - * uses this DbContext on runtime. Otherwise, it will use its own DbContext class. - */ - - //Identity - public DbSet Users { get; set; } - public DbSet Roles { get; set; } - public DbSet ClaimTypes { get; set; } - public DbSet OrganizationUnits { get; set; } - public DbSet SecurityLogs { get; set; } - public DbSet LinkUsers { get; set; } - public DbSet UserDelegations { get; set; } - public DbSet Sessions { get; set; } - // Tenant Management - public DbSet Tenants { get; set; } - public DbSet TenantConnectionStrings { get; set; } - - #endregion - - #region 订单 - public DbSet Orders { get; set; } - public DbSet Workers { get; set; } - public DbSet ServiceCategorys { get; set; } - #endregion - public AdminDbContext(DbContextOptions options) : base(options) { - } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); - /* Include modules to your migration db context */ - builder.ConfigurePermissionManagement(); builder.ConfigureSettingManagement(); builder.ConfigureBackgroundJobs(); @@ -81,13 +42,17 @@ public class AdminDbContext : builder.ConfigureFeatureManagement(); builder.ConfigureTenantManagement(); - /* Configure your own tables/entities inside here */ - - //builder.Entity(b => - //{ - // b.ToTable(AdminConsts.DbTablePrefix + "YourEntities", AdminConsts.DbSchema); - // b.ConfigureByConvention(); //auto configure for the base class props - // //... - //}); + builder.ConfigureApplication(); } -} + + public DbSet Users { get; set; } + public DbSet Roles { get; set; } + public DbSet ClaimTypes { get; set; } + public DbSet OrganizationUnits { get; set; } + public DbSet SecurityLogs { get; set; } + public DbSet LinkUsers { get; set; } + public DbSet UserDelegations { get; set; } + public DbSet Sessions { get; set; } + public DbSet Tenants { get; set; } + public DbSet TenantConnectionStrings { get; set; } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminDbContextFactory.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminDbContextFactory.cs index 9d63ad3..0e77c3e 100644 --- a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminDbContextFactory.cs +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminDbContextFactory.cs @@ -20,7 +20,7 @@ public class AdminDbContextFactory : IDesignTimeDbContextFactory var configuration = BuildConfiguration(); var builder = new DbContextOptionsBuilder() - .UseNpgsql(configuration.GetConnectionString("Default")); + .UseNpgsql(configuration.GetConnectionString(AdminConsts.ConnectionStringName)); return new AdminDbContext(builder.Options); } @@ -28,9 +28,9 @@ public class AdminDbContextFactory : IDesignTimeDbContextFactory private static IConfigurationRoot BuildConfiguration() { var builder = new ConfigurationBuilder() - .SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../KonSoft.Admin.DbMigrator/")) - .AddJsonFile("appsettings.json", optional: false); + .SetBasePath(Path.Combine(Directory.GetCurrentDirectory(), "../../../../microservices/KonSoft.Admin.HttpApi.Host/")) + .AddJsonFile("appsettings.json", false); return builder.Build(); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminEfCoreEntityExtensionMappings.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminEfCoreEntityExtensionMappings.cs index a41e0ac..ec8f2fb 100644 --- a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminEfCoreEntityExtensionMappings.cs +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminEfCoreEntityExtensionMappings.cs @@ -1,13 +1,10 @@ -using Microsoft.EntityFrameworkCore; -using Volo.Abp.Identity; -using Volo.Abp.ObjectExtending; -using Volo.Abp.Threading; +using Volo.Abp.Threading; namespace KonSoft.Admin.EntityFrameworkCore; public static class AdminEfCoreEntityExtensionMappings { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { @@ -16,29 +13,29 @@ public static class AdminEfCoreEntityExtensionMappings OneTimeRunner.Run(() => { - /* You can configure extra properties for the - * entities defined in the modules used by your application. - * - * This class can be used to map these extra properties to table fields in the database. - * - * USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING. - * USE AdminModuleExtensionConfigurator CLASS (in the Domain.Shared project) - * FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES - * - * Example: Map a property to a table field: + /* You can configure extra properties for the + * entities defined in the modules used by your application. + * + * This class can be used to map these extra properties to table fields in the database. + * + * USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING. + * USE AdminModuleExtensionConfigurator CLASS (in the Domain.Shared project) + * FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES + * + * Example: Map a property to a table field: - ObjectExtensionManager.Instance - .MapEfCoreProperty( - "MyProperty", - (entityBuilder, propertyBuilder) => - { - propertyBuilder.HasMaxLength(128); - } - ); + ObjectExtensionManager.Instance + .MapEfCoreProperty( + "MyProperty", + (entityBuilder, propertyBuilder) => + { + propertyBuilder.HasMaxLength(128); + } + ); - * See the documentation for more: - * https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities - */ + * See the documentation for more: + * https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities + */ }); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminEntityFrameworkCoreModule.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminEntityFrameworkCoreModule.cs index ff52226..21ab65b 100644 --- a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminEntityFrameworkCoreModule.cs +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/AdminEntityFrameworkCoreModule.cs @@ -1,6 +1,5 @@ using System; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Uow; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; @@ -26,7 +25,7 @@ namespace KonSoft.Admin.EntityFrameworkCore; typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule) - )] +)] public class AdminEntityFrameworkCoreModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -41,17 +40,16 @@ public class AdminEntityFrameworkCoreModule : AbpModule { context.Services.AddAbpDbContext(options => { - /* Remove "includeAllEntities: true" to create - * default repositories only for aggregate roots */ - options.AddDefaultRepositories(includeAllEntities: true); + /* Remove "includeAllEntities: true" to create + * default repositories only for aggregate roots */ + options.AddDefaultRepositories(true); }); Configure(options => { - /* The main point to change your DBMS. - * See also AdminMigrationsDbContextFactory for EF Core tooling. */ + /* The main point to change your DBMS. + * See also AdminMigrationsDbContextFactory for EF Core tooling. */ options.UseNpgsql(); }); - } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Configures/ApplicationDbContextModelBuilderExtensions.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Configures/ApplicationDbContextModelBuilderExtensions.cs index ba7094d..c305eba 100644 --- a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Configures/ApplicationDbContextModelBuilderExtensions.cs +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Configures/ApplicationDbContextModelBuilderExtensions.cs @@ -1,52 +1,48 @@ using KonSoft.Admin.Entities; using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Volo.Abp; +using Volo.Abp.EntityFrameworkCore.Modeling; +using Volo.Abp.Identity; -namespace KonSoft.Admin.EntityFrameworkCore.Configures +namespace KonSoft.Admin.EntityFrameworkCore.Configures; + +public static class ApplicationDbContextModelBuilderExtensions { - public static class ApplicationDbContextModelBuilderExtensions + public static void ConfigureApplication([NotNull] this ModelBuilder builder) { - public static void ConfigureApplication([NotNull] this ModelBuilder builder) + Check.NotNull(builder, nameof(builder)); + + builder.Entity(e => { - Check.NotNull(builder, nameof(builder)); + e.ToTable(AdminConsts.DbTablePrefix + nameof(Order) + AdminConsts.DbSchema); + e.ConfigureByConvention(); - builder.Entity(b => - { - b.ToTable(AdminConsts.DbTablePrefix + nameof(Order) + AdminConsts.DbSchema); + e.ComplexProperty(b => b.Address); - b.OwnsOne(o => o.Address, a => - { - a.Property(p => p.ContactName).HasColumnName("ContactName").HasMaxLength(50); - a.Property(p => p.ContactPhone).HasColumnName("ContactPhone").HasMaxLength(20); - a.Property(p => p.DetailAddress).HasColumnName("DetailAddress").HasMaxLength(200); - a.Property(p => p.City).HasColumnName("City").HasMaxLength(50); - a.Property(p => p.District).HasColumnName("District").HasMaxLength(50); - }); - }); + e.ApplyObjectExtensionMappings(); + }); - builder.Entity(b => - { - b.ToTable(AdminConsts.DbTablePrefix + nameof(Worker) + AdminConsts.DbSchema); + builder.Entity(e => + { + e.ToTable(AdminConsts.DbTablePrefix + nameof(Product) + AdminConsts.DbSchema); + e.ConfigureByConvention(); + e.ApplyObjectExtensionMappings(); + }); + builder.Entity(e => + { + e.ToTable(AbpIdentityDbProperties.DbTablePrefix + "Users" + AbpIdentityDbProperties.DbSchema); + e.ConfigureByConvention(); + e.ApplyObjectExtensionMappings(); + }); - }); - - - builder.Entity(b => - { - b.ToTable(AdminConsts.DbTablePrefix + nameof(ServiceCategory) + AdminConsts.DbSchema); - - - }); - - } - + builder.Entity(e => + { + e.ToTable(AdminConsts.DbTablePrefix + nameof(ServiceCategory) + AdminConsts.DbSchema); + e.ConfigureByConvention(); + e.ApplyObjectExtensionMappings(); + }); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreAdminDbSchemaMigrator.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreAdminDbSchemaMigrator.cs index 99dceb8..520ac06 100644 --- a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreAdminDbSchemaMigrator.cs +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreAdminDbSchemaMigrator.cs @@ -1,8 +1,8 @@ using System; using System.Threading.Tasks; +using KonSoft.Admin.Data; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using KonSoft.Admin.Data; using Volo.Abp.DependencyInjection; namespace KonSoft.Admin.EntityFrameworkCore; @@ -31,4 +31,4 @@ public class EntityFrameworkCoreAdminDbSchemaMigrator .Database .MigrateAsync(); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Repositories/HouseholdWorkerRepository.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Repositories/HouseholdWorkerRepository.cs new file mode 100644 index 0000000..f85c8a1 --- /dev/null +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Repositories/HouseholdWorkerRepository.cs @@ -0,0 +1,16 @@ +using KonSoft.Admin.Entities; +using KonSoft.Admin.IRepositories; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.TenantManagement.EntityFrameworkCore; + +namespace KonSoft.Admin.EntityFrameworkCore.Repositories; + +public class HouseholdWorkerRepository : EfCoreRepository, + IHouseholdWorkerRepository +{ + public HouseholdWorkerRepository(IDbContextProvider dbContextProvider) : base( + dbContextProvider) + { + } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Repositories/OrderRepository.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Repositories/OrderRepository.cs index 956a252..0f8048f 100644 --- a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Repositories/OrderRepository.cs +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Repositories/OrderRepository.cs @@ -1,21 +1,13 @@ using KonSoft.Admin.Entities; -using KonSoft.Admin.Repositories; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.Domain.Repositories; +using KonSoft.Admin.IRepositories; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; -namespace KonSoft.Admin.EntityFrameworkCore.Repositories +namespace KonSoft.Admin.EntityFrameworkCore.Repositories; + +public class OrderRepository : EfCoreRepository, IOrderRepository { - public class OrderRepository : EfCoreRepository, IOrderRepository + public OrderRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { - public OrderRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) - { - } } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Repositories/ProductRepository.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Repositories/ProductRepository.cs index c49f828..fefe51f 100644 --- a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Repositories/ProductRepository.cs +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/EntityFrameworkCore/Repositories/ProductRepository.cs @@ -1,25 +1,25 @@ -using KonSoft.Admin.Entities; -using KonSoft.Admin.Repositories; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Threading.Tasks; +using KonSoft.Admin.Entities; +using KonSoft.Admin.IRepositories; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; -namespace KonSoft.Admin.EntityFrameworkCore.Repositories -{ - public class ProductRepository : EfCoreRepository, IProductRepository - { - public ProductRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) - { - } +namespace KonSoft.Admin.EntityFrameworkCore.Repositories; - public async Task> GetPageRootListAsync(int skipCount, int maxResultCount, Expression> where) - { - var queryable = await GetQueryableAsync(); - return queryable.PageBy(skipCount, maxResultCount).Where(where).OrderBy(x => x.Order).ToList(); - } +public class ProductRepository : EfCoreRepository, IProductRepository +{ + public ProductRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { } -} + + public async Task> GetPageRootListAsync(int skipCount, int maxResultCount, + Expression> where) + { + var queryable = await GetQueryableAsync(); + return queryable.PageBy(skipCount, maxResultCount).Where(where).OrderBy(x => x.Order).ToList(); + } +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Migrations/20251017042956_V1.0.0.Designer.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Migrations/20251017042956_V1.0.0.Designer.cs new file mode 100644 index 0000000..1d35e74 --- /dev/null +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Migrations/20251017042956_V1.0.0.Designer.cs @@ -0,0 +1,2294 @@ +// +using System; +using System.Collections.Generic; +using KonSoft.Admin.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using Volo.Abp.EntityFrameworkCore; + +#nullable disable + +namespace KonSoft.Admin.Migrations +{ + [DbContext(typeof(AdminDbContext))] + [Migration("20251017042956_V1.0.0")] + partial class V100 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql) + .HasAnnotation("ProductVersion", "8.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("KonSoft.Admin.Entities.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("numeric"); + + b.Property("CancelReason") + .HasColumnType("text"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("PaidAmount") + .HasColumnType("numeric"); + + b.Property("PaymentMethod") + .IsRequired() + .HasColumnType("text"); + + b.Property("Remark") + .HasColumnType("text"); + + b.Property("ServiceCategoryId") + .HasColumnType("uuid"); + + b.Property("ServiceTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("WorkerId") + .HasColumnType("uuid"); + + b.ComplexProperty>("Address", "KonSoft.Admin.Entities.Order.Address#AddressInfo", b1 => + { + b1.IsRequired(); + + b1.Property("City") + .IsRequired() + .HasColumnType("text"); + + b1.Property("ContactName") + .IsRequired() + .HasColumnType("text"); + + b1.Property("ContactPhone") + .IsRequired() + .HasColumnType("text"); + + b1.Property("DetailAddress") + .IsRequired() + .HasColumnType("text"); + + b1.Property("District") + .IsRequired() + .HasColumnType("text"); + }); + + b.HasKey("Id"); + + b.ToTable("AppOrder", (string)null); + }); + + modelBuilder.Entity("KonSoft.Admin.Entities.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Code") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("Price") + .HasColumnType("numeric"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AppProduct", (string)null); + }); + + modelBuilder.Entity("KonSoft.Admin.Entities.ServiceCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Level") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("Path") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AppServiceCategory", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("character varying(96)") + .HasColumnName("ApplicationName"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("BrowserInfo"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("ClientId"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("ClientIpAddress"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("ClientName"); + + b.Property("Comments") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("Comments"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("CorrelationId"); + + b.Property("Exceptions") + .HasColumnType("text"); + + b.Property("ExecutionDuration") + .HasColumnType("integer") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("HttpMethod") + .HasMaxLength(16) + .HasColumnType("character varying(16)") + .HasColumnName("HttpMethod"); + + b.Property("HttpStatusCode") + .HasColumnType("integer") + .HasColumnName("HttpStatusCode"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("uuid") + .HasColumnName("ImpersonatorTenantId"); + + b.Property("ImpersonatorTenantName") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("ImpersonatorTenantName"); + + b.Property("ImpersonatorUserId") + .HasColumnType("uuid") + .HasColumnName("ImpersonatorUserId"); + + b.Property("ImpersonatorUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("ImpersonatorUserName"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("TenantName"); + + b.Property("Url") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("Url"); + + b.Property("UserId") + .HasColumnType("uuid") + .HasColumnName("UserId"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuditLogId") + .HasColumnType("uuid") + .HasColumnName("AuditLogId"); + + b.Property("ExecutionDuration") + .HasColumnType("integer") + .HasColumnName("ExecutionDuration"); + + b.Property("ExecutionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("ExecutionTime"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("MethodName") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("MethodName"); + + b.Property("Parameters") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)") + .HasColumnName("Parameters"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("ServiceName"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuditLogId") + .HasColumnType("uuid") + .HasColumnName("AuditLogId"); + + b.Property("ChangeTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("ChangeTime"); + + b.Property("ChangeType") + .HasColumnType("smallint") + .HasColumnName("ChangeType"); + + b.Property("EntityId") + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("EntityId"); + + b.Property("EntityTenantId") + .HasColumnType("uuid"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("EntityTypeFullName"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("EntityChangeId") + .HasColumnType("uuid"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("NewValue"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("character varying(512)") + .HasColumnName("OriginalValue"); + + b.Property("PropertyName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("PropertyName"); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("PropertyTypeFullName"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasMaxLength(1048576) + .HasColumnType("character varying(1048576)"); + + b.Property("JobName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("LastTryTime") + .HasColumnType("timestamp without time zone"); + + b.Property("NextTryTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AllowedProviders") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("DefaultValue") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("IsAvailableToHost") + .HasColumnType("boolean"); + + b.Property("IsVisibleToClients") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ValueType") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.HasKey("Id"); + + b.HasIndex("GroupName"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpFeatures", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureGroupDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpFeatureGroups", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique(); + + b.ToTable("AbpFeatureValues", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsStatic") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("Regex") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("RegexDescription") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Required") + .HasColumnType("boolean"); + + b.Property("ValueType") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("SourceTenantId") + .HasColumnType("uuid"); + + b.Property("SourceUserId") + .HasColumnType("uuid"); + + b.Property("TargetTenantId") + .HasColumnType("uuid"); + + b.Property("TargetUserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId") + .IsUnique(); + + b.ToTable("AbpLinkUsers", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("EntityVersion") + .HasColumnType("integer"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDefault") + .HasColumnType("boolean") + .HasColumnName("IsDefault"); + + b.Property("IsPublic") + .HasColumnType("boolean") + .HasColumnName("IsPublic"); + + b.Property("IsStatic") + .HasColumnType("boolean") + .HasColumnName("IsStatic"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySecurityLog", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Action") + .HasMaxLength(96) + .HasColumnType("character varying(96)"); + + b.Property("ApplicationName") + .HasMaxLength(96) + .HasColumnType("character varying(96)"); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CorrelationId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("Identity") + .HasMaxLength(96) + .HasColumnType("character varying(96)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("TenantName") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Action"); + + b.HasIndex("TenantId", "ApplicationName"); + + b.HasIndex("TenantId", "Identity"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSecurityLogs", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentitySession", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ClientId") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Device") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("DeviceInfo") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("IpAddresses") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("LastAccessed") + .HasColumnType("timestamp without time zone"); + + b.Property("SessionId") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("SignedIn") + .HasColumnType("timestamp without time zone"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("Device"); + + b.HasIndex("SessionId"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpSessions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(0) + .HasColumnName("AccessFailedCount"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("character varying(21)"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("Email"); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("EmailConfirmed"); + + b.Property("EntityVersion") + .HasColumnType("integer"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsActive") + .HasColumnType("boolean") + .HasColumnName("IsActive"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("IsExternal") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsExternal"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("LastPasswordChangeTime") + .HasColumnType("timestamp with time zone"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("LockoutEnabled"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("Name"); + + b.Property("NormalizedEmail") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("NormalizedEmail"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("NormalizedUserName"); + + b.Property("PasswordHash") + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("PasswordHash"); + + b.Property("PhoneNumber") + .HasMaxLength(16) + .HasColumnType("character varying(16)") + .HasColumnName("PhoneNumber"); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("PhoneNumberConfirmed"); + + b.Property("SecurityStamp") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("SecurityStamp"); + + b.Property("ShouldChangePasswordOnNextLogin") + .HasColumnType("boolean"); + + b.Property("Surname") + .HasMaxLength(64) + .HasColumnType("character varying(64)") + .HasColumnName("Surname"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("TwoFactorEnabled"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)") + .HasColumnName("UserName"); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers", (string)null); + + b.HasDiscriminator("Discriminator").HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ClaimType") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ClaimValue") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserDelegation", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("EndTime") + .HasColumnType("timestamp without time zone"); + + b.Property("SourceUserId") + .HasColumnType("uuid"); + + b.Property("StartTime") + .HasColumnType("timestamp without time zone"); + + b.Property("TargetUserId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.ToTable("AbpUserDelegations", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ProviderDisplayName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(196) + .HasColumnType("character varying(196)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uuid"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "UserId"); + + b.HasIndex("UserId", "OrganizationUnitId"); + + b.ToTable("AbpUserOrganizationUnits", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("character varying(95)") + .HasColumnName("Code"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)") + .HasColumnName("DisplayName"); + + b.Property("EntityVersion") + .HasColumnType("integer"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("ParentId"); + + b.ToTable("AbpOrganizationUnits", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.Property("OrganizationUnitId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("OrganizationUnitId", "RoleId"); + + b.HasIndex("RoleId", "OrganizationUnitId"); + + b.ToTable("AbpOrganizationUnitRoles", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Applications.OpenIddictApplication", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationType") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ClientId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ClientSecret") + .HasColumnType("text"); + + b.Property("ClientType") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ClientUri") + .HasColumnType("text"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("ConsentType") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("DisplayNames") + .HasColumnType("text"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("JsonWebKeySet") + .HasColumnType("text"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("LogoUri") + .HasColumnType("text"); + + b.Property("Permissions") + .HasColumnType("text"); + + b.Property("PostLogoutRedirectUris") + .HasColumnType("text"); + + b.Property("Properties") + .HasColumnType("text"); + + b.Property("RedirectUris") + .HasColumnType("text"); + + b.Property("Requirements") + .HasColumnType("text"); + + b.Property("Settings") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("OpenIddictApplications", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Authorizations.OpenIddictAuthorization", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationDate") + .HasColumnType("timestamp without time zone"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Properties") + .HasColumnType("text"); + + b.Property("Scopes") + .HasColumnType("text"); + + b.Property("Status") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Subject") + .HasMaxLength(400) + .HasColumnType("character varying(400)"); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.HasIndex("ApplicationId", "Status", "Subject", "Type"); + + b.ToTable("OpenIddictAuthorizations", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Scopes.OpenIddictScope", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("Descriptions") + .HasColumnType("text"); + + b.Property("DisplayName") + .HasColumnType("text"); + + b.Property("DisplayNames") + .HasColumnType("text"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("Properties") + .HasColumnType("text"); + + b.Property("Resources") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("OpenIddictScopes", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Tokens.OpenIddictToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ApplicationId") + .HasColumnType("uuid"); + + b.Property("AuthorizationId") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationDate") + .HasColumnType("timestamp without time zone"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("ExpirationDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Payload") + .HasColumnType("text"); + + b.Property("Properties") + .HasColumnType("text"); + + b.Property("RedemptionDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ReferenceId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("Status") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Subject") + .HasMaxLength(400) + .HasColumnType("character varying(400)"); + + b.Property("Type") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.HasIndex("AuthorizationId"); + + b.HasIndex("ReferenceId"); + + b.HasIndex("ApplicationId", "Status", "Subject", "Type"); + + b.ToTable("OpenIddictTokens", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("GroupName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("IsEnabled") + .HasColumnType("boolean"); + + b.Property("MultiTenancySide") + .HasColumnType("smallint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ParentName") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Providers") + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("StateCheckers") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("GroupName"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ProviderName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("TenantId") + .HasColumnType("uuid") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name", "ProviderName", "ProviderKey") + .IsUnique(); + + b.ToTable("AbpPermissionGrants", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGroupDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpPermissionGroups", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("ProviderKey") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("ProviderName") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey") + .IsUnique(); + + b.ToTable("AbpSettings", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.SettingDefinitionRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("DefaultValue") + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("ExtraProperties") + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsEncrypted") + .HasColumnType("boolean"); + + b.Property("IsInherited") + .HasColumnType("boolean"); + + b.Property("IsVisibleToClients") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("character varying(128)"); + + b.Property("Providers") + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpSettingDefinitions", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("EntityVersion") + .HasColumnType("integer"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpTenants", (string)null); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uuid"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("character varying(64)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("character varying(1024)"); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings", (string)null); + }); + + modelBuilder.Entity("KonSoft.Admin.Entities.HouseholdWorker", b => + { + b.HasBaseType("Volo.Abp.Identity.IdentityUser"); + + b.Property("OrderCount") + .HasColumnType("integer"); + + b.Property("Profession") + .IsRequired() + .HasColumnType("text"); + + b.Property("ScopeOfCompetence") + .IsRequired() + .HasColumnType("text"); + + b.ToTable("AbpUsers", (string)null); + + b.HasDiscriminator().HasValue("HouseholdWorker"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserOrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("OrganizationUnits") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany() + .HasForeignKey("ParentId"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnitRole", b => + { + b.HasOne("Volo.Abp.Identity.OrganizationUnit", null) + .WithMany("Roles") + .HasForeignKey("OrganizationUnitId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Authorizations.OpenIddictAuthorization", b => + { + b.HasOne("Volo.Abp.OpenIddict.Applications.OpenIddictApplication", null) + .WithMany() + .HasForeignKey("ApplicationId"); + }); + + modelBuilder.Entity("Volo.Abp.OpenIddict.Tokens.OpenIddictToken", b => + { + b.HasOne("Volo.Abp.OpenIddict.Applications.OpenIddictApplication", null) + .WithMany() + .HasForeignKey("ApplicationId"); + + b.HasOne("Volo.Abp.OpenIddict.Authorizations.OpenIddictAuthorization", null) + .WithMany() + .HasForeignKey("AuthorizationId"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Navigation("Actions"); + + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Navigation("Claims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("OrganizationUnits"); + + b.Navigation("Roles"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.OrganizationUnit", b => + { + b.Navigation("Roles"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Navigation("ConnectionStrings"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Migrations/20251017042956_V1.0.0.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Migrations/20251017042956_V1.0.0.cs new file mode 100644 index 0000000..0fdbf48 --- /dev/null +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Migrations/20251017042956_V1.0.0.cs @@ -0,0 +1,157 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace KonSoft.Admin.Migrations +{ + /// + public partial class V100 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Discriminator", + table: "AbpUsers", + type: "character varying(21)", + maxLength: 21, + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "OrderCount", + table: "AbpUsers", + type: "integer", + nullable: true); + + migrationBuilder.AddColumn( + name: "Profession", + table: "AbpUsers", + type: "text", + nullable: true); + + migrationBuilder.AddColumn( + name: "ScopeOfCompetence", + table: "AbpUsers", + type: "text", + nullable: true); + + migrationBuilder.CreateTable( + name: "AppOrder", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CustomerId = table.Column(type: "uuid", nullable: false), + WorkerId = table.Column(type: "uuid", nullable: true), + ServiceCategoryId = table.Column(type: "uuid", nullable: false), + ServiceTime = table.Column(type: "timestamp without time zone", nullable: false), + Status = table.Column(type: "integer", nullable: false), + Amount = table.Column(type: "numeric", nullable: false), + PaidAmount = table.Column(type: "numeric", nullable: false), + PaymentMethod = table.Column(type: "text", nullable: false), + Remark = table.Column(type: "text", nullable: true), + CancelReason = table.Column(type: "text", nullable: true), + Address_City = table.Column(type: "text", nullable: false), + Address_ContactName = table.Column(type: "text", nullable: false), + Address_ContactPhone = table.Column(type: "text", nullable: false), + Address_DetailAddress = table.Column(type: "text", nullable: false), + Address_District = table.Column(type: "text", nullable: false), + ExtraProperties = table.Column(type: "text", nullable: false), + ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false), + CreationTime = table.Column(type: "timestamp without time zone", nullable: false), + CreatorId = table.Column(type: "uuid", nullable: true), + LastModificationTime = table.Column(type: "timestamp without time zone", nullable: true), + LastModifierId = table.Column(type: "uuid", nullable: true), + IsDeleted = table.Column(type: "boolean", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uuid", nullable: true), + DeletionTime = table.Column(type: "timestamp without time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AppOrder", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AppProduct", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: false), + Code = table.Column(type: "text", nullable: false), + Price = table.Column(type: "numeric", nullable: false), + Description = table.Column(type: "text", nullable: false), + Type = table.Column(type: "text", nullable: false), + ParentId = table.Column(type: "uuid", nullable: true), + Status = table.Column(type: "text", nullable: false), + Order = table.Column(type: "integer", nullable: false), + ExtraProperties = table.Column(type: "text", nullable: false), + ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false), + CreationTime = table.Column(type: "timestamp without time zone", nullable: false), + CreatorId = table.Column(type: "uuid", nullable: true), + LastModificationTime = table.Column(type: "timestamp without time zone", nullable: true), + LastModifierId = table.Column(type: "uuid", nullable: true), + IsDeleted = table.Column(type: "boolean", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uuid", nullable: true), + DeletionTime = table.Column(type: "timestamp without time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AppProduct", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AppServiceCategory", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: false), + ParentId = table.Column(type: "uuid", nullable: true), + Path = table.Column(type: "text", nullable: false), + Level = table.Column(type: "integer", nullable: false), + ExtraProperties = table.Column(type: "text", nullable: false), + ConcurrencyStamp = table.Column(type: "character varying(40)", maxLength: 40, nullable: false), + CreationTime = table.Column(type: "timestamp without time zone", nullable: false), + CreatorId = table.Column(type: "uuid", nullable: true), + LastModificationTime = table.Column(type: "timestamp without time zone", nullable: true), + LastModifierId = table.Column(type: "uuid", nullable: true), + IsDeleted = table.Column(type: "boolean", nullable: false, defaultValue: false), + DeleterId = table.Column(type: "uuid", nullable: true), + DeletionTime = table.Column(type: "timestamp without time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AppServiceCategory", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AppOrder"); + + migrationBuilder.DropTable( + name: "AppProduct"); + + migrationBuilder.DropTable( + name: "AppServiceCategory"); + + migrationBuilder.DropColumn( + name: "Discriminator", + table: "AbpUsers"); + + migrationBuilder.DropColumn( + name: "OrderCount", + table: "AbpUsers"); + + migrationBuilder.DropColumn( + name: "Profession", + table: "AbpUsers"); + + migrationBuilder.DropColumn( + name: "ScopeOfCompetence", + table: "AbpUsers"); + } + } +} diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Migrations/AdminDbContextModelSnapshot.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Migrations/AdminDbContextModelSnapshot.cs index e985b81..5fee0f5 100644 --- a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Migrations/AdminDbContextModelSnapshot.cs +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Migrations/AdminDbContextModelSnapshot.cs @@ -1,5 +1,6 @@ // using System; +using System.Collections.Generic; using KonSoft.Admin.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; @@ -24,6 +25,264 @@ namespace KonSoft.Admin.Migrations NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + modelBuilder.Entity("KonSoft.Admin.Entities.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("numeric"); + + b.Property("CancelReason") + .HasColumnType("text"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("PaidAmount") + .HasColumnType("numeric"); + + b.Property("PaymentMethod") + .IsRequired() + .HasColumnType("text"); + + b.Property("Remark") + .HasColumnType("text"); + + b.Property("ServiceCategoryId") + .HasColumnType("uuid"); + + b.Property("ServiceTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("WorkerId") + .HasColumnType("uuid"); + + b.ComplexProperty>("Address", "KonSoft.Admin.Entities.Order.Address#AddressInfo", b1 => + { + b1.IsRequired(); + + b1.Property("City") + .IsRequired() + .HasColumnType("text"); + + b1.Property("ContactName") + .IsRequired() + .HasColumnType("text"); + + b1.Property("ContactPhone") + .IsRequired() + .HasColumnType("text"); + + b1.Property("DetailAddress") + .IsRequired() + .HasColumnType("text"); + + b1.Property("District") + .IsRequired() + .HasColumnType("text"); + }); + + b.HasKey("Id"); + + b.ToTable("AppOrder", (string)null); + }); + + modelBuilder.Entity("KonSoft.Admin.Entities.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Code") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("Price") + .HasColumnType("numeric"); + + b.Property("Status") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AppProduct", (string)null); + }); + + modelBuilder.Entity("KonSoft.Admin.Entities.ServiceCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(40) + .HasColumnType("character varying(40)") + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnType("uuid") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnType("uuid") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false) + .HasColumnName("IsDeleted"); + + b.Property("LastModificationTime") + .HasColumnType("timestamp without time zone") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnType("uuid") + .HasColumnName("LastModifierId"); + + b.Property("Level") + .HasColumnType("integer"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("Path") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("AppServiceCategory", (string)null); + }); + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") @@ -783,6 +1042,11 @@ namespace KonSoft.Admin.Migrations .HasColumnType("timestamp without time zone") .HasColumnName("DeletionTime"); + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("character varying(21)"); + b.Property("Email") .IsRequired() .HasMaxLength(256) @@ -913,6 +1177,10 @@ namespace KonSoft.Admin.Migrations b.HasIndex("UserName"); b.ToTable("AbpUsers", (string)null); + + b.HasDiscriminator("Discriminator").HasValue("IdentityUser"); + + b.UseTphMappingStrategy(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => @@ -1816,6 +2084,26 @@ namespace KonSoft.Admin.Migrations b.ToTable("AbpTenantConnectionStrings", (string)null); }); + modelBuilder.Entity("KonSoft.Admin.Entities.HouseholdWorker", b => + { + b.HasBaseType("Volo.Abp.Identity.IdentityUser"); + + b.Property("OrderCount") + .HasColumnType("integer"); + + b.Property("Profession") + .IsRequired() + .HasColumnType("text"); + + b.Property("ScopeOfCompetence") + .IsRequired() + .HasColumnType("text"); + + b.ToTable("AbpUsers", (string)null); + + b.HasDiscriminator().HasValue("HouseholdWorker"); + }); + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) diff --git a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Properties/AssemblyInfo.cs b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Properties/AssemblyInfo.cs index 106acb2..288153f 100644 --- a/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Properties/AssemblyInfo.cs +++ b/modules/admin/src/KonSoft.Admin.EntityFrameworkCore/Properties/AssemblyInfo.cs @@ -1,2 +1,3 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.Admin.EntityFrameworkCore.Tests")] + +[assembly: InternalsVisibleToAttribute("KonSoft.Admin.EntityFrameworkCore.Tests")] \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.HttpApi.Client/AdminHttpApiClientModule.cs b/modules/admin/src/KonSoft.Admin.HttpApi.Client/AdminHttpApiClientModule.cs index d97145c..f671a1c 100644 --- a/modules/admin/src/KonSoft.Admin.HttpApi.Client/AdminHttpApiClientModule.cs +++ b/modules/admin/src/KonSoft.Admin.HttpApi.Client/AdminHttpApiClientModule.cs @@ -4,8 +4,8 @@ using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; -using Volo.Abp.TenantManagement; using Volo.Abp.SettingManagement; +using Volo.Abp.TenantManagement; using Volo.Abp.VirtualFileSystem; namespace KonSoft.Admin; @@ -26,8 +26,7 @@ public class AdminHttpApiClientModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddHttpClientProxies( - typeof(AdminApplicationContractsModule).Assembly, - RemoteServiceName + typeof(AdminApplicationContractsModule).Assembly ); Configure(options => @@ -35,4 +34,4 @@ public class AdminHttpApiClientModule : AbpModule options.FileSets.AddEmbedded(); }); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.HttpApi/AdminHttpApiModule.cs b/modules/admin/src/KonSoft.Admin.HttpApi/AdminHttpApiModule.cs index c92618f..6e4d7a4 100644 --- a/modules/admin/src/KonSoft.Admin.HttpApi/AdminHttpApiModule.cs +++ b/modules/admin/src/KonSoft.Admin.HttpApi/AdminHttpApiModule.cs @@ -1,5 +1,5 @@ -using Localization.Resources.AbpUi; -using KonSoft.Admin.Localization; +using KonSoft.Admin.Localization; +using Localization.Resources.AbpUi; using Volo.Abp.Account; using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; @@ -19,7 +19,7 @@ namespace KonSoft.Admin; typeof(AbpTenantManagementHttpApiModule), typeof(AbpFeatureManagementHttpApiModule), typeof(AbpSettingManagementHttpApiModule) - )] +)] public class AdminHttpApiModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) @@ -38,4 +38,4 @@ public class AdminHttpApiModule : AbpModule ); }); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.HttpApi/Controllers/AdminController.cs b/modules/admin/src/KonSoft.Admin.HttpApi/Controllers/AdminController.cs index e1fd158..a586037 100644 --- a/modules/admin/src/KonSoft.Admin.HttpApi/Controllers/AdminController.cs +++ b/modules/admin/src/KonSoft.Admin.HttpApi/Controllers/AdminController.cs @@ -11,4 +11,4 @@ public abstract class AdminController : AbpControllerBase { LocalizationResource = typeof(AdminResource); } -} +} \ No newline at end of file diff --git a/modules/admin/src/KonSoft.Admin.HttpApi/Models/Test/TestModel.cs b/modules/admin/src/KonSoft.Admin.HttpApi/Models/Test/TestModel.cs index 15c0908..5a8a8c1 100644 --- a/modules/admin/src/KonSoft.Admin.HttpApi/Models/Test/TestModel.cs +++ b/modules/admin/src/KonSoft.Admin.HttpApi/Models/Test/TestModel.cs @@ -7,4 +7,4 @@ public class TestModel public string? Name { get; set; } public DateTime BirthDate { get; set; } -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.Application.Tests/AdminApplicationTestBase.cs b/modules/admin/test/KonSoft.Admin.Application.Tests/AdminApplicationTestBase.cs index ea110b2..9674593 100644 --- a/modules/admin/test/KonSoft.Admin.Application.Tests/AdminApplicationTestBase.cs +++ b/modules/admin/test/KonSoft.Admin.Application.Tests/AdminApplicationTestBase.cs @@ -5,5 +5,4 @@ namespace KonSoft.Admin; public abstract class AdminApplicationTestBase : AdminTestBase where TStartupModule : IAbpModule { - -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.Application.Tests/AdminApplicationTestModule.cs b/modules/admin/test/KonSoft.Admin.Application.Tests/AdminApplicationTestModule.cs index 2d1054f..616216e 100644 --- a/modules/admin/test/KonSoft.Admin.Application.Tests/AdminApplicationTestModule.cs +++ b/modules/admin/test/KonSoft.Admin.Application.Tests/AdminApplicationTestModule.cs @@ -8,5 +8,4 @@ namespace KonSoft.Admin; )] public class AdminApplicationTestModule : AbpModule { - -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.Application.Tests/Samples/SampleAppServiceTests.cs b/modules/admin/test/KonSoft.Admin.Application.Tests/Samples/SampleAppServiceTests.cs index 7f3e109..25d5903 100644 --- a/modules/admin/test/KonSoft.Admin.Application.Tests/Samples/SampleAppServiceTests.cs +++ b/modules/admin/test/KonSoft.Admin.Application.Tests/Samples/SampleAppServiceTests.cs @@ -1,5 +1,5 @@ -using Shouldly; -using System.Threading.Tasks; +using System.Threading.Tasks; +using Shouldly; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Xunit; @@ -31,4 +31,4 @@ public abstract class SampleAppServiceTests : AdminApplicationTe result.TotalCount.ShouldBeGreaterThan(0); result.Items.ShouldContain(u => u.UserName == "admin"); } -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.Domain.Tests/AdminDomainTestBase.cs b/modules/admin/test/KonSoft.Admin.Domain.Tests/AdminDomainTestBase.cs index 1a88fce..1b2d8ba 100644 --- a/modules/admin/test/KonSoft.Admin.Domain.Tests/AdminDomainTestBase.cs +++ b/modules/admin/test/KonSoft.Admin.Domain.Tests/AdminDomainTestBase.cs @@ -6,5 +6,4 @@ namespace KonSoft.Admin; public abstract class AdminDomainTestBase : AdminTestBase where TStartupModule : IAbpModule { - -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.Domain.Tests/AdminDomainTestModule.cs b/modules/admin/test/KonSoft.Admin.Domain.Tests/AdminDomainTestModule.cs index 35e8eb5..a58ee63 100644 --- a/modules/admin/test/KonSoft.Admin.Domain.Tests/AdminDomainTestModule.cs +++ b/modules/admin/test/KonSoft.Admin.Domain.Tests/AdminDomainTestModule.cs @@ -8,5 +8,4 @@ namespace KonSoft.Admin; )] public class AdminDomainTestModule : AbpModule { - -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.Domain.Tests/Samples/SampleDomainTests.cs b/modules/admin/test/KonSoft.Admin.Domain.Tests/Samples/SampleDomainTests.cs index 094ffc0..1f8df08 100644 --- a/modules/admin/test/KonSoft.Admin.Domain.Tests/Samples/SampleDomainTests.cs +++ b/modules/admin/test/KonSoft.Admin.Domain.Tests/Samples/SampleDomainTests.cs @@ -14,8 +14,8 @@ namespace KonSoft.Admin.Samples; public abstract class SampleDomainTests : AdminDomainTestBase where TStartupModule : IAbpModule { - private readonly IIdentityUserRepository _identityUserRepository; private readonly IdentityUserManager _identityUserManager; + private readonly IIdentityUserRepository _identityUserRepository; protected SampleDomainTests() { @@ -43,4 +43,4 @@ public abstract class SampleDomainTests : AdminDomainTestBase { - -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreCollectionFixtureBase.cs b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreCollectionFixtureBase.cs index 5e02704..8c8bb76 100644 --- a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreCollectionFixtureBase.cs +++ b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreCollectionFixtureBase.cs @@ -1,9 +1,7 @@ -using KonSoft.Admin.EntityFrameworkCore; -using Xunit; +using Xunit; namespace KonSoft.Admin.EntityFrameworkCore; public class AdminEntityFrameworkCoreCollectionFixtureBase : ICollectionFixture { - -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreFixture.cs b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreFixture.cs index 920d586..994639b 100644 --- a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreFixture.cs +++ b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreFixture.cs @@ -6,6 +6,5 @@ public class AdminEntityFrameworkCoreFixture : IDisposable { public void Dispose() { - } -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreTestBase.cs b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreTestBase.cs index 36c1c35..3fa5a26 100644 --- a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreTestBase.cs +++ b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreTestBase.cs @@ -1,8 +1,5 @@ -using Volo.Abp; - -namespace KonSoft.Admin.EntityFrameworkCore; +namespace KonSoft.Admin.EntityFrameworkCore; public abstract class AdminEntityFrameworkCoreTestBase : AdminTestBase { - -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreTestModule.cs b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreTestModule.cs index a98eee4..948b8ad 100644 --- a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreTestModule.cs +++ b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/AdminEntityFrameworkCoreTestModule.cs @@ -18,7 +18,7 @@ namespace KonSoft.Admin.EntityFrameworkCore; typeof(AdminApplicationTestModule), typeof(AdminEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqliteModule) - )] +)] public class AdminEntityFrameworkCoreTestModule : AbpModule { private SqliteConnection? _sqliteConnection; @@ -51,10 +51,7 @@ public class AdminEntityFrameworkCoreTestModule : AbpModule services.Configure(options => { - options.Configure(context => - { - context.DbContextOptions.UseSqlite(_sqliteConnection); - }); + options.Configure(context => { context.DbContextOptions.UseSqlite(_sqliteConnection); }); }); } @@ -79,4 +76,4 @@ public class AdminEntityFrameworkCoreTestModule : AbpModule return connection; } -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs index 10298f2..9271ffe 100644 --- a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs +++ b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs @@ -6,5 +6,4 @@ namespace KonSoft.Admin.EntityFrameworkCore.Applications; [Collection(AdminTestConsts.CollectionDefinitionName)] public class EfCoreSampleAppServiceTests : SampleAppServiceTests { - -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs index a5eb518..53f6088 100644 --- a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs +++ b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs @@ -6,5 +6,4 @@ namespace KonSoft.Admin.EntityFrameworkCore.Domains; [Collection(AdminTestConsts.CollectionDefinitionName)] public class EfCoreSampleDomainTests : SampleDomainTests { - -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs index 1d6ee8e..207f860 100644 --- a/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs +++ b/modules/admin/test/KonSoft.Admin.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs @@ -1,8 +1,8 @@ -using Microsoft.EntityFrameworkCore; -using Shouldly; -using System; +using System; using System.Linq; using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Shouldly; using Volo.Abp.Domain.Repositories; using Volo.Abp.Identity; using Xunit; @@ -32,13 +32,13 @@ public class SampleRepositoryTests : AdminEntityFrameworkCoreTestBase */ await WithUnitOfWorkAsync(async () => { - //Act - var adminUser = await (await _appUserRepository.GetQueryableAsync()) + //Act + var adminUser = await (await _appUserRepository.GetQueryableAsync()) .Where(u => u.UserName == "admin") .FirstOrDefaultAsync(); - //Assert - adminUser.ShouldNotBeNull(); + //Assert + adminUser.ShouldNotBeNull(); }); } -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/AdminConsoleApiClientModule.cs b/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/AdminConsoleApiClientModule.cs index 7f3049c..9d49f28 100644 --- a/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/AdminConsoleApiClientModule.cs +++ b/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/AdminConsoleApiClientModule.cs @@ -12,7 +12,7 @@ namespace KonSoft.Admin.HttpApi.Client.ConsoleTestApp; typeof(AbpAutofacModule), typeof(AdminHttpApiClientModule), typeof(AbpHttpClientIdentityModelModule) - )] +)] public class AdminConsoleApiClientModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -21,10 +21,10 @@ public class AdminConsoleApiClientModule : AbpModule { options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) => { - clientBuilder.AddTransientHttpErrorPolicy( - policyBuilder => policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) + clientBuilder.AddTransientHttpErrorPolicy(policyBuilder => + policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) ); }); }); } -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs index b50730a..aa255b2 100644 --- a/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs +++ b/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs @@ -22,4 +22,4 @@ public class ClientDemoService : ITransientDependency Console.WriteLine($"Name : {output.Name}"); Console.WriteLine($"Surname : {output.Surname}"); } -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs index 2753a32..9c902e9 100644 --- a/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs +++ b/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -1,8 +1,8 @@ -using Microsoft.Extensions.Hosting; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Volo.Abp; namespace KonSoft.Admin.HttpApi.Client.ConsoleTestApp; @@ -19,10 +19,10 @@ public class ConsoleTestAppHostedService : IHostedService public async Task StartAsync(CancellationToken cancellationToken) { using (var application = await AbpApplicationFactory.CreateAsync(options => - { - options.Services.ReplaceConfiguration(_configuration); - options.UseAutofac(); - })) + { + options.Services.ReplaceConfiguration(_configuration); + options.UseAutofac(); + })) { await application.InitializeAsync(); @@ -37,4 +37,4 @@ public class ConsoleTestAppHostedService : IHostedService { return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/Program.cs b/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/Program.cs index a163537..6d93a8f 100644 --- a/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/modules/admin/test/KonSoft.Admin.HttpApi.Client.ConsoleTestApp/Program.cs @@ -1,22 +1,23 @@ using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace KonSoft.Admin.HttpApi.Client.ConsoleTestApp; -class Program +internal class Program { - static async Task Main(string[] args) + private static async Task Main(string[] args) { await CreateHostBuilder(args).RunConsoleAsync(); } - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) + public static IHostBuilder CreateHostBuilder(string[] args) + { + return Host.CreateDefaultBuilder(args) .AddAppSettingsSecretsJson() .ConfigureServices((hostContext, services) => { services.AddHostedService(); }); -} + } +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.TestBase/AdminTestBase.cs b/modules/admin/test/KonSoft.Admin.TestBase/AdminTestBase.cs index 148d2a6..0c1e535 100644 --- a/modules/admin/test/KonSoft.Admin.TestBase/AdminTestBase.cs +++ b/modules/admin/test/KonSoft.Admin.TestBase/AdminTestBase.cs @@ -3,8 +3,8 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Modularity; -using Volo.Abp.Uow; using Volo.Abp.Testing; +using Volo.Abp.Uow; namespace KonSoft.Admin; @@ -43,7 +43,8 @@ public abstract class AdminTestBase : AbpIntegratedTest WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func> func) + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, + Func> func) { using (var scope = ServiceProvider.CreateScope()) { @@ -57,4 +58,4 @@ public abstract class AdminTestBase : AbpIntegratedTest(options => - { - options.IsJobExecutionEnabled = false; - }); + Configure(options => { options.IsJobExecutionEnabled = false; }); context.Services.AddAlwaysAllowAuthorization(); } @@ -44,4 +41,4 @@ public class AdminTestBaseModule : AbpModule } }); } -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.TestBase/AdminTestConsts.cs b/modules/admin/test/KonSoft.Admin.TestBase/AdminTestConsts.cs index a8cd415..906e01f 100644 --- a/modules/admin/test/KonSoft.Admin.TestBase/AdminTestConsts.cs +++ b/modules/admin/test/KonSoft.Admin.TestBase/AdminTestConsts.cs @@ -3,4 +3,4 @@ public static class AdminTestConsts { public const string CollectionDefinitionName = "Admin collection"; -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.TestBase/AdminTestDataSeedContributor.cs b/modules/admin/test/KonSoft.Admin.TestBase/AdminTestDataSeedContributor.cs index 5aad1ca..fa57c79 100644 --- a/modules/admin/test/KonSoft.Admin.TestBase/AdminTestDataSeedContributor.cs +++ b/modules/admin/test/KonSoft.Admin.TestBase/AdminTestDataSeedContributor.cs @@ -12,4 +12,4 @@ public class AdminTestDataSeedContributor : IDataSeedContributor, ITransientDepe return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/admin/test/KonSoft.Admin.TestBase/Security/FakeCurrentPrincipalAccessor.cs b/modules/admin/test/KonSoft.Admin.TestBase/Security/FakeCurrentPrincipalAccessor.cs index fd9de28..d2bda1c 100644 --- a/modules/admin/test/KonSoft.Admin.TestBase/Security/FakeCurrentPrincipalAccessor.cs +++ b/modules/admin/test/KonSoft.Admin.TestBase/Security/FakeCurrentPrincipalAccessor.cs @@ -17,9 +17,9 @@ public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor { return new ClaimsPrincipal(new ClaimsIdentity(new List { - new Claim(AbpClaimTypes.UserId, "2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), - new Claim(AbpClaimTypes.UserName, "admin"), - new Claim(AbpClaimTypes.Email, "admin@abp.io") + new(AbpClaimTypes.UserId, "2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), + new(AbpClaimTypes.UserName, "admin"), + new(AbpClaimTypes.Email, "admin@abp.io") })); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/DispatchApplicationContractsModule.cs b/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/DispatchApplicationContractsModule.cs index 4742494..08c05e5 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/DispatchApplicationContractsModule.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/DispatchApplicationContractsModule.cs @@ -25,4 +25,4 @@ public class DispatchApplicationContractsModule : AbpModule { DispatchDtoExtensions.Configure(); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/DispatchDtoExtensions.cs b/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/DispatchDtoExtensions.cs index 6af0031..4f5eea3 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/DispatchDtoExtensions.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/DispatchDtoExtensions.cs @@ -1,28 +1,26 @@ -using Volo.Abp.Identity; -using Volo.Abp.ObjectExtending; -using Volo.Abp.Threading; +using Volo.Abp.Threading; namespace KonSoft.Dispatch; public static class DispatchDtoExtensions { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { OneTimeRunner.Run(() => { - /* You can add extension properties to DTOs - * defined in the depended modules. - * - * Example: - * - * ObjectExtensionManager.Instance - * .AddOrUpdateProperty("Title"); - * - * See the documentation for more: - * https://docs.abp.io/en/abp/latest/Object-Extensions - */ + /* You can add extension properties to DTOs + * defined in the depended modules. + * + * Example: + * + * ObjectExtensionManager.Instance + * .AddOrUpdateProperty("Title"); + * + * See the documentation for more: + * https://docs.abp.io/en/abp/latest/Object-Extensions + */ }); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/Permissions/DispatchPermissionDefinitionProvider.cs b/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/Permissions/DispatchPermissionDefinitionProvider.cs index bd90841..a83d59f 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/Permissions/DispatchPermissionDefinitionProvider.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/Permissions/DispatchPermissionDefinitionProvider.cs @@ -17,4 +17,4 @@ public class DispatchPermissionDefinitionProvider : PermissionDefinitionProvider { return LocalizableString.Create(name); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/Permissions/DispatchPermissions.cs b/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/Permissions/DispatchPermissions.cs index 95d2818..aa763cc 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/Permissions/DispatchPermissions.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Application.Contracts/Permissions/DispatchPermissions.cs @@ -6,4 +6,4 @@ public static class DispatchPermissions //Add your own permission names. Example: //public const string MyPermission1 = GroupName + ".MyPermission1"; -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Application/DispatchAppService.cs b/modules/dispatch/src/KonSoft.Dispatch.Application/DispatchAppService.cs index b0edd14..952464f 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Application/DispatchAppService.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Application/DispatchAppService.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using KonSoft.Dispatch.Localization; +using KonSoft.Dispatch.Localization; using Volo.Abp.Application.Services; namespace KonSoft.Dispatch; @@ -14,4 +11,4 @@ public abstract class DispatchAppService : ApplicationService { LocalizationResource = typeof(DispatchResource); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Application/DispatchApplicationAutoMapperProfile.cs b/modules/dispatch/src/KonSoft.Dispatch.Application/DispatchApplicationAutoMapperProfile.cs index 6b7db35..7e263d6 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Application/DispatchApplicationAutoMapperProfile.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Application/DispatchApplicationAutoMapperProfile.cs @@ -4,10 +4,4 @@ namespace KonSoft.Dispatch; public class DispatchApplicationAutoMapperProfile : Profile { - public DispatchApplicationAutoMapperProfile() - { - /* You can configure your AutoMapper mapping configuration here. - * Alternatively, you can split your mapping configurations - * into multiple profile classes for a better organization. */ - } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Application/DispatchApplicationModule.cs b/modules/dispatch/src/KonSoft.Dispatch.Application/DispatchApplicationModule.cs index 17607d9..62564fe 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Application/DispatchApplicationModule.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Application/DispatchApplicationModule.cs @@ -18,14 +18,11 @@ namespace KonSoft.Dispatch; typeof(AbpTenantManagementApplicationModule), typeof(AbpFeatureManagementApplicationModule), typeof(AbpSettingManagementApplicationModule) - )] +)] public class DispatchApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => - { - options.AddMaps(); - }); + Configure(options => { options.AddMaps(); }); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Application/Properties/AssemblyInfo.cs b/modules/dispatch/src/KonSoft.Dispatch.Application/Properties/AssemblyInfo.cs index 3aec15b..16348ef 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Application/Properties/AssemblyInfo.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Application/Properties/AssemblyInfo.cs @@ -1,2 +1,3 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.Dispatch.Application.Tests")] + +[assembly: InternalsVisibleToAttribute("KonSoft.Dispatch.Application.Tests")] \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchDomainErrorCodes.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchDomainErrorCodes.cs index 5674d61..117a7cd 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchDomainErrorCodes.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchDomainErrorCodes.cs @@ -3,4 +3,4 @@ public static class DispatchDomainErrorCodes { /* You can add your business exception error codes here, as constants */ -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchDomainSharedModule.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchDomainSharedModule.cs index 22f9225..a8e140a 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchDomainSharedModule.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchDomainSharedModule.cs @@ -23,8 +23,8 @@ namespace KonSoft.Dispatch; typeof(AbpOpenIddictDomainSharedModule), typeof(AbpPermissionManagementDomainSharedModule), typeof(AbpSettingManagementDomainSharedModule), - typeof(AbpTenantManagementDomainSharedModule) - )] + typeof(AbpTenantManagementDomainSharedModule) +)] public class DispatchDomainSharedModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -55,4 +55,4 @@ public class DispatchDomainSharedModule : AbpModule options.MapCodeNamespace("Dispatch", typeof(DispatchResource)); }); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchGlobalFeatureConfigurator.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchGlobalFeatureConfigurator.cs index fed3907..afcd085 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchGlobalFeatureConfigurator.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchGlobalFeatureConfigurator.cs @@ -4,19 +4,19 @@ namespace KonSoft.Dispatch; public static class DispatchGlobalFeatureConfigurator { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { OneTimeRunner.Run(() => { - /* You can configure (enable/disable) global features of the used modules here. - * - * YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! - * - * Please refer to the documentation to lear more about the Global Features System: - * https://docs.abp.io/en/abp/latest/Global-Features - */ + /* You can configure (enable/disable) global features of the used modules here. + * + * YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! + * + * Please refer to the documentation to lear more about the Global Features System: + * https://docs.abp.io/en/abp/latest/Global-Features + */ }); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchModuleExtensionConfigurator.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchModuleExtensionConfigurator.cs index 7dc6572..650158d 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchModuleExtensionConfigurator.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/DispatchModuleExtensionConfigurator.cs @@ -1,13 +1,10 @@ -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Identity; -using Volo.Abp.ObjectExtending; -using Volo.Abp.Threading; +using Volo.Abp.Threading; namespace KonSoft.Dispatch; public static class DispatchModuleExtensionConfigurator { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { @@ -57,7 +54,7 @@ public static class DispatchModuleExtensionConfigurator //validation rules property.Attributes.Add(new RequiredAttribute()); property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4}); - + property.Configuration[IdentityModuleExtensionConsts.ConfigurationNames.AllowUserToEdit] = true; //...other configurations for this property @@ -70,4 +67,4 @@ public static class DispatchModuleExtensionConfigurator * https://docs.abp.io/en/abp/latest/Module-Entity-Extensions */ } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/Localization/DispatchResource.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/Localization/DispatchResource.cs index fc03359..0c39e6e 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/Localization/DispatchResource.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/Localization/DispatchResource.cs @@ -5,5 +5,4 @@ namespace KonSoft.Dispatch.Localization; [LocalizationResourceName("Dispatch")] public class DispatchResource { - -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs index 7fb6333..2898f44 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs @@ -7,4 +7,4 @@ public static class MultiTenancyConsts * related modules and code parts, including this file. */ public const bool IsEnabled = true; -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain/Data/DispatchDbMigrationService.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain/Data/DispatchDbMigrationService.cs index 11680bc..035629f 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain/Data/DispatchDbMigrationService.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain/Data/DispatchDbMigrationService.cs @@ -17,12 +17,11 @@ namespace KonSoft.Dispatch.Data; public class DispatchDbMigrationService : ITransientDependency { - public ILogger Logger { get; set; } + private readonly ICurrentTenant _currentTenant; private readonly IDataSeeder _dataSeeder; private readonly IEnumerable _dbSchemaMigrators; private readonly ITenantRepository _tenantRepository; - private readonly ICurrentTenant _currentTenant; public DispatchDbMigrationService( IDataSeeder dataSeeder, @@ -38,6 +37,8 @@ public class DispatchDbMigrationService : ITransientDependency Logger = NullLogger.Instance; } + public ILogger Logger { get; set; } + public async Task MigrateAsync() { var initialMigrationAdded = AddInitialMigrationIfNotExist(); @@ -52,7 +53,7 @@ public class DispatchDbMigrationService : ITransientDependency await MigrateDatabaseSchemaAsync(); await SeedDataAsync(); - Logger.LogInformation($"Successfully completed host database migrations."); + Logger.LogInformation("Successfully completed host database migrations."); var tenants = await _tenantRepository.GetListAsync(includeDetails: true); @@ -101,8 +102,10 @@ public class DispatchDbMigrationService : ITransientDependency Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed..."); await _dataSeeder.SeedAsync(new DataSeedContext(tenant?.Id) - .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, IdentityDataSeedContributor.AdminEmailDefaultValue) - .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, IdentityDataSeedContributor.AdminPasswordDefaultValue) + .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, + IdentityDataSeedContributor.AdminEmailDefaultValue) + .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, + IdentityDataSeedContributor.AdminPasswordDefaultValue) ); } @@ -127,10 +130,8 @@ public class DispatchDbMigrationService : ITransientDependency AddInitialMigration(); return true; } - else - { - return false; - } + + return false; } catch (Exception e) { @@ -149,7 +150,8 @@ public class DispatchDbMigrationService : ITransientDependency private bool MigrationsFolderExists() { var dbMigrationsProjectFolder = GetEntityFrameworkCoreProjectFolderPath(); - return dbMigrationsProjectFolder != null && Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations")); + return dbMigrationsProjectFolder != null && + Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations")); } private void AddInitialMigration() @@ -207,7 +209,8 @@ public class DispatchDbMigrationService : ITransientDependency { currentDirectory = Directory.GetParent(currentDirectory.FullName); - if (currentDirectory != null && Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) + if (currentDirectory != null && + Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) { return currentDirectory.FullName; } @@ -215,4 +218,4 @@ public class DispatchDbMigrationService : ITransientDependency return null; } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain/Data/IDispatchDbSchemaMigrator.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain/Data/IDispatchDbSchemaMigrator.cs index e161870..611cc77 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain/Data/IDispatchDbSchemaMigrator.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain/Data/IDispatchDbSchemaMigrator.cs @@ -5,4 +5,4 @@ namespace KonSoft.Dispatch.Data; public interface IDispatchDbSchemaMigrator { Task MigrateAsync(); -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain/Data/NullDispatchDbSchemaMigrator.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain/Data/NullDispatchDbSchemaMigrator.cs index cd2f4c2..491e394 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain/Data/NullDispatchDbSchemaMigrator.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain/Data/NullDispatchDbSchemaMigrator.cs @@ -12,4 +12,4 @@ public class NullDispatchDbSchemaMigrator : IDispatchDbSchemaMigrator, ITransien { return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain/DispatchConsts.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain/DispatchConsts.cs index e886226..18f42f8 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain/DispatchConsts.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain/DispatchConsts.cs @@ -5,4 +5,4 @@ public static class DispatchConsts public const string DbTablePrefix = "App"; public const string DbSchema = null; -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain/DispatchDomainModule.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain/DispatchDomainModule.cs index edd9075..86b129a 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain/DispatchDomainModule.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain/DispatchDomainModule.cs @@ -1,6 +1,6 @@ -using Microsoft.Extensions.DependencyInjection; +using KonSoft.Dispatch.MultiTenancy; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using KonSoft.Dispatch.MultiTenancy; using Volo.Abp.AuditLogging; using Volo.Abp.BackgroundJobs; using Volo.Abp.Emailing; @@ -56,13 +56,10 @@ public class DispatchDomainModule : AbpModule options.Languages.Add(new LanguageInfo("es", "es", "Español")); }); - Configure(options => - { - options.IsEnabled = MultiTenancyConsts.IsEnabled; - }); + Configure(options => { options.IsEnabled = MultiTenancyConsts.IsEnabled; }); #if DEBUG context.Services.Replace(ServiceDescriptor.Singleton()); #endif } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain/OpenIddict/OpenIddictDataSeedContributor.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain/OpenIddict/OpenIddictDataSeedContributor.cs index 883ebef..50339a6 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain/OpenIddict/OpenIddictDataSeedContributor.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain/OpenIddict/OpenIddictDataSeedContributor.cs @@ -23,12 +23,12 @@ namespace KonSoft.Dispatch.OpenIddict; */ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDependency { + private readonly IAbpApplicationManager _applicationManager; private readonly IConfiguration _configuration; private readonly IOpenIddictApplicationRepository _openIddictApplicationRepository; - private readonly IAbpApplicationManager _applicationManager; private readonly IOpenIddictScopeRepository _openIddictScopeRepository; - private readonly IOpenIddictScopeManager _scopeManager; private readonly IPermissionDataSeeder _permissionDataSeeder; + private readonly IOpenIddictScopeManager _scopeManager; private readonly IStringLocalizer L; public OpenIddictDataSeedContributor( @@ -38,7 +38,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep IOpenIddictScopeRepository openIddictScopeRepository, IOpenIddictScopeManager scopeManager, IPermissionDataSeeder permissionDataSeeder, - IStringLocalizer l ) + IStringLocalizer l) { _configuration = configuration; _openIddictApplicationRepository = openIddictApplicationRepository; @@ -60,7 +60,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep { if (await _openIddictScopeRepository.FindByNameAsync("Dispatch") == null) { - await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor { + await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor + { Name = "Dispatch", DisplayName = "Dispatch API", Resources = { "Dispatch" } }); } @@ -68,7 +69,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep private async Task CreateApplicationsAsync() { - var commonScopes = new List { + var commonScopes = new List + { OpenIddictConstants.Permissions.Scopes.Address, OpenIddictConstants.Permissions.Scopes.Email, OpenIddictConstants.Permissions.Scopes.Phone, @@ -80,10 +82,6 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var configurationSection = _configuration.GetSection("OpenIddict:Applications"); - - - - // Swagger Client var swaggerClientId = configurationSection["Dispatch_Swagger:ClientId"]; if (!swaggerClientId.IsNullOrWhiteSpace()) @@ -91,13 +89,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var swaggerRootUrl = configurationSection["Dispatch_Swagger:RootUrl"]?.TrimEnd('/'); await CreateApplicationAsync( - name: swaggerClientId!, - type: OpenIddictConstants.ClientTypes.Public, - consentType: OpenIddictConstants.ConsentTypes.Implicit, - displayName: "Swagger Application", - secret: null, - grantTypes: [OpenIddictConstants.GrantTypes.AuthorizationCode], - scopes: commonScopes, + swaggerClientId!, + OpenIddictConstants.ClientTypes.Public, + OpenIddictConstants.ConsentTypes.Implicit, + "Swagger Application", + null, + [OpenIddictConstants.GrantTypes.AuthorizationCode], + commonScopes, redirectUri: $"{swaggerRootUrl}/swagger/oauth2-redirect.html", clientUri: swaggerRootUrl ); @@ -131,13 +129,14 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var client = await _openIddictApplicationRepository.FindByClientIdAsync(name); - var application = new AbpApplicationDescriptor { + var application = new AbpApplicationDescriptor + { ClientId = name, ClientType = type, ClientSecret = secret, ConsentType = consentType, DisplayName = displayName, - ClientUri = clientUri, + ClientUri = clientUri }; Check.NotNullOrEmpty(grantTypes, nameof(grantTypes)); @@ -160,7 +159,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Logout); } - var buildInGrantTypes = new[] { + var buildInGrantTypes = new[] + { OpenIddictConstants.GrantTypes.Implicit, OpenIddictConstants.GrantTypes.Password, OpenIddictConstants.GrantTypes.AuthorizationCode, OpenIddictConstants.GrantTypes.ClientCredentials, OpenIddictConstants.GrantTypes.DeviceCode, OpenIddictConstants.GrantTypes.RefreshToken @@ -233,7 +233,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep } } - var buildInScopes = new[] { + var buildInScopes = new[] + { OpenIddictConstants.Permissions.Scopes.Address, OpenIddictConstants.Permissions.Scopes.Email, OpenIddictConstants.Permissions.Scopes.Phone, OpenIddictConstants.Permissions.Scopes.Profile, OpenIddictConstants.Permissions.Scopes.Roles @@ -289,8 +290,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep await _permissionDataSeeder.SeedAsync( ClientPermissionValueProvider.ProviderName, name, - permissions, - null + permissions ); } @@ -302,8 +302,10 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep if (!HasSameRedirectUris(client, application)) { - client.RedirectUris = JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); - client.PostLogoutRedirectUris = JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/'))); + client.RedirectUris = + JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); + client.PostLogoutRedirectUris = + JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/'))); await _applicationManager.UpdateAsync(client.ToModel()); } @@ -317,11 +319,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep private bool HasSameRedirectUris(OpenIddictApplication existingClient, AbpApplicationDescriptor application) { - return existingClient.RedirectUris == JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); + return existingClient.RedirectUris == + JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); } private bool HasSameScopes(OpenIddictApplication existingClient, AbpApplicationDescriptor application) { - return existingClient.Permissions == JsonSerializer.Serialize(application.Permissions.Select(q => q.ToString().TrimEnd('/'))); + return existingClient.Permissions == + JsonSerializer.Serialize(application.Permissions.Select(q => q.ToString().TrimEnd('/'))); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain/Properties/AssemblyInfo.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain/Properties/AssemblyInfo.cs index 62d174d..73221f1 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain/Properties/AssemblyInfo.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain/Properties/AssemblyInfo.cs @@ -1,3 +1,4 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.Dispatch.Domain.Tests")] -[assembly:InternalsVisibleToAttribute("KonSoft.Dispatch.TestBase")] + +[assembly: InternalsVisibleToAttribute("KonSoft.Dispatch.Domain.Tests")] +[assembly: InternalsVisibleToAttribute("KonSoft.Dispatch.TestBase")] \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain/Settings/DispatchSettingDefinitionProvider.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain/Settings/DispatchSettingDefinitionProvider.cs index a90d428..286ce90 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain/Settings/DispatchSettingDefinitionProvider.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain/Settings/DispatchSettingDefinitionProvider.cs @@ -9,4 +9,4 @@ public class DispatchSettingDefinitionProvider : SettingDefinitionProvider //Define your own settings here. Example: //context.Add(new SettingDefinition(DispatchSettings.MySetting1)); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.Domain/Settings/DispatchSettings.cs b/modules/dispatch/src/KonSoft.Dispatch.Domain/Settings/DispatchSettings.cs index 606a2b9..d6187c1 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.Domain/Settings/DispatchSettings.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.Domain/Settings/DispatchSettings.cs @@ -6,4 +6,4 @@ public static class DispatchSettings //Add your own setting names here. Example: //public const string MySetting1 = Prefix + ".MySetting1"; -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/DispatchDbContext.cs b/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/DispatchDbContext.cs index 857a29c..b771001 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/DispatchDbContext.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/DispatchDbContext.cs @@ -23,40 +23,9 @@ public class DispatchDbContext : IIdentityDbContext, ITenantManagementDbContext { - /* Add DbSet properties for your Aggregate Roots / Entities here. */ - - #region Entities from the modules - - /* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext - * and replaced them for this DbContext. This allows you to perform JOIN - * queries for the entities of these modules over the repositories easily. You - * typically don't need that for other modules. But, if you need, you can - * implement the DbContext interface of the needed module and use ReplaceDbContext - * attribute just like IIdentityDbContext and ITenantManagementDbContext. - * - * More info: Replacing a DbContext of a module ensures that the related module - * uses this DbContext on runtime. Otherwise, it will use its own DbContext class. - */ - - //Identity - public DbSet Users { get; set; } - public DbSet Roles { get; set; } - public DbSet ClaimTypes { get; set; } - public DbSet OrganizationUnits { get; set; } - public DbSet SecurityLogs { get; set; } - public DbSet LinkUsers { get; set; } - public DbSet UserDelegations { get; set; } - public DbSet Sessions { get; set; } - // Tenant Management - public DbSet Tenants { get; set; } - public DbSet TenantConnectionStrings { get; set; } - - #endregion - public DispatchDbContext(DbContextOptions options) : base(options) { - } protected override void OnModelCreating(ModelBuilder builder) @@ -83,4 +52,35 @@ public class DispatchDbContext : // //... //}); } -} + /* Add DbSet properties for your Aggregate Roots / Entities here. */ + + #region Entities from the modules + + /* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext + * and replaced them for this DbContext. This allows you to perform JOIN + * queries for the entities of these modules over the repositories easily. You + * typically don't need that for other modules. But, if you need, you can + * implement the DbContext interface of the needed module and use ReplaceDbContext + * attribute just like IIdentityDbContext and ITenantManagementDbContext. + * + * More info: Replacing a DbContext of a module ensures that the related module + * uses this DbContext on runtime. Otherwise, it will use its own DbContext class. + */ + + //Identity + public DbSet Users { get; set; } + public DbSet Roles { get; set; } + public DbSet ClaimTypes { get; set; } + public DbSet OrganizationUnits { get; set; } + public DbSet SecurityLogs { get; set; } + public DbSet LinkUsers { get; set; } + public DbSet UserDelegations { get; set; } + + public DbSet Sessions { get; set; } + + // Tenant Management + public DbSet Tenants { get; set; } + public DbSet TenantConnectionStrings { get; set; } + + #endregion +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/DispatchDbContextFactory.cs b/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/DispatchDbContextFactory.cs index 83440e2..7af2f5c 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/DispatchDbContextFactory.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/DispatchDbContextFactory.cs @@ -29,8 +29,8 @@ public class DispatchDbContextFactory : IDesignTimeDbContextFactory { - /* You can configure extra properties for the - * entities defined in the modules used by your application. - * - * This class can be used to map these extra properties to table fields in the database. - * - * USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING. - * USE DispatchModuleExtensionConfigurator CLASS (in the Domain.Shared project) - * FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES - * - * Example: Map a property to a table field: + /* You can configure extra properties for the + * entities defined in the modules used by your application. + * + * This class can be used to map these extra properties to table fields in the database. + * + * USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING. + * USE DispatchModuleExtensionConfigurator CLASS (in the Domain.Shared project) + * FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES + * + * Example: Map a property to a table field: - ObjectExtensionManager.Instance - .MapEfCoreProperty( - "MyProperty", - (entityBuilder, propertyBuilder) => - { - propertyBuilder.HasMaxLength(128); - } - ); + ObjectExtensionManager.Instance + .MapEfCoreProperty( + "MyProperty", + (entityBuilder, propertyBuilder) => + { + propertyBuilder.HasMaxLength(128); + } + ); - * See the documentation for more: - * https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities - */ + * See the documentation for more: + * https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities + */ }); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/DispatchEntityFrameworkCoreModule.cs b/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/DispatchEntityFrameworkCoreModule.cs index 788dca1..0656668 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/DispatchEntityFrameworkCoreModule.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/DispatchEntityFrameworkCoreModule.cs @@ -1,6 +1,5 @@ using System; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Uow; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; @@ -26,7 +25,7 @@ namespace KonSoft.Dispatch.EntityFrameworkCore; typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule) - )] +)] public class DispatchEntityFrameworkCoreModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -41,17 +40,16 @@ public class DispatchEntityFrameworkCoreModule : AbpModule { context.Services.AddAbpDbContext(options => { - /* Remove "includeAllEntities: true" to create - * default repositories only for aggregate roots */ - options.AddDefaultRepositories(includeAllEntities: true); + /* Remove "includeAllEntities: true" to create + * default repositories only for aggregate roots */ + options.AddDefaultRepositories(true); }); Configure(options => { - /* The main point to change your DBMS. - * See also DispatchMigrationsDbContextFactory for EF Core tooling. */ + /* The main point to change your DBMS. + * See also DispatchMigrationsDbContextFactory for EF Core tooling. */ options.UseNpgsql(); }); - } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreDispatchDbSchemaMigrator.cs b/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreDispatchDbSchemaMigrator.cs index 6475cdb..fb325b4 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreDispatchDbSchemaMigrator.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreDispatchDbSchemaMigrator.cs @@ -1,8 +1,8 @@ using System; using System.Threading.Tasks; +using KonSoft.Dispatch.Data; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using KonSoft.Dispatch.Data; using Volo.Abp.DependencyInjection; namespace KonSoft.Dispatch.EntityFrameworkCore; @@ -31,4 +31,4 @@ public class EntityFrameworkCoreDispatchDbSchemaMigrator .Database .MigrateAsync(); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/Properties/AssemblyInfo.cs b/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/Properties/AssemblyInfo.cs index b9f7b48..c3070e1 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/Properties/AssemblyInfo.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.EntityFrameworkCore/Properties/AssemblyInfo.cs @@ -1,2 +1,3 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.Dispatch.EntityFrameworkCore.Tests")] + +[assembly: InternalsVisibleToAttribute("KonSoft.Dispatch.EntityFrameworkCore.Tests")] \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.HttpApi.Client/DispatchHttpApiClientModule.cs b/modules/dispatch/src/KonSoft.Dispatch.HttpApi.Client/DispatchHttpApiClientModule.cs index f91692b..d69946d 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.HttpApi.Client/DispatchHttpApiClientModule.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.HttpApi.Client/DispatchHttpApiClientModule.cs @@ -4,8 +4,8 @@ using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; -using Volo.Abp.TenantManagement; using Volo.Abp.SettingManagement; +using Volo.Abp.TenantManagement; using Volo.Abp.VirtualFileSystem; namespace KonSoft.Dispatch; @@ -26,8 +26,7 @@ public class DispatchHttpApiClientModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddHttpClientProxies( - typeof(DispatchApplicationContractsModule).Assembly, - RemoteServiceName + typeof(DispatchApplicationContractsModule).Assembly ); Configure(options => @@ -35,4 +34,4 @@ public class DispatchHttpApiClientModule : AbpModule options.FileSets.AddEmbedded(); }); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.HttpApi/Controllers/DispatchController.cs b/modules/dispatch/src/KonSoft.Dispatch.HttpApi/Controllers/DispatchController.cs index a1cea3d..ac38c96 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.HttpApi/Controllers/DispatchController.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.HttpApi/Controllers/DispatchController.cs @@ -11,4 +11,4 @@ public abstract class DispatchController : AbpControllerBase { LocalizationResource = typeof(DispatchResource); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.HttpApi/DispatchHttpApiModule.cs b/modules/dispatch/src/KonSoft.Dispatch.HttpApi/DispatchHttpApiModule.cs index c5bf83b..e647305 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.HttpApi/DispatchHttpApiModule.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.HttpApi/DispatchHttpApiModule.cs @@ -1,5 +1,5 @@ -using Localization.Resources.AbpUi; -using KonSoft.Dispatch.Localization; +using KonSoft.Dispatch.Localization; +using Localization.Resources.AbpUi; using Volo.Abp.Account; using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; @@ -19,7 +19,7 @@ namespace KonSoft.Dispatch; typeof(AbpTenantManagementHttpApiModule), typeof(AbpFeatureManagementHttpApiModule), typeof(AbpSettingManagementHttpApiModule) - )] +)] public class DispatchHttpApiModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) @@ -38,4 +38,4 @@ public class DispatchHttpApiModule : AbpModule ); }); } -} +} \ No newline at end of file diff --git a/modules/dispatch/src/KonSoft.Dispatch.HttpApi/Models/Test/TestModel.cs b/modules/dispatch/src/KonSoft.Dispatch.HttpApi/Models/Test/TestModel.cs index 7da0622..2162471 100644 --- a/modules/dispatch/src/KonSoft.Dispatch.HttpApi/Models/Test/TestModel.cs +++ b/modules/dispatch/src/KonSoft.Dispatch.HttpApi/Models/Test/TestModel.cs @@ -7,4 +7,4 @@ public class TestModel public string? Name { get; set; } public DateTime BirthDate { get; set; } -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.Application.Tests/DispatchApplicationTestBase.cs b/modules/dispatch/test/KonSoft.Dispatch.Application.Tests/DispatchApplicationTestBase.cs index 3638395..52abe9e 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.Application.Tests/DispatchApplicationTestBase.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.Application.Tests/DispatchApplicationTestBase.cs @@ -5,5 +5,4 @@ namespace KonSoft.Dispatch; public abstract class DispatchApplicationTestBase : DispatchTestBase where TStartupModule : IAbpModule { - -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.Application.Tests/DispatchApplicationTestModule.cs b/modules/dispatch/test/KonSoft.Dispatch.Application.Tests/DispatchApplicationTestModule.cs index a2e8f91..ad48708 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.Application.Tests/DispatchApplicationTestModule.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.Application.Tests/DispatchApplicationTestModule.cs @@ -8,5 +8,4 @@ namespace KonSoft.Dispatch; )] public class DispatchApplicationTestModule : AbpModule { - -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.Application.Tests/Samples/SampleAppServiceTests.cs b/modules/dispatch/test/KonSoft.Dispatch.Application.Tests/Samples/SampleAppServiceTests.cs index 51703b8..ba8560a 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.Application.Tests/Samples/SampleAppServiceTests.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.Application.Tests/Samples/SampleAppServiceTests.cs @@ -1,5 +1,5 @@ -using Shouldly; -using System.Threading.Tasks; +using System.Threading.Tasks; +using Shouldly; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Xunit; @@ -31,4 +31,4 @@ public abstract class SampleAppServiceTests : DispatchApplicatio result.TotalCount.ShouldBeGreaterThan(0); result.Items.ShouldContain(u => u.UserName == "admin"); } -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.Domain.Tests/DispatchDomainTestBase.cs b/modules/dispatch/test/KonSoft.Dispatch.Domain.Tests/DispatchDomainTestBase.cs index c0e94f5..02133bf 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.Domain.Tests/DispatchDomainTestBase.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.Domain.Tests/DispatchDomainTestBase.cs @@ -6,5 +6,4 @@ namespace KonSoft.Dispatch; public abstract class DispatchDomainTestBase : DispatchTestBase where TStartupModule : IAbpModule { - -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.Domain.Tests/DispatchDomainTestModule.cs b/modules/dispatch/test/KonSoft.Dispatch.Domain.Tests/DispatchDomainTestModule.cs index c28f7b8..7c066e2 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.Domain.Tests/DispatchDomainTestModule.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.Domain.Tests/DispatchDomainTestModule.cs @@ -8,5 +8,4 @@ namespace KonSoft.Dispatch; )] public class DispatchDomainTestModule : AbpModule { - -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.Domain.Tests/Samples/SampleDomainTests.cs b/modules/dispatch/test/KonSoft.Dispatch.Domain.Tests/Samples/SampleDomainTests.cs index a56788e..2e02447 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.Domain.Tests/Samples/SampleDomainTests.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.Domain.Tests/Samples/SampleDomainTests.cs @@ -14,8 +14,8 @@ namespace KonSoft.Dispatch.Samples; public abstract class SampleDomainTests : DispatchDomainTestBase where TStartupModule : IAbpModule { - private readonly IIdentityUserRepository _identityUserRepository; private readonly IdentityUserManager _identityUserManager; + private readonly IIdentityUserRepository _identityUserRepository; protected SampleDomainTests() { @@ -43,4 +43,4 @@ public abstract class SampleDomainTests : DispatchDomainTestBase adminUser = await _identityUserRepository.FindByNormalizedUserNameAsync("ADMIN"); adminUser.Email.ShouldBe("newemail@abp.io"); } -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs index 1b831fc..496aebf 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs @@ -6,5 +6,4 @@ namespace KonSoft.Dispatch.EntityFrameworkCore.Applications; [Collection(DispatchTestConsts.CollectionDefinitionName)] public class EfCoreSampleAppServiceTests : SampleAppServiceTests { - -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreCollection.cs b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreCollection.cs index a2578dd..25a4030 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreCollection.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreCollection.cs @@ -5,5 +5,4 @@ namespace KonSoft.Dispatch.EntityFrameworkCore; [CollectionDefinition(DispatchTestConsts.CollectionDefinitionName)] public class DispatchEntityFrameworkCoreCollection : ICollectionFixture { - -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreCollectionFixtureBase.cs b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreCollectionFixtureBase.cs index 0d37668..c4504d7 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreCollectionFixtureBase.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreCollectionFixtureBase.cs @@ -1,9 +1,7 @@ -using KonSoft.Dispatch.EntityFrameworkCore; -using Xunit; +using Xunit; namespace KonSoft.Dispatch.EntityFrameworkCore; public class DispatchEntityFrameworkCoreCollectionFixtureBase : ICollectionFixture { - -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreFixture.cs b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreFixture.cs index 086b344..932be16 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreFixture.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreFixture.cs @@ -6,6 +6,5 @@ public class DispatchEntityFrameworkCoreFixture : IDisposable { public void Dispose() { - } -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreTestBase.cs b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreTestBase.cs index 989b941..cbaa16d 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreTestBase.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreTestBase.cs @@ -1,8 +1,5 @@ -using Volo.Abp; - -namespace KonSoft.Dispatch.EntityFrameworkCore; +namespace KonSoft.Dispatch.EntityFrameworkCore; public abstract class DispatchEntityFrameworkCoreTestBase : DispatchTestBase { - -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreTestModule.cs b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreTestModule.cs index f6517d9..a3b8023 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreTestModule.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/DispatchEntityFrameworkCoreTestModule.cs @@ -18,7 +18,7 @@ namespace KonSoft.Dispatch.EntityFrameworkCore; typeof(DispatchApplicationTestModule), typeof(DispatchEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqliteModule) - )] +)] public class DispatchEntityFrameworkCoreTestModule : AbpModule { private SqliteConnection? _sqliteConnection; @@ -51,10 +51,7 @@ public class DispatchEntityFrameworkCoreTestModule : AbpModule services.Configure(options => { - options.Configure(context => - { - context.DbContextOptions.UseSqlite(_sqliteConnection); - }); + options.Configure(context => { context.DbContextOptions.UseSqlite(_sqliteConnection); }); }); } @@ -79,4 +76,4 @@ public class DispatchEntityFrameworkCoreTestModule : AbpModule return connection; } -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs index 3bad6ef..9256ab4 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs @@ -6,5 +6,4 @@ namespace KonSoft.Dispatch.EntityFrameworkCore.Domains; [Collection(DispatchTestConsts.CollectionDefinitionName)] public class EfCoreSampleDomainTests : SampleDomainTests { - -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs index 234cc69..e02a0e6 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs @@ -1,8 +1,8 @@ -using Microsoft.EntityFrameworkCore; -using Shouldly; -using System; +using System; using System.Linq; using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Shouldly; using Volo.Abp.Domain.Repositories; using Volo.Abp.Identity; using Xunit; @@ -32,13 +32,13 @@ public class SampleRepositoryTests : DispatchEntityFrameworkCoreTestBase */ await WithUnitOfWorkAsync(async () => { - //Act - var adminUser = await (await _appUserRepository.GetQueryableAsync()) + //Act + var adminUser = await (await _appUserRepository.GetQueryableAsync()) .Where(u => u.UserName == "admin") .FirstOrDefaultAsync(); - //Assert - adminUser.ShouldNotBeNull(); + //Assert + adminUser.ShouldNotBeNull(); }); } -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs index 636311e..4100b97 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs @@ -22,4 +22,4 @@ public class ClientDemoService : ITransientDependency Console.WriteLine($"Name : {output.Name}"); Console.WriteLine($"Surname : {output.Surname}"); } -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs index 6e81f80..edb84e1 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -1,8 +1,8 @@ -using Microsoft.Extensions.Hosting; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Volo.Abp; namespace KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp; @@ -19,10 +19,10 @@ public class ConsoleTestAppHostedService : IHostedService public async Task StartAsync(CancellationToken cancellationToken) { using (var application = await AbpApplicationFactory.CreateAsync(options => - { - options.Services.ReplaceConfiguration(_configuration); - options.UseAutofac(); - })) + { + options.Services.ReplaceConfiguration(_configuration); + options.UseAutofac(); + })) { await application.InitializeAsync(); @@ -37,4 +37,4 @@ public class ConsoleTestAppHostedService : IHostedService { return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/DispatchConsoleApiClientModule.cs b/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/DispatchConsoleApiClientModule.cs index be6deb9..1d2f57b 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/DispatchConsoleApiClientModule.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/DispatchConsoleApiClientModule.cs @@ -12,7 +12,7 @@ namespace KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp; typeof(AbpAutofacModule), typeof(DispatchHttpApiClientModule), typeof(AbpHttpClientIdentityModelModule) - )] +)] public class DispatchConsoleApiClientModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -21,10 +21,10 @@ public class DispatchConsoleApiClientModule : AbpModule { options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) => { - clientBuilder.AddTransientHttpErrorPolicy( - policyBuilder => policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) + clientBuilder.AddTransientHttpErrorPolicy(policyBuilder => + policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) ); }); }); } -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/Program.cs b/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/Program.cs index 2c0b50a..02bfda7 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp/Program.cs @@ -1,22 +1,23 @@ using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace KonSoft.Dispatch.HttpApi.Client.ConsoleTestApp; -class Program +internal class Program { - static async Task Main(string[] args) + private static async Task Main(string[] args) { await CreateHostBuilder(args).RunConsoleAsync(); } - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) + public static IHostBuilder CreateHostBuilder(string[] args) + { + return Host.CreateDefaultBuilder(args) .AddAppSettingsSecretsJson() .ConfigureServices((hostContext, services) => { services.AddHostedService(); }); -} + } +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.TestBase/DispatchTestBase.cs b/modules/dispatch/test/KonSoft.Dispatch.TestBase/DispatchTestBase.cs index db3f3f2..41fa0bd 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.TestBase/DispatchTestBase.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.TestBase/DispatchTestBase.cs @@ -3,8 +3,8 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Modularity; -using Volo.Abp.Uow; using Volo.Abp.Testing; +using Volo.Abp.Uow; namespace KonSoft.Dispatch; @@ -43,7 +43,8 @@ public abstract class DispatchTestBase : AbpIntegratedTest WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func> func) + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, + Func> func) { using (var scope = ServiceProvider.CreateScope()) { @@ -57,4 +58,4 @@ public abstract class DispatchTestBase : AbpIntegratedTest(options => - { - options.IsJobExecutionEnabled = false; - }); + Configure(options => { options.IsJobExecutionEnabled = false; }); context.Services.AddAlwaysAllowAuthorization(); } @@ -44,4 +41,4 @@ public class DispatchTestBaseModule : AbpModule } }); } -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.TestBase/DispatchTestConsts.cs b/modules/dispatch/test/KonSoft.Dispatch.TestBase/DispatchTestConsts.cs index 394b858..4d4f13f 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.TestBase/DispatchTestConsts.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.TestBase/DispatchTestConsts.cs @@ -3,4 +3,4 @@ public static class DispatchTestConsts { public const string CollectionDefinitionName = "Dispatch collection"; -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.TestBase/DispatchTestDataSeedContributor.cs b/modules/dispatch/test/KonSoft.Dispatch.TestBase/DispatchTestDataSeedContributor.cs index cdf13ef..e12910b 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.TestBase/DispatchTestDataSeedContributor.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.TestBase/DispatchTestDataSeedContributor.cs @@ -12,4 +12,4 @@ public class DispatchTestDataSeedContributor : IDataSeedContributor, ITransientD return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/dispatch/test/KonSoft.Dispatch.TestBase/Security/FakeCurrentPrincipalAccessor.cs b/modules/dispatch/test/KonSoft.Dispatch.TestBase/Security/FakeCurrentPrincipalAccessor.cs index 1f8fe62..dcc4f5f 100644 --- a/modules/dispatch/test/KonSoft.Dispatch.TestBase/Security/FakeCurrentPrincipalAccessor.cs +++ b/modules/dispatch/test/KonSoft.Dispatch.TestBase/Security/FakeCurrentPrincipalAccessor.cs @@ -17,9 +17,9 @@ public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor { return new ClaimsPrincipal(new ClaimsIdentity(new List { - new Claim(AbpClaimTypes.UserId, "2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), - new Claim(AbpClaimTypes.UserName, "admin"), - new Claim(AbpClaimTypes.Email, "admin@abp.io") + new(AbpClaimTypes.UserId, "2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), + new(AbpClaimTypes.UserName, "admin"), + new(AbpClaimTypes.Email, "admin@abp.io") })); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Application.Contracts/PaymentApplicationContractsModule.cs b/modules/payment/src/KonSoft.Payment.Application.Contracts/PaymentApplicationContractsModule.cs index 779660b..9415269 100644 --- a/modules/payment/src/KonSoft.Payment.Application.Contracts/PaymentApplicationContractsModule.cs +++ b/modules/payment/src/KonSoft.Payment.Application.Contracts/PaymentApplicationContractsModule.cs @@ -25,4 +25,4 @@ public class PaymentApplicationContractsModule : AbpModule { PaymentDtoExtensions.Configure(); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Application.Contracts/PaymentDtoExtensions.cs b/modules/payment/src/KonSoft.Payment.Application.Contracts/PaymentDtoExtensions.cs index d9e8eed..82b4f29 100644 --- a/modules/payment/src/KonSoft.Payment.Application.Contracts/PaymentDtoExtensions.cs +++ b/modules/payment/src/KonSoft.Payment.Application.Contracts/PaymentDtoExtensions.cs @@ -1,28 +1,26 @@ -using Volo.Abp.Identity; -using Volo.Abp.ObjectExtending; -using Volo.Abp.Threading; +using Volo.Abp.Threading; namespace KonSoft.Payment; public static class PaymentDtoExtensions { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { OneTimeRunner.Run(() => { - /* You can add extension properties to DTOs - * defined in the depended modules. - * - * Example: - * - * ObjectExtensionManager.Instance - * .AddOrUpdateProperty("Title"); - * - * See the documentation for more: - * https://docs.abp.io/en/abp/latest/Object-Extensions - */ + /* You can add extension properties to DTOs + * defined in the depended modules. + * + * Example: + * + * ObjectExtensionManager.Instance + * .AddOrUpdateProperty("Title"); + * + * See the documentation for more: + * https://docs.abp.io/en/abp/latest/Object-Extensions + */ }); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Application.Contracts/Permissions/PaymentPermissionDefinitionProvider.cs b/modules/payment/src/KonSoft.Payment.Application.Contracts/Permissions/PaymentPermissionDefinitionProvider.cs index e0a83de..6c838a8 100644 --- a/modules/payment/src/KonSoft.Payment.Application.Contracts/Permissions/PaymentPermissionDefinitionProvider.cs +++ b/modules/payment/src/KonSoft.Payment.Application.Contracts/Permissions/PaymentPermissionDefinitionProvider.cs @@ -17,4 +17,4 @@ public class PaymentPermissionDefinitionProvider : PermissionDefinitionProvider { return LocalizableString.Create(name); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Application.Contracts/Permissions/PaymentPermissions.cs b/modules/payment/src/KonSoft.Payment.Application.Contracts/Permissions/PaymentPermissions.cs index 2c9a28b..56d1e2a 100644 --- a/modules/payment/src/KonSoft.Payment.Application.Contracts/Permissions/PaymentPermissions.cs +++ b/modules/payment/src/KonSoft.Payment.Application.Contracts/Permissions/PaymentPermissions.cs @@ -6,4 +6,4 @@ public static class PaymentPermissions //Add your own permission names. Example: //public const string MyPermission1 = GroupName + ".MyPermission1"; -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Application/PaymentAppService.cs b/modules/payment/src/KonSoft.Payment.Application/PaymentAppService.cs index 3e3e04a..75e57f2 100644 --- a/modules/payment/src/KonSoft.Payment.Application/PaymentAppService.cs +++ b/modules/payment/src/KonSoft.Payment.Application/PaymentAppService.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using KonSoft.Payment.Localization; +using KonSoft.Payment.Localization; using Volo.Abp.Application.Services; namespace KonSoft.Payment; @@ -14,4 +11,4 @@ public abstract class PaymentAppService : ApplicationService { LocalizationResource = typeof(PaymentResource); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Application/PaymentApplicationAutoMapperProfile.cs b/modules/payment/src/KonSoft.Payment.Application/PaymentApplicationAutoMapperProfile.cs index cd57e6f..22be606 100644 --- a/modules/payment/src/KonSoft.Payment.Application/PaymentApplicationAutoMapperProfile.cs +++ b/modules/payment/src/KonSoft.Payment.Application/PaymentApplicationAutoMapperProfile.cs @@ -4,10 +4,4 @@ namespace KonSoft.Payment; public class PaymentApplicationAutoMapperProfile : Profile { - public PaymentApplicationAutoMapperProfile() - { - /* You can configure your AutoMapper mapping configuration here. - * Alternatively, you can split your mapping configurations - * into multiple profile classes for a better organization. */ - } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Application/PaymentApplicationModule.cs b/modules/payment/src/KonSoft.Payment.Application/PaymentApplicationModule.cs index 827aee4..dac68f2 100644 --- a/modules/payment/src/KonSoft.Payment.Application/PaymentApplicationModule.cs +++ b/modules/payment/src/KonSoft.Payment.Application/PaymentApplicationModule.cs @@ -18,14 +18,11 @@ namespace KonSoft.Payment; typeof(AbpTenantManagementApplicationModule), typeof(AbpFeatureManagementApplicationModule), typeof(AbpSettingManagementApplicationModule) - )] +)] public class PaymentApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => - { - options.AddMaps(); - }); + Configure(options => { options.AddMaps(); }); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Application/Properties/AssemblyInfo.cs b/modules/payment/src/KonSoft.Payment.Application/Properties/AssemblyInfo.cs index 2626411..92f15a4 100644 --- a/modules/payment/src/KonSoft.Payment.Application/Properties/AssemblyInfo.cs +++ b/modules/payment/src/KonSoft.Payment.Application/Properties/AssemblyInfo.cs @@ -1,2 +1,3 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.Payment.Application.Tests")] + +[assembly: InternalsVisibleToAttribute("KonSoft.Payment.Application.Tests")] \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain.Shared/Localization/PaymentResource.cs b/modules/payment/src/KonSoft.Payment.Domain.Shared/Localization/PaymentResource.cs index fcf7fb7..f1dac5f 100644 --- a/modules/payment/src/KonSoft.Payment.Domain.Shared/Localization/PaymentResource.cs +++ b/modules/payment/src/KonSoft.Payment.Domain.Shared/Localization/PaymentResource.cs @@ -5,5 +5,4 @@ namespace KonSoft.Payment.Localization; [LocalizationResourceName("Payment")] public class PaymentResource { - -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs b/modules/payment/src/KonSoft.Payment.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs index c3155c1..07eb41f 100644 --- a/modules/payment/src/KonSoft.Payment.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs +++ b/modules/payment/src/KonSoft.Payment.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs @@ -7,4 +7,4 @@ public static class MultiTenancyConsts * related modules and code parts, including this file. */ public const bool IsEnabled = true; -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentDomainErrorCodes.cs b/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentDomainErrorCodes.cs index 85cf719..923afb6 100644 --- a/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentDomainErrorCodes.cs +++ b/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentDomainErrorCodes.cs @@ -3,4 +3,4 @@ public static class PaymentDomainErrorCodes { /* You can add your business exception error codes here, as constants */ -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentDomainSharedModule.cs b/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentDomainSharedModule.cs index 8da6490..a5d8511 100644 --- a/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentDomainSharedModule.cs +++ b/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentDomainSharedModule.cs @@ -23,8 +23,8 @@ namespace KonSoft.Payment; typeof(AbpOpenIddictDomainSharedModule), typeof(AbpPermissionManagementDomainSharedModule), typeof(AbpSettingManagementDomainSharedModule), - typeof(AbpTenantManagementDomainSharedModule) - )] + typeof(AbpTenantManagementDomainSharedModule) +)] public class PaymentDomainSharedModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -55,4 +55,4 @@ public class PaymentDomainSharedModule : AbpModule options.MapCodeNamespace("Payment", typeof(PaymentResource)); }); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentGlobalFeatureConfigurator.cs b/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentGlobalFeatureConfigurator.cs index c1b4b07..e8e968f 100644 --- a/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentGlobalFeatureConfigurator.cs +++ b/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentGlobalFeatureConfigurator.cs @@ -4,19 +4,19 @@ namespace KonSoft.Payment; public static class PaymentGlobalFeatureConfigurator { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { OneTimeRunner.Run(() => { - /* You can configure (enable/disable) global features of the used modules here. - * - * YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! - * - * Please refer to the documentation to lear more about the Global Features System: - * https://docs.abp.io/en/abp/latest/Global-Features - */ + /* You can configure (enable/disable) global features of the used modules here. + * + * YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! + * + * Please refer to the documentation to lear more about the Global Features System: + * https://docs.abp.io/en/abp/latest/Global-Features + */ }); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentModuleExtensionConfigurator.cs b/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentModuleExtensionConfigurator.cs index a26ebbc..b916817 100644 --- a/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentModuleExtensionConfigurator.cs +++ b/modules/payment/src/KonSoft.Payment.Domain.Shared/PaymentModuleExtensionConfigurator.cs @@ -1,13 +1,10 @@ -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Identity; -using Volo.Abp.ObjectExtending; -using Volo.Abp.Threading; +using Volo.Abp.Threading; namespace KonSoft.Payment; public static class PaymentModuleExtensionConfigurator { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { @@ -57,7 +54,7 @@ public static class PaymentModuleExtensionConfigurator //validation rules property.Attributes.Add(new RequiredAttribute()); property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4}); - + property.Configuration[IdentityModuleExtensionConsts.ConfigurationNames.AllowUserToEdit] = true; //...other configurations for this property @@ -70,4 +67,4 @@ public static class PaymentModuleExtensionConfigurator * https://docs.abp.io/en/abp/latest/Module-Entity-Extensions */ } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain/Data/IPaymentDbSchemaMigrator.cs b/modules/payment/src/KonSoft.Payment.Domain/Data/IPaymentDbSchemaMigrator.cs index 78d1e4f..04f1fdb 100644 --- a/modules/payment/src/KonSoft.Payment.Domain/Data/IPaymentDbSchemaMigrator.cs +++ b/modules/payment/src/KonSoft.Payment.Domain/Data/IPaymentDbSchemaMigrator.cs @@ -5,4 +5,4 @@ namespace KonSoft.Payment.Data; public interface IPaymentDbSchemaMigrator { Task MigrateAsync(); -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain/Data/NullPaymentDbSchemaMigrator.cs b/modules/payment/src/KonSoft.Payment.Domain/Data/NullPaymentDbSchemaMigrator.cs index 15b687d..321c56b 100644 --- a/modules/payment/src/KonSoft.Payment.Domain/Data/NullPaymentDbSchemaMigrator.cs +++ b/modules/payment/src/KonSoft.Payment.Domain/Data/NullPaymentDbSchemaMigrator.cs @@ -12,4 +12,4 @@ public class NullPaymentDbSchemaMigrator : IPaymentDbSchemaMigrator, ITransientD { return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain/Data/PaymentDbMigrationService.cs b/modules/payment/src/KonSoft.Payment.Domain/Data/PaymentDbMigrationService.cs index 32e6382..85c7ae3 100644 --- a/modules/payment/src/KonSoft.Payment.Domain/Data/PaymentDbMigrationService.cs +++ b/modules/payment/src/KonSoft.Payment.Domain/Data/PaymentDbMigrationService.cs @@ -17,12 +17,11 @@ namespace KonSoft.Payment.Data; public class PaymentDbMigrationService : ITransientDependency { - public ILogger Logger { get; set; } + private readonly ICurrentTenant _currentTenant; private readonly IDataSeeder _dataSeeder; private readonly IEnumerable _dbSchemaMigrators; private readonly ITenantRepository _tenantRepository; - private readonly ICurrentTenant _currentTenant; public PaymentDbMigrationService( IDataSeeder dataSeeder, @@ -38,6 +37,8 @@ public class PaymentDbMigrationService : ITransientDependency Logger = NullLogger.Instance; } + public ILogger Logger { get; set; } + public async Task MigrateAsync() { var initialMigrationAdded = AddInitialMigrationIfNotExist(); @@ -52,7 +53,7 @@ public class PaymentDbMigrationService : ITransientDependency await MigrateDatabaseSchemaAsync(); await SeedDataAsync(); - Logger.LogInformation($"Successfully completed host database migrations."); + Logger.LogInformation("Successfully completed host database migrations."); var tenants = await _tenantRepository.GetListAsync(includeDetails: true); @@ -101,8 +102,10 @@ public class PaymentDbMigrationService : ITransientDependency Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed..."); await _dataSeeder.SeedAsync(new DataSeedContext(tenant?.Id) - .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, IdentityDataSeedContributor.AdminEmailDefaultValue) - .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, IdentityDataSeedContributor.AdminPasswordDefaultValue) + .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, + IdentityDataSeedContributor.AdminEmailDefaultValue) + .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, + IdentityDataSeedContributor.AdminPasswordDefaultValue) ); } @@ -127,10 +130,8 @@ public class PaymentDbMigrationService : ITransientDependency AddInitialMigration(); return true; } - else - { - return false; - } + + return false; } catch (Exception e) { @@ -149,7 +150,8 @@ public class PaymentDbMigrationService : ITransientDependency private bool MigrationsFolderExists() { var dbMigrationsProjectFolder = GetEntityFrameworkCoreProjectFolderPath(); - return dbMigrationsProjectFolder != null && Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations")); + return dbMigrationsProjectFolder != null && + Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations")); } private void AddInitialMigration() @@ -207,7 +209,8 @@ public class PaymentDbMigrationService : ITransientDependency { currentDirectory = Directory.GetParent(currentDirectory.FullName); - if (currentDirectory != null && Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) + if (currentDirectory != null && + Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) { return currentDirectory.FullName; } @@ -215,4 +218,4 @@ public class PaymentDbMigrationService : ITransientDependency return null; } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain/OpenIddict/OpenIddictDataSeedContributor.cs b/modules/payment/src/KonSoft.Payment.Domain/OpenIddict/OpenIddictDataSeedContributor.cs index 0d512c4..cbfb5bf 100644 --- a/modules/payment/src/KonSoft.Payment.Domain/OpenIddict/OpenIddictDataSeedContributor.cs +++ b/modules/payment/src/KonSoft.Payment.Domain/OpenIddict/OpenIddictDataSeedContributor.cs @@ -23,12 +23,12 @@ namespace KonSoft.Payment.OpenIddict; */ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDependency { + private readonly IAbpApplicationManager _applicationManager; private readonly IConfiguration _configuration; private readonly IOpenIddictApplicationRepository _openIddictApplicationRepository; - private readonly IAbpApplicationManager _applicationManager; private readonly IOpenIddictScopeRepository _openIddictScopeRepository; - private readonly IOpenIddictScopeManager _scopeManager; private readonly IPermissionDataSeeder _permissionDataSeeder; + private readonly IOpenIddictScopeManager _scopeManager; private readonly IStringLocalizer L; public OpenIddictDataSeedContributor( @@ -38,7 +38,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep IOpenIddictScopeRepository openIddictScopeRepository, IOpenIddictScopeManager scopeManager, IPermissionDataSeeder permissionDataSeeder, - IStringLocalizer l ) + IStringLocalizer l) { _configuration = configuration; _openIddictApplicationRepository = openIddictApplicationRepository; @@ -60,7 +60,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep { if (await _openIddictScopeRepository.FindByNameAsync("Payment") == null) { - await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor { + await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor + { Name = "Payment", DisplayName = "Payment API", Resources = { "Payment" } }); } @@ -68,7 +69,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep private async Task CreateApplicationsAsync() { - var commonScopes = new List { + var commonScopes = new List + { OpenIddictConstants.Permissions.Scopes.Address, OpenIddictConstants.Permissions.Scopes.Email, OpenIddictConstants.Permissions.Scopes.Phone, @@ -80,10 +82,6 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var configurationSection = _configuration.GetSection("OpenIddict:Applications"); - - - - // Swagger Client var swaggerClientId = configurationSection["Payment_Swagger:ClientId"]; if (!swaggerClientId.IsNullOrWhiteSpace()) @@ -91,13 +89,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var swaggerRootUrl = configurationSection["Payment_Swagger:RootUrl"]?.TrimEnd('/'); await CreateApplicationAsync( - name: swaggerClientId!, - type: OpenIddictConstants.ClientTypes.Public, - consentType: OpenIddictConstants.ConsentTypes.Implicit, - displayName: "Swagger Application", - secret: null, - grantTypes: [OpenIddictConstants.GrantTypes.AuthorizationCode], - scopes: commonScopes, + swaggerClientId!, + OpenIddictConstants.ClientTypes.Public, + OpenIddictConstants.ConsentTypes.Implicit, + "Swagger Application", + null, + [OpenIddictConstants.GrantTypes.AuthorizationCode], + commonScopes, redirectUri: $"{swaggerRootUrl}/swagger/oauth2-redirect.html", clientUri: swaggerRootUrl ); @@ -131,13 +129,14 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var client = await _openIddictApplicationRepository.FindByClientIdAsync(name); - var application = new AbpApplicationDescriptor { + var application = new AbpApplicationDescriptor + { ClientId = name, ClientType = type, ClientSecret = secret, ConsentType = consentType, DisplayName = displayName, - ClientUri = clientUri, + ClientUri = clientUri }; Check.NotNullOrEmpty(grantTypes, nameof(grantTypes)); @@ -160,7 +159,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Logout); } - var buildInGrantTypes = new[] { + var buildInGrantTypes = new[] + { OpenIddictConstants.GrantTypes.Implicit, OpenIddictConstants.GrantTypes.Password, OpenIddictConstants.GrantTypes.AuthorizationCode, OpenIddictConstants.GrantTypes.ClientCredentials, OpenIddictConstants.GrantTypes.DeviceCode, OpenIddictConstants.GrantTypes.RefreshToken @@ -233,7 +233,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep } } - var buildInScopes = new[] { + var buildInScopes = new[] + { OpenIddictConstants.Permissions.Scopes.Address, OpenIddictConstants.Permissions.Scopes.Email, OpenIddictConstants.Permissions.Scopes.Phone, OpenIddictConstants.Permissions.Scopes.Profile, OpenIddictConstants.Permissions.Scopes.Roles @@ -289,8 +290,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep await _permissionDataSeeder.SeedAsync( ClientPermissionValueProvider.ProviderName, name, - permissions, - null + permissions ); } @@ -302,8 +302,10 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep if (!HasSameRedirectUris(client, application)) { - client.RedirectUris = JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); - client.PostLogoutRedirectUris = JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/'))); + client.RedirectUris = + JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); + client.PostLogoutRedirectUris = + JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/'))); await _applicationManager.UpdateAsync(client.ToModel()); } @@ -317,11 +319,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep private bool HasSameRedirectUris(OpenIddictApplication existingClient, AbpApplicationDescriptor application) { - return existingClient.RedirectUris == JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); + return existingClient.RedirectUris == + JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); } private bool HasSameScopes(OpenIddictApplication existingClient, AbpApplicationDescriptor application) { - return existingClient.Permissions == JsonSerializer.Serialize(application.Permissions.Select(q => q.ToString().TrimEnd('/'))); + return existingClient.Permissions == + JsonSerializer.Serialize(application.Permissions.Select(q => q.ToString().TrimEnd('/'))); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain/PaymentConsts.cs b/modules/payment/src/KonSoft.Payment.Domain/PaymentConsts.cs index 9938471..2cfe463 100644 --- a/modules/payment/src/KonSoft.Payment.Domain/PaymentConsts.cs +++ b/modules/payment/src/KonSoft.Payment.Domain/PaymentConsts.cs @@ -5,4 +5,4 @@ public static class PaymentConsts public const string DbTablePrefix = "App"; public const string DbSchema = null; -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain/PaymentDomainModule.cs b/modules/payment/src/KonSoft.Payment.Domain/PaymentDomainModule.cs index c8b9650..35a2bcc 100644 --- a/modules/payment/src/KonSoft.Payment.Domain/PaymentDomainModule.cs +++ b/modules/payment/src/KonSoft.Payment.Domain/PaymentDomainModule.cs @@ -1,6 +1,6 @@ -using Microsoft.Extensions.DependencyInjection; +using KonSoft.Payment.MultiTenancy; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using KonSoft.Payment.MultiTenancy; using Volo.Abp.AuditLogging; using Volo.Abp.BackgroundJobs; using Volo.Abp.Emailing; @@ -56,13 +56,10 @@ public class PaymentDomainModule : AbpModule options.Languages.Add(new LanguageInfo("es", "es", "Español")); }); - Configure(options => - { - options.IsEnabled = MultiTenancyConsts.IsEnabled; - }); + Configure(options => { options.IsEnabled = MultiTenancyConsts.IsEnabled; }); #if DEBUG context.Services.Replace(ServiceDescriptor.Singleton()); #endif } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain/Properties/AssemblyInfo.cs b/modules/payment/src/KonSoft.Payment.Domain/Properties/AssemblyInfo.cs index 2c6594d..8a7f38d 100644 --- a/modules/payment/src/KonSoft.Payment.Domain/Properties/AssemblyInfo.cs +++ b/modules/payment/src/KonSoft.Payment.Domain/Properties/AssemblyInfo.cs @@ -1,3 +1,4 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.Payment.Domain.Tests")] -[assembly:InternalsVisibleToAttribute("KonSoft.Payment.TestBase")] + +[assembly: InternalsVisibleToAttribute("KonSoft.Payment.Domain.Tests")] +[assembly: InternalsVisibleToAttribute("KonSoft.Payment.TestBase")] \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain/Settings/PaymentSettingDefinitionProvider.cs b/modules/payment/src/KonSoft.Payment.Domain/Settings/PaymentSettingDefinitionProvider.cs index 59b8e51..a0070cd 100644 --- a/modules/payment/src/KonSoft.Payment.Domain/Settings/PaymentSettingDefinitionProvider.cs +++ b/modules/payment/src/KonSoft.Payment.Domain/Settings/PaymentSettingDefinitionProvider.cs @@ -9,4 +9,4 @@ public class PaymentSettingDefinitionProvider : SettingDefinitionProvider //Define your own settings here. Example: //context.Add(new SettingDefinition(PaymentSettings.MySetting1)); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.Domain/Settings/PaymentSettings.cs b/modules/payment/src/KonSoft.Payment.Domain/Settings/PaymentSettings.cs index 07b3d18..b5f9e0b 100644 --- a/modules/payment/src/KonSoft.Payment.Domain/Settings/PaymentSettings.cs +++ b/modules/payment/src/KonSoft.Payment.Domain/Settings/PaymentSettings.cs @@ -6,4 +6,4 @@ public static class PaymentSettings //Add your own setting names here. Example: //public const string MySetting1 = Prefix + ".MySetting1"; -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCorePaymentDbSchemaMigrator.cs b/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCorePaymentDbSchemaMigrator.cs index d96b923..38fb7fa 100644 --- a/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCorePaymentDbSchemaMigrator.cs +++ b/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCorePaymentDbSchemaMigrator.cs @@ -1,8 +1,8 @@ using System; using System.Threading.Tasks; +using KonSoft.Payment.Data; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using KonSoft.Payment.Data; using Volo.Abp.DependencyInjection; namespace KonSoft.Payment.EntityFrameworkCore; @@ -31,4 +31,4 @@ public class EntityFrameworkCorePaymentDbSchemaMigrator .Database .MigrateAsync(); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContext.cs b/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContext.cs index 9aecc99..5ed131b 100644 --- a/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContext.cs +++ b/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContext.cs @@ -23,40 +23,9 @@ public class PaymentDbContext : IIdentityDbContext, ITenantManagementDbContext { - /* Add DbSet properties for your Aggregate Roots / Entities here. */ - - #region Entities from the modules - - /* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext - * and replaced them for this DbContext. This allows you to perform JOIN - * queries for the entities of these modules over the repositories easily. You - * typically don't need that for other modules. But, if you need, you can - * implement the DbContext interface of the needed module and use ReplaceDbContext - * attribute just like IIdentityDbContext and ITenantManagementDbContext. - * - * More info: Replacing a DbContext of a module ensures that the related module - * uses this DbContext on runtime. Otherwise, it will use its own DbContext class. - */ - - //Identity - public DbSet Users { get; set; } - public DbSet Roles { get; set; } - public DbSet ClaimTypes { get; set; } - public DbSet OrganizationUnits { get; set; } - public DbSet SecurityLogs { get; set; } - public DbSet LinkUsers { get; set; } - public DbSet UserDelegations { get; set; } - public DbSet Sessions { get; set; } - // Tenant Management - public DbSet Tenants { get; set; } - public DbSet TenantConnectionStrings { get; set; } - - #endregion - public PaymentDbContext(DbContextOptions options) : base(options) { - } protected override void OnModelCreating(ModelBuilder builder) @@ -83,4 +52,35 @@ public class PaymentDbContext : // //... //}); } -} + /* Add DbSet properties for your Aggregate Roots / Entities here. */ + + #region Entities from the modules + + /* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext + * and replaced them for this DbContext. This allows you to perform JOIN + * queries for the entities of these modules over the repositories easily. You + * typically don't need that for other modules. But, if you need, you can + * implement the DbContext interface of the needed module and use ReplaceDbContext + * attribute just like IIdentityDbContext and ITenantManagementDbContext. + * + * More info: Replacing a DbContext of a module ensures that the related module + * uses this DbContext on runtime. Otherwise, it will use its own DbContext class. + */ + + //Identity + public DbSet Users { get; set; } + public DbSet Roles { get; set; } + public DbSet ClaimTypes { get; set; } + public DbSet OrganizationUnits { get; set; } + public DbSet SecurityLogs { get; set; } + public DbSet LinkUsers { get; set; } + public DbSet UserDelegations { get; set; } + + public DbSet Sessions { get; set; } + + // Tenant Management + public DbSet Tenants { get; set; } + public DbSet TenantConnectionStrings { get; set; } + + #endregion +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContextFactory.cs b/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContextFactory.cs index fc21917..41a4ca7 100644 --- a/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContextFactory.cs +++ b/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentDbContextFactory.cs @@ -29,8 +29,8 @@ public class PaymentDbContextFactory : IDesignTimeDbContextFactory { - /* You can configure extra properties for the - * entities defined in the modules used by your application. - * - * This class can be used to map these extra properties to table fields in the database. - * - * USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING. - * USE PaymentModuleExtensionConfigurator CLASS (in the Domain.Shared project) - * FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES - * - * Example: Map a property to a table field: + /* You can configure extra properties for the + * entities defined in the modules used by your application. + * + * This class can be used to map these extra properties to table fields in the database. + * + * USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING. + * USE PaymentModuleExtensionConfigurator CLASS (in the Domain.Shared project) + * FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES + * + * Example: Map a property to a table field: - ObjectExtensionManager.Instance - .MapEfCoreProperty( - "MyProperty", - (entityBuilder, propertyBuilder) => - { - propertyBuilder.HasMaxLength(128); - } - ); + ObjectExtensionManager.Instance + .MapEfCoreProperty( + "MyProperty", + (entityBuilder, propertyBuilder) => + { + propertyBuilder.HasMaxLength(128); + } + ); - * See the documentation for more: - * https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities - */ + * See the documentation for more: + * https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities + */ }); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentEntityFrameworkCoreModule.cs b/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentEntityFrameworkCoreModule.cs index 6b196a8..fb95585 100644 --- a/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentEntityFrameworkCoreModule.cs +++ b/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/EntityFrameworkCore/PaymentEntityFrameworkCoreModule.cs @@ -1,6 +1,5 @@ using System; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Uow; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; @@ -26,7 +25,7 @@ namespace KonSoft.Payment.EntityFrameworkCore; typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule) - )] +)] public class PaymentEntityFrameworkCoreModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -41,17 +40,16 @@ public class PaymentEntityFrameworkCoreModule : AbpModule { context.Services.AddAbpDbContext(options => { - /* Remove "includeAllEntities: true" to create - * default repositories only for aggregate roots */ - options.AddDefaultRepositories(includeAllEntities: true); + /* Remove "includeAllEntities: true" to create + * default repositories only for aggregate roots */ + options.AddDefaultRepositories(true); }); Configure(options => { - /* The main point to change your DBMS. - * See also PaymentMigrationsDbContextFactory for EF Core tooling. */ + /* The main point to change your DBMS. + * See also PaymentMigrationsDbContextFactory for EF Core tooling. */ options.UseNpgsql(); }); - } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/Properties/AssemblyInfo.cs b/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/Properties/AssemblyInfo.cs index cf32d3b..e632e3a 100644 --- a/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/Properties/AssemblyInfo.cs +++ b/modules/payment/src/KonSoft.Payment.EntityFrameworkCore/Properties/AssemblyInfo.cs @@ -1,2 +1,3 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.Payment.EntityFrameworkCore.Tests")] + +[assembly: InternalsVisibleToAttribute("KonSoft.Payment.EntityFrameworkCore.Tests")] \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.HttpApi.Client/PaymentHttpApiClientModule.cs b/modules/payment/src/KonSoft.Payment.HttpApi.Client/PaymentHttpApiClientModule.cs index bbdeb31..86fa9f8 100644 --- a/modules/payment/src/KonSoft.Payment.HttpApi.Client/PaymentHttpApiClientModule.cs +++ b/modules/payment/src/KonSoft.Payment.HttpApi.Client/PaymentHttpApiClientModule.cs @@ -4,8 +4,8 @@ using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; -using Volo.Abp.TenantManagement; using Volo.Abp.SettingManagement; +using Volo.Abp.TenantManagement; using Volo.Abp.VirtualFileSystem; namespace KonSoft.Payment; @@ -26,8 +26,7 @@ public class PaymentHttpApiClientModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddHttpClientProxies( - typeof(PaymentApplicationContractsModule).Assembly, - RemoteServiceName + typeof(PaymentApplicationContractsModule).Assembly ); Configure(options => @@ -35,4 +34,4 @@ public class PaymentHttpApiClientModule : AbpModule options.FileSets.AddEmbedded(); }); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.HttpApi/Controllers/PaymentController.cs b/modules/payment/src/KonSoft.Payment.HttpApi/Controllers/PaymentController.cs index 4120fb4..093835a 100644 --- a/modules/payment/src/KonSoft.Payment.HttpApi/Controllers/PaymentController.cs +++ b/modules/payment/src/KonSoft.Payment.HttpApi/Controllers/PaymentController.cs @@ -11,4 +11,4 @@ public abstract class PaymentController : AbpControllerBase { LocalizationResource = typeof(PaymentResource); } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.HttpApi/Models/Test/TestModel.cs b/modules/payment/src/KonSoft.Payment.HttpApi/Models/Test/TestModel.cs index 0f9671c..c05626a 100644 --- a/modules/payment/src/KonSoft.Payment.HttpApi/Models/Test/TestModel.cs +++ b/modules/payment/src/KonSoft.Payment.HttpApi/Models/Test/TestModel.cs @@ -7,4 +7,4 @@ public class TestModel public string? Name { get; set; } public DateTime BirthDate { get; set; } -} +} \ No newline at end of file diff --git a/modules/payment/src/KonSoft.Payment.HttpApi/PaymentHttpApiModule.cs b/modules/payment/src/KonSoft.Payment.HttpApi/PaymentHttpApiModule.cs index ae7ce3a..37b406f 100644 --- a/modules/payment/src/KonSoft.Payment.HttpApi/PaymentHttpApiModule.cs +++ b/modules/payment/src/KonSoft.Payment.HttpApi/PaymentHttpApiModule.cs @@ -1,5 +1,5 @@ -using Localization.Resources.AbpUi; -using KonSoft.Payment.Localization; +using KonSoft.Payment.Localization; +using Localization.Resources.AbpUi; using Volo.Abp.Account; using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; @@ -19,7 +19,7 @@ namespace KonSoft.Payment; typeof(AbpTenantManagementHttpApiModule), typeof(AbpFeatureManagementHttpApiModule), typeof(AbpSettingManagementHttpApiModule) - )] +)] public class PaymentHttpApiModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) @@ -38,4 +38,4 @@ public class PaymentHttpApiModule : AbpModule ); }); } -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.Application.Tests/PaymentApplicationTestBase.cs b/modules/payment/test/KonSoft.Payment.Application.Tests/PaymentApplicationTestBase.cs index 9478300..e734149 100644 --- a/modules/payment/test/KonSoft.Payment.Application.Tests/PaymentApplicationTestBase.cs +++ b/modules/payment/test/KonSoft.Payment.Application.Tests/PaymentApplicationTestBase.cs @@ -5,5 +5,4 @@ namespace KonSoft.Payment; public abstract class PaymentApplicationTestBase : PaymentTestBase where TStartupModule : IAbpModule { - -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.Application.Tests/PaymentApplicationTestModule.cs b/modules/payment/test/KonSoft.Payment.Application.Tests/PaymentApplicationTestModule.cs index 19d15d8..83a8b50 100644 --- a/modules/payment/test/KonSoft.Payment.Application.Tests/PaymentApplicationTestModule.cs +++ b/modules/payment/test/KonSoft.Payment.Application.Tests/PaymentApplicationTestModule.cs @@ -8,5 +8,4 @@ namespace KonSoft.Payment; )] public class PaymentApplicationTestModule : AbpModule { - -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.Application.Tests/Samples/SampleAppServiceTests.cs b/modules/payment/test/KonSoft.Payment.Application.Tests/Samples/SampleAppServiceTests.cs index 058c005..be5b046 100644 --- a/modules/payment/test/KonSoft.Payment.Application.Tests/Samples/SampleAppServiceTests.cs +++ b/modules/payment/test/KonSoft.Payment.Application.Tests/Samples/SampleAppServiceTests.cs @@ -1,5 +1,5 @@ -using Shouldly; -using System.Threading.Tasks; +using System.Threading.Tasks; +using Shouldly; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Xunit; @@ -31,4 +31,4 @@ public abstract class SampleAppServiceTests : PaymentApplication result.TotalCount.ShouldBeGreaterThan(0); result.Items.ShouldContain(u => u.UserName == "admin"); } -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.Domain.Tests/PaymentDomainTestBase.cs b/modules/payment/test/KonSoft.Payment.Domain.Tests/PaymentDomainTestBase.cs index 919c54d..20a1074 100644 --- a/modules/payment/test/KonSoft.Payment.Domain.Tests/PaymentDomainTestBase.cs +++ b/modules/payment/test/KonSoft.Payment.Domain.Tests/PaymentDomainTestBase.cs @@ -6,5 +6,4 @@ namespace KonSoft.Payment; public abstract class PaymentDomainTestBase : PaymentTestBase where TStartupModule : IAbpModule { - -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.Domain.Tests/PaymentDomainTestModule.cs b/modules/payment/test/KonSoft.Payment.Domain.Tests/PaymentDomainTestModule.cs index 9a6dca8..1fbbf8f 100644 --- a/modules/payment/test/KonSoft.Payment.Domain.Tests/PaymentDomainTestModule.cs +++ b/modules/payment/test/KonSoft.Payment.Domain.Tests/PaymentDomainTestModule.cs @@ -8,5 +8,4 @@ namespace KonSoft.Payment; )] public class PaymentDomainTestModule : AbpModule { - -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.Domain.Tests/Samples/SampleDomainTests.cs b/modules/payment/test/KonSoft.Payment.Domain.Tests/Samples/SampleDomainTests.cs index 8994eaf..7fcfff2 100644 --- a/modules/payment/test/KonSoft.Payment.Domain.Tests/Samples/SampleDomainTests.cs +++ b/modules/payment/test/KonSoft.Payment.Domain.Tests/Samples/SampleDomainTests.cs @@ -14,8 +14,8 @@ namespace KonSoft.Payment.Samples; public abstract class SampleDomainTests : PaymentDomainTestBase where TStartupModule : IAbpModule { - private readonly IIdentityUserRepository _identityUserRepository; private readonly IdentityUserManager _identityUserManager; + private readonly IIdentityUserRepository _identityUserRepository; protected SampleDomainTests() { @@ -43,4 +43,4 @@ public abstract class SampleDomainTests : PaymentDomainTestBase< adminUser = await _identityUserRepository.FindByNormalizedUserNameAsync("ADMIN"); adminUser.Email.ShouldBe("newemail@abp.io"); } -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs index cc8ecc3..9bfa9d9 100644 --- a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs +++ b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs @@ -6,5 +6,4 @@ namespace KonSoft.Payment.EntityFrameworkCore.Applications; [Collection(PaymentTestConsts.CollectionDefinitionName)] public class EfCoreSampleAppServiceTests : SampleAppServiceTests { - -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs index e90b9fa..97c6e5d 100644 --- a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs +++ b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs @@ -6,5 +6,4 @@ namespace KonSoft.Payment.EntityFrameworkCore.Domains; [Collection(PaymentTestConsts.CollectionDefinitionName)] public class EfCoreSampleDomainTests : SampleDomainTests { - -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreCollection.cs b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreCollection.cs index f2ddf4d..19ed864 100644 --- a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreCollection.cs +++ b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreCollection.cs @@ -5,5 +5,4 @@ namespace KonSoft.Payment.EntityFrameworkCore; [CollectionDefinition(PaymentTestConsts.CollectionDefinitionName)] public class PaymentEntityFrameworkCoreCollection : ICollectionFixture { - -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreCollectionFixtureBase.cs b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreCollectionFixtureBase.cs index d29e066..f297a0e 100644 --- a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreCollectionFixtureBase.cs +++ b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreCollectionFixtureBase.cs @@ -1,9 +1,7 @@ -using KonSoft.Payment.EntityFrameworkCore; -using Xunit; +using Xunit; namespace KonSoft.Payment.EntityFrameworkCore; public class PaymentEntityFrameworkCoreCollectionFixtureBase : ICollectionFixture { - -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreFixture.cs b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreFixture.cs index 54424f9..1c8524c 100644 --- a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreFixture.cs +++ b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreFixture.cs @@ -6,6 +6,5 @@ public class PaymentEntityFrameworkCoreFixture : IDisposable { public void Dispose() { - } -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreTestBase.cs b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreTestBase.cs index ac885da..f369a24 100644 --- a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreTestBase.cs +++ b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreTestBase.cs @@ -1,8 +1,5 @@ -using Volo.Abp; - -namespace KonSoft.Payment.EntityFrameworkCore; +namespace KonSoft.Payment.EntityFrameworkCore; public abstract class PaymentEntityFrameworkCoreTestBase : PaymentTestBase { - -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreTestModule.cs b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreTestModule.cs index d431bc1..7ab81ad 100644 --- a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreTestModule.cs +++ b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/PaymentEntityFrameworkCoreTestModule.cs @@ -18,7 +18,7 @@ namespace KonSoft.Payment.EntityFrameworkCore; typeof(PaymentApplicationTestModule), typeof(PaymentEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqliteModule) - )] +)] public class PaymentEntityFrameworkCoreTestModule : AbpModule { private SqliteConnection? _sqliteConnection; @@ -51,10 +51,7 @@ public class PaymentEntityFrameworkCoreTestModule : AbpModule services.Configure(options => { - options.Configure(context => - { - context.DbContextOptions.UseSqlite(_sqliteConnection); - }); + options.Configure(context => { context.DbContextOptions.UseSqlite(_sqliteConnection); }); }); } @@ -79,4 +76,4 @@ public class PaymentEntityFrameworkCoreTestModule : AbpModule return connection; } -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs index 0dcfeff..24d8fd8 100644 --- a/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs +++ b/modules/payment/test/KonSoft.Payment.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs @@ -1,8 +1,8 @@ -using Microsoft.EntityFrameworkCore; -using Shouldly; -using System; +using System; using System.Linq; using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Shouldly; using Volo.Abp.Domain.Repositories; using Volo.Abp.Identity; using Xunit; @@ -32,13 +32,13 @@ public class SampleRepositoryTests : PaymentEntityFrameworkCoreTestBase */ await WithUnitOfWorkAsync(async () => { - //Act - var adminUser = await (await _appUserRepository.GetQueryableAsync()) + //Act + var adminUser = await (await _appUserRepository.GetQueryableAsync()) .Where(u => u.UserName == "admin") .FirstOrDefaultAsync(); - //Assert - adminUser.ShouldNotBeNull(); + //Assert + adminUser.ShouldNotBeNull(); }); } -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs index 3b69ac0..376802c 100644 --- a/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs +++ b/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs @@ -22,4 +22,4 @@ public class ClientDemoService : ITransientDependency Console.WriteLine($"Name : {output.Name}"); Console.WriteLine($"Surname : {output.Surname}"); } -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs index ee68c9a..decbb90 100644 --- a/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs +++ b/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -1,8 +1,8 @@ -using Microsoft.Extensions.Hosting; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Volo.Abp; namespace KonSoft.Payment.HttpApi.Client.ConsoleTestApp; @@ -19,10 +19,10 @@ public class ConsoleTestAppHostedService : IHostedService public async Task StartAsync(CancellationToken cancellationToken) { using (var application = await AbpApplicationFactory.CreateAsync(options => - { - options.Services.ReplaceConfiguration(_configuration); - options.UseAutofac(); - })) + { + options.Services.ReplaceConfiguration(_configuration); + options.UseAutofac(); + })) { await application.InitializeAsync(); @@ -37,4 +37,4 @@ public class ConsoleTestAppHostedService : IHostedService { return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/PaymentConsoleApiClientModule.cs b/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/PaymentConsoleApiClientModule.cs index 1ff17ab..59c4c25 100644 --- a/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/PaymentConsoleApiClientModule.cs +++ b/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/PaymentConsoleApiClientModule.cs @@ -12,7 +12,7 @@ namespace KonSoft.Payment.HttpApi.Client.ConsoleTestApp; typeof(AbpAutofacModule), typeof(PaymentHttpApiClientModule), typeof(AbpHttpClientIdentityModelModule) - )] +)] public class PaymentConsoleApiClientModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -21,10 +21,10 @@ public class PaymentConsoleApiClientModule : AbpModule { options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) => { - clientBuilder.AddTransientHttpErrorPolicy( - policyBuilder => policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) + clientBuilder.AddTransientHttpErrorPolicy(policyBuilder => + policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) ); }); }); } -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/Program.cs b/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/Program.cs index 8654dd1..c55089f 100644 --- a/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/modules/payment/test/KonSoft.Payment.HttpApi.Client.ConsoleTestApp/Program.cs @@ -1,22 +1,23 @@ using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace KonSoft.Payment.HttpApi.Client.ConsoleTestApp; -class Program +internal class Program { - static async Task Main(string[] args) + private static async Task Main(string[] args) { await CreateHostBuilder(args).RunConsoleAsync(); } - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) + public static IHostBuilder CreateHostBuilder(string[] args) + { + return Host.CreateDefaultBuilder(args) .AddAppSettingsSecretsJson() .ConfigureServices((hostContext, services) => { services.AddHostedService(); }); -} + } +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.TestBase/PaymentTestBase.cs b/modules/payment/test/KonSoft.Payment.TestBase/PaymentTestBase.cs index 3331157..308b836 100644 --- a/modules/payment/test/KonSoft.Payment.TestBase/PaymentTestBase.cs +++ b/modules/payment/test/KonSoft.Payment.TestBase/PaymentTestBase.cs @@ -3,8 +3,8 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Modularity; -using Volo.Abp.Uow; using Volo.Abp.Testing; +using Volo.Abp.Uow; namespace KonSoft.Payment; @@ -43,7 +43,8 @@ public abstract class PaymentTestBase : AbpIntegratedTest WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func> func) + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, + Func> func) { using (var scope = ServiceProvider.CreateScope()) { @@ -57,4 +58,4 @@ public abstract class PaymentTestBase : AbpIntegratedTest(options => - { - options.IsJobExecutionEnabled = false; - }); + Configure(options => { options.IsJobExecutionEnabled = false; }); context.Services.AddAlwaysAllowAuthorization(); } @@ -44,4 +41,4 @@ public class PaymentTestBaseModule : AbpModule } }); } -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.TestBase/PaymentTestConsts.cs b/modules/payment/test/KonSoft.Payment.TestBase/PaymentTestConsts.cs index 64b3623..85212a4 100644 --- a/modules/payment/test/KonSoft.Payment.TestBase/PaymentTestConsts.cs +++ b/modules/payment/test/KonSoft.Payment.TestBase/PaymentTestConsts.cs @@ -3,4 +3,4 @@ public static class PaymentTestConsts { public const string CollectionDefinitionName = "Payment collection"; -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.TestBase/PaymentTestDataSeedContributor.cs b/modules/payment/test/KonSoft.Payment.TestBase/PaymentTestDataSeedContributor.cs index eb4eaff..fcddfe5 100644 --- a/modules/payment/test/KonSoft.Payment.TestBase/PaymentTestDataSeedContributor.cs +++ b/modules/payment/test/KonSoft.Payment.TestBase/PaymentTestDataSeedContributor.cs @@ -12,4 +12,4 @@ public class PaymentTestDataSeedContributor : IDataSeedContributor, ITransientDe return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/payment/test/KonSoft.Payment.TestBase/Security/FakeCurrentPrincipalAccessor.cs b/modules/payment/test/KonSoft.Payment.TestBase/Security/FakeCurrentPrincipalAccessor.cs index 10983b2..986bb4b 100644 --- a/modules/payment/test/KonSoft.Payment.TestBase/Security/FakeCurrentPrincipalAccessor.cs +++ b/modules/payment/test/KonSoft.Payment.TestBase/Security/FakeCurrentPrincipalAccessor.cs @@ -17,9 +17,9 @@ public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor { return new ClaimsPrincipal(new ClaimsIdentity(new List { - new Claim(AbpClaimTypes.UserId, "2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), - new Claim(AbpClaimTypes.UserName, "admin"), - new Claim(AbpClaimTypes.Email, "admin@abp.io") + new(AbpClaimTypes.UserId, "2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), + new(AbpClaimTypes.UserName, "admin"), + new(AbpClaimTypes.Email, "admin@abp.io") })); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Application.Contracts/Permissions/ReportPermissionDefinitionProvider.cs b/modules/report/src/KonSoft.Report.Application.Contracts/Permissions/ReportPermissionDefinitionProvider.cs index b99e6bd..ee4cec8 100644 --- a/modules/report/src/KonSoft.Report.Application.Contracts/Permissions/ReportPermissionDefinitionProvider.cs +++ b/modules/report/src/KonSoft.Report.Application.Contracts/Permissions/ReportPermissionDefinitionProvider.cs @@ -17,4 +17,4 @@ public class ReportPermissionDefinitionProvider : PermissionDefinitionProvider { return LocalizableString.Create(name); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Application.Contracts/Permissions/ReportPermissions.cs b/modules/report/src/KonSoft.Report.Application.Contracts/Permissions/ReportPermissions.cs index 4b65916..e638019 100644 --- a/modules/report/src/KonSoft.Report.Application.Contracts/Permissions/ReportPermissions.cs +++ b/modules/report/src/KonSoft.Report.Application.Contracts/Permissions/ReportPermissions.cs @@ -6,4 +6,4 @@ public static class ReportPermissions //Add your own permission names. Example: //public const string MyPermission1 = GroupName + ".MyPermission1"; -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Application.Contracts/ReportApplicationContractsModule.cs b/modules/report/src/KonSoft.Report.Application.Contracts/ReportApplicationContractsModule.cs index e8b9e7d..fa5e10d 100644 --- a/modules/report/src/KonSoft.Report.Application.Contracts/ReportApplicationContractsModule.cs +++ b/modules/report/src/KonSoft.Report.Application.Contracts/ReportApplicationContractsModule.cs @@ -25,4 +25,4 @@ public class ReportApplicationContractsModule : AbpModule { ReportDtoExtensions.Configure(); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Application.Contracts/ReportDtoExtensions.cs b/modules/report/src/KonSoft.Report.Application.Contracts/ReportDtoExtensions.cs index 4541f59..c5bd034 100644 --- a/modules/report/src/KonSoft.Report.Application.Contracts/ReportDtoExtensions.cs +++ b/modules/report/src/KonSoft.Report.Application.Contracts/ReportDtoExtensions.cs @@ -1,28 +1,26 @@ -using Volo.Abp.Identity; -using Volo.Abp.ObjectExtending; -using Volo.Abp.Threading; +using Volo.Abp.Threading; namespace KonSoft.Report; public static class ReportDtoExtensions { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { OneTimeRunner.Run(() => { - /* You can add extension properties to DTOs - * defined in the depended modules. - * - * Example: - * - * ObjectExtensionManager.Instance - * .AddOrUpdateProperty("Title"); - * - * See the documentation for more: - * https://docs.abp.io/en/abp/latest/Object-Extensions - */ + /* You can add extension properties to DTOs + * defined in the depended modules. + * + * Example: + * + * ObjectExtensionManager.Instance + * .AddOrUpdateProperty("Title"); + * + * See the documentation for more: + * https://docs.abp.io/en/abp/latest/Object-Extensions + */ }); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Application/Properties/AssemblyInfo.cs b/modules/report/src/KonSoft.Report.Application/Properties/AssemblyInfo.cs index 62f1528..7103e15 100644 --- a/modules/report/src/KonSoft.Report.Application/Properties/AssemblyInfo.cs +++ b/modules/report/src/KonSoft.Report.Application/Properties/AssemblyInfo.cs @@ -1,2 +1,3 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.Report.Application.Tests")] + +[assembly: InternalsVisibleToAttribute("KonSoft.Report.Application.Tests")] \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Application/ReportAppService.cs b/modules/report/src/KonSoft.Report.Application/ReportAppService.cs index 4d50cce..29629d3 100644 --- a/modules/report/src/KonSoft.Report.Application/ReportAppService.cs +++ b/modules/report/src/KonSoft.Report.Application/ReportAppService.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using KonSoft.Report.Localization; +using KonSoft.Report.Localization; using Volo.Abp.Application.Services; namespace KonSoft.Report; @@ -14,4 +11,4 @@ public abstract class ReportAppService : ApplicationService { LocalizationResource = typeof(ReportResource); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Application/ReportApplicationAutoMapperProfile.cs b/modules/report/src/KonSoft.Report.Application/ReportApplicationAutoMapperProfile.cs index a7d2748..f45dcca 100644 --- a/modules/report/src/KonSoft.Report.Application/ReportApplicationAutoMapperProfile.cs +++ b/modules/report/src/KonSoft.Report.Application/ReportApplicationAutoMapperProfile.cs @@ -4,10 +4,4 @@ namespace KonSoft.Report; public class ReportApplicationAutoMapperProfile : Profile { - public ReportApplicationAutoMapperProfile() - { - /* You can configure your AutoMapper mapping configuration here. - * Alternatively, you can split your mapping configurations - * into multiple profile classes for a better organization. */ - } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Application/ReportApplicationModule.cs b/modules/report/src/KonSoft.Report.Application/ReportApplicationModule.cs index a010131..4d929f4 100644 --- a/modules/report/src/KonSoft.Report.Application/ReportApplicationModule.cs +++ b/modules/report/src/KonSoft.Report.Application/ReportApplicationModule.cs @@ -18,14 +18,11 @@ namespace KonSoft.Report; typeof(AbpTenantManagementApplicationModule), typeof(AbpFeatureManagementApplicationModule), typeof(AbpSettingManagementApplicationModule) - )] +)] public class ReportApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => - { - options.AddMaps(); - }); + Configure(options => { options.AddMaps(); }); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain.Shared/Localization/ReportResource.cs b/modules/report/src/KonSoft.Report.Domain.Shared/Localization/ReportResource.cs index bdab1be..34edab4 100644 --- a/modules/report/src/KonSoft.Report.Domain.Shared/Localization/ReportResource.cs +++ b/modules/report/src/KonSoft.Report.Domain.Shared/Localization/ReportResource.cs @@ -5,5 +5,4 @@ namespace KonSoft.Report.Localization; [LocalizationResourceName("Report")] public class ReportResource { - -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs b/modules/report/src/KonSoft.Report.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs index 40a27a4..7daa238 100644 --- a/modules/report/src/KonSoft.Report.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs +++ b/modules/report/src/KonSoft.Report.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs @@ -7,4 +7,4 @@ public static class MultiTenancyConsts * related modules and code parts, including this file. */ public const bool IsEnabled = true; -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain.Shared/ReportDomainErrorCodes.cs b/modules/report/src/KonSoft.Report.Domain.Shared/ReportDomainErrorCodes.cs index 3f91211..e65f3f4 100644 --- a/modules/report/src/KonSoft.Report.Domain.Shared/ReportDomainErrorCodes.cs +++ b/modules/report/src/KonSoft.Report.Domain.Shared/ReportDomainErrorCodes.cs @@ -3,4 +3,4 @@ public static class ReportDomainErrorCodes { /* You can add your business exception error codes here, as constants */ -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain.Shared/ReportDomainSharedModule.cs b/modules/report/src/KonSoft.Report.Domain.Shared/ReportDomainSharedModule.cs index e49c6eb..7e07fa0 100644 --- a/modules/report/src/KonSoft.Report.Domain.Shared/ReportDomainSharedModule.cs +++ b/modules/report/src/KonSoft.Report.Domain.Shared/ReportDomainSharedModule.cs @@ -23,8 +23,8 @@ namespace KonSoft.Report; typeof(AbpOpenIddictDomainSharedModule), typeof(AbpPermissionManagementDomainSharedModule), typeof(AbpSettingManagementDomainSharedModule), - typeof(AbpTenantManagementDomainSharedModule) - )] + typeof(AbpTenantManagementDomainSharedModule) +)] public class ReportDomainSharedModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -55,4 +55,4 @@ public class ReportDomainSharedModule : AbpModule options.MapCodeNamespace("Report", typeof(ReportResource)); }); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain.Shared/ReportGlobalFeatureConfigurator.cs b/modules/report/src/KonSoft.Report.Domain.Shared/ReportGlobalFeatureConfigurator.cs index 5ce692d..3550aa5 100644 --- a/modules/report/src/KonSoft.Report.Domain.Shared/ReportGlobalFeatureConfigurator.cs +++ b/modules/report/src/KonSoft.Report.Domain.Shared/ReportGlobalFeatureConfigurator.cs @@ -4,19 +4,19 @@ namespace KonSoft.Report; public static class ReportGlobalFeatureConfigurator { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { OneTimeRunner.Run(() => { - /* You can configure (enable/disable) global features of the used modules here. - * - * YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! - * - * Please refer to the documentation to lear more about the Global Features System: - * https://docs.abp.io/en/abp/latest/Global-Features - */ + /* You can configure (enable/disable) global features of the used modules here. + * + * YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! + * + * Please refer to the documentation to lear more about the Global Features System: + * https://docs.abp.io/en/abp/latest/Global-Features + */ }); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain.Shared/ReportModuleExtensionConfigurator.cs b/modules/report/src/KonSoft.Report.Domain.Shared/ReportModuleExtensionConfigurator.cs index 3a1ae57..b8acc40 100644 --- a/modules/report/src/KonSoft.Report.Domain.Shared/ReportModuleExtensionConfigurator.cs +++ b/modules/report/src/KonSoft.Report.Domain.Shared/ReportModuleExtensionConfigurator.cs @@ -1,13 +1,10 @@ -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Identity; -using Volo.Abp.ObjectExtending; -using Volo.Abp.Threading; +using Volo.Abp.Threading; namespace KonSoft.Report; public static class ReportModuleExtensionConfigurator { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { @@ -57,7 +54,7 @@ public static class ReportModuleExtensionConfigurator //validation rules property.Attributes.Add(new RequiredAttribute()); property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4}); - + property.Configuration[IdentityModuleExtensionConsts.ConfigurationNames.AllowUserToEdit] = true; //...other configurations for this property @@ -70,4 +67,4 @@ public static class ReportModuleExtensionConfigurator * https://docs.abp.io/en/abp/latest/Module-Entity-Extensions */ } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain/Data/IReportDbSchemaMigrator.cs b/modules/report/src/KonSoft.Report.Domain/Data/IReportDbSchemaMigrator.cs index eda5adb..bb51b42 100644 --- a/modules/report/src/KonSoft.Report.Domain/Data/IReportDbSchemaMigrator.cs +++ b/modules/report/src/KonSoft.Report.Domain/Data/IReportDbSchemaMigrator.cs @@ -5,4 +5,4 @@ namespace KonSoft.Report.Data; public interface IReportDbSchemaMigrator { Task MigrateAsync(); -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain/Data/NullReportDbSchemaMigrator.cs b/modules/report/src/KonSoft.Report.Domain/Data/NullReportDbSchemaMigrator.cs index 4133e60..0714346 100644 --- a/modules/report/src/KonSoft.Report.Domain/Data/NullReportDbSchemaMigrator.cs +++ b/modules/report/src/KonSoft.Report.Domain/Data/NullReportDbSchemaMigrator.cs @@ -12,4 +12,4 @@ public class NullReportDbSchemaMigrator : IReportDbSchemaMigrator, ITransientDep { return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain/Data/ReportDbMigrationService.cs b/modules/report/src/KonSoft.Report.Domain/Data/ReportDbMigrationService.cs index f53ae54..e8a71aa 100644 --- a/modules/report/src/KonSoft.Report.Domain/Data/ReportDbMigrationService.cs +++ b/modules/report/src/KonSoft.Report.Domain/Data/ReportDbMigrationService.cs @@ -17,12 +17,11 @@ namespace KonSoft.Report.Data; public class ReportDbMigrationService : ITransientDependency { - public ILogger Logger { get; set; } + private readonly ICurrentTenant _currentTenant; private readonly IDataSeeder _dataSeeder; private readonly IEnumerable _dbSchemaMigrators; private readonly ITenantRepository _tenantRepository; - private readonly ICurrentTenant _currentTenant; public ReportDbMigrationService( IDataSeeder dataSeeder, @@ -38,6 +37,8 @@ public class ReportDbMigrationService : ITransientDependency Logger = NullLogger.Instance; } + public ILogger Logger { get; set; } + public async Task MigrateAsync() { var initialMigrationAdded = AddInitialMigrationIfNotExist(); @@ -52,7 +53,7 @@ public class ReportDbMigrationService : ITransientDependency await MigrateDatabaseSchemaAsync(); await SeedDataAsync(); - Logger.LogInformation($"Successfully completed host database migrations."); + Logger.LogInformation("Successfully completed host database migrations."); var tenants = await _tenantRepository.GetListAsync(includeDetails: true); @@ -101,8 +102,10 @@ public class ReportDbMigrationService : ITransientDependency Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed..."); await _dataSeeder.SeedAsync(new DataSeedContext(tenant?.Id) - .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, IdentityDataSeedContributor.AdminEmailDefaultValue) - .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, IdentityDataSeedContributor.AdminPasswordDefaultValue) + .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, + IdentityDataSeedContributor.AdminEmailDefaultValue) + .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, + IdentityDataSeedContributor.AdminPasswordDefaultValue) ); } @@ -127,10 +130,8 @@ public class ReportDbMigrationService : ITransientDependency AddInitialMigration(); return true; } - else - { - return false; - } + + return false; } catch (Exception e) { @@ -149,7 +150,8 @@ public class ReportDbMigrationService : ITransientDependency private bool MigrationsFolderExists() { var dbMigrationsProjectFolder = GetEntityFrameworkCoreProjectFolderPath(); - return dbMigrationsProjectFolder != null && Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations")); + return dbMigrationsProjectFolder != null && + Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations")); } private void AddInitialMigration() @@ -207,7 +209,8 @@ public class ReportDbMigrationService : ITransientDependency { currentDirectory = Directory.GetParent(currentDirectory.FullName); - if (currentDirectory != null && Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) + if (currentDirectory != null && + Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) { return currentDirectory.FullName; } @@ -215,4 +218,4 @@ public class ReportDbMigrationService : ITransientDependency return null; } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain/OpenIddict/OpenIddictDataSeedContributor.cs b/modules/report/src/KonSoft.Report.Domain/OpenIddict/OpenIddictDataSeedContributor.cs index 7a1a960..08d2db7 100644 --- a/modules/report/src/KonSoft.Report.Domain/OpenIddict/OpenIddictDataSeedContributor.cs +++ b/modules/report/src/KonSoft.Report.Domain/OpenIddict/OpenIddictDataSeedContributor.cs @@ -23,12 +23,12 @@ namespace KonSoft.Report.OpenIddict; */ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDependency { + private readonly IAbpApplicationManager _applicationManager; private readonly IConfiguration _configuration; private readonly IOpenIddictApplicationRepository _openIddictApplicationRepository; - private readonly IAbpApplicationManager _applicationManager; private readonly IOpenIddictScopeRepository _openIddictScopeRepository; - private readonly IOpenIddictScopeManager _scopeManager; private readonly IPermissionDataSeeder _permissionDataSeeder; + private readonly IOpenIddictScopeManager _scopeManager; private readonly IStringLocalizer L; public OpenIddictDataSeedContributor( @@ -38,7 +38,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep IOpenIddictScopeRepository openIddictScopeRepository, IOpenIddictScopeManager scopeManager, IPermissionDataSeeder permissionDataSeeder, - IStringLocalizer l ) + IStringLocalizer l) { _configuration = configuration; _openIddictApplicationRepository = openIddictApplicationRepository; @@ -60,7 +60,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep { if (await _openIddictScopeRepository.FindByNameAsync("Report") == null) { - await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor { + await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor + { Name = "Report", DisplayName = "Report API", Resources = { "Report" } }); } @@ -68,7 +69,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep private async Task CreateApplicationsAsync() { - var commonScopes = new List { + var commonScopes = new List + { OpenIddictConstants.Permissions.Scopes.Address, OpenIddictConstants.Permissions.Scopes.Email, OpenIddictConstants.Permissions.Scopes.Phone, @@ -80,10 +82,6 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var configurationSection = _configuration.GetSection("OpenIddict:Applications"); - - - - // Swagger Client var swaggerClientId = configurationSection["Report_Swagger:ClientId"]; if (!swaggerClientId.IsNullOrWhiteSpace()) @@ -91,13 +89,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var swaggerRootUrl = configurationSection["Report_Swagger:RootUrl"]?.TrimEnd('/'); await CreateApplicationAsync( - name: swaggerClientId!, - type: OpenIddictConstants.ClientTypes.Public, - consentType: OpenIddictConstants.ConsentTypes.Implicit, - displayName: "Swagger Application", - secret: null, - grantTypes: [OpenIddictConstants.GrantTypes.AuthorizationCode], - scopes: commonScopes, + swaggerClientId!, + OpenIddictConstants.ClientTypes.Public, + OpenIddictConstants.ConsentTypes.Implicit, + "Swagger Application", + null, + [OpenIddictConstants.GrantTypes.AuthorizationCode], + commonScopes, redirectUri: $"{swaggerRootUrl}/swagger/oauth2-redirect.html", clientUri: swaggerRootUrl ); @@ -131,13 +129,14 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var client = await _openIddictApplicationRepository.FindByClientIdAsync(name); - var application = new AbpApplicationDescriptor { + var application = new AbpApplicationDescriptor + { ClientId = name, ClientType = type, ClientSecret = secret, ConsentType = consentType, DisplayName = displayName, - ClientUri = clientUri, + ClientUri = clientUri }; Check.NotNullOrEmpty(grantTypes, nameof(grantTypes)); @@ -160,7 +159,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Logout); } - var buildInGrantTypes = new[] { + var buildInGrantTypes = new[] + { OpenIddictConstants.GrantTypes.Implicit, OpenIddictConstants.GrantTypes.Password, OpenIddictConstants.GrantTypes.AuthorizationCode, OpenIddictConstants.GrantTypes.ClientCredentials, OpenIddictConstants.GrantTypes.DeviceCode, OpenIddictConstants.GrantTypes.RefreshToken @@ -233,7 +233,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep } } - var buildInScopes = new[] { + var buildInScopes = new[] + { OpenIddictConstants.Permissions.Scopes.Address, OpenIddictConstants.Permissions.Scopes.Email, OpenIddictConstants.Permissions.Scopes.Phone, OpenIddictConstants.Permissions.Scopes.Profile, OpenIddictConstants.Permissions.Scopes.Roles @@ -289,8 +290,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep await _permissionDataSeeder.SeedAsync( ClientPermissionValueProvider.ProviderName, name, - permissions, - null + permissions ); } @@ -302,8 +302,10 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep if (!HasSameRedirectUris(client, application)) { - client.RedirectUris = JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); - client.PostLogoutRedirectUris = JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/'))); + client.RedirectUris = + JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); + client.PostLogoutRedirectUris = + JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/'))); await _applicationManager.UpdateAsync(client.ToModel()); } @@ -317,11 +319,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep private bool HasSameRedirectUris(OpenIddictApplication existingClient, AbpApplicationDescriptor application) { - return existingClient.RedirectUris == JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); + return existingClient.RedirectUris == + JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); } private bool HasSameScopes(OpenIddictApplication existingClient, AbpApplicationDescriptor application) { - return existingClient.Permissions == JsonSerializer.Serialize(application.Permissions.Select(q => q.ToString().TrimEnd('/'))); + return existingClient.Permissions == + JsonSerializer.Serialize(application.Permissions.Select(q => q.ToString().TrimEnd('/'))); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain/Properties/AssemblyInfo.cs b/modules/report/src/KonSoft.Report.Domain/Properties/AssemblyInfo.cs index d9b7131..78cc8ae 100644 --- a/modules/report/src/KonSoft.Report.Domain/Properties/AssemblyInfo.cs +++ b/modules/report/src/KonSoft.Report.Domain/Properties/AssemblyInfo.cs @@ -1,3 +1,4 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.Report.Domain.Tests")] -[assembly:InternalsVisibleToAttribute("KonSoft.Report.TestBase")] + +[assembly: InternalsVisibleToAttribute("KonSoft.Report.Domain.Tests")] +[assembly: InternalsVisibleToAttribute("KonSoft.Report.TestBase")] \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain/ReportConsts.cs b/modules/report/src/KonSoft.Report.Domain/ReportConsts.cs index 705ae6a..51b522c 100644 --- a/modules/report/src/KonSoft.Report.Domain/ReportConsts.cs +++ b/modules/report/src/KonSoft.Report.Domain/ReportConsts.cs @@ -5,4 +5,4 @@ public static class ReportConsts public const string DbTablePrefix = "App"; public const string DbSchema = null; -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain/ReportDomainModule.cs b/modules/report/src/KonSoft.Report.Domain/ReportDomainModule.cs index ad4c0de..0dbfe20 100644 --- a/modules/report/src/KonSoft.Report.Domain/ReportDomainModule.cs +++ b/modules/report/src/KonSoft.Report.Domain/ReportDomainModule.cs @@ -1,6 +1,6 @@ -using Microsoft.Extensions.DependencyInjection; +using KonSoft.Report.MultiTenancy; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using KonSoft.Report.MultiTenancy; using Volo.Abp.AuditLogging; using Volo.Abp.BackgroundJobs; using Volo.Abp.Emailing; @@ -56,13 +56,10 @@ public class ReportDomainModule : AbpModule options.Languages.Add(new LanguageInfo("es", "es", "Español")); }); - Configure(options => - { - options.IsEnabled = MultiTenancyConsts.IsEnabled; - }); + Configure(options => { options.IsEnabled = MultiTenancyConsts.IsEnabled; }); #if DEBUG context.Services.Replace(ServiceDescriptor.Singleton()); #endif } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain/Settings/ReportSettingDefinitionProvider.cs b/modules/report/src/KonSoft.Report.Domain/Settings/ReportSettingDefinitionProvider.cs index 844e270..19853ba 100644 --- a/modules/report/src/KonSoft.Report.Domain/Settings/ReportSettingDefinitionProvider.cs +++ b/modules/report/src/KonSoft.Report.Domain/Settings/ReportSettingDefinitionProvider.cs @@ -9,4 +9,4 @@ public class ReportSettingDefinitionProvider : SettingDefinitionProvider //Define your own settings here. Example: //context.Add(new SettingDefinition(ReportSettings.MySetting1)); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.Domain/Settings/ReportSettings.cs b/modules/report/src/KonSoft.Report.Domain/Settings/ReportSettings.cs index 48d4c45..8f551ea 100644 --- a/modules/report/src/KonSoft.Report.Domain/Settings/ReportSettings.cs +++ b/modules/report/src/KonSoft.Report.Domain/Settings/ReportSettings.cs @@ -6,4 +6,4 @@ public static class ReportSettings //Add your own setting names here. Example: //public const string MySetting1 = Prefix + ".MySetting1"; -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreReportDbSchemaMigrator.cs b/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreReportDbSchemaMigrator.cs index 40bff4e..ba247fd 100644 --- a/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreReportDbSchemaMigrator.cs +++ b/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreReportDbSchemaMigrator.cs @@ -1,8 +1,8 @@ using System; using System.Threading.Tasks; +using KonSoft.Report.Data; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using KonSoft.Report.Data; using Volo.Abp.DependencyInjection; namespace KonSoft.Report.EntityFrameworkCore; @@ -31,4 +31,4 @@ public class EntityFrameworkCoreReportDbSchemaMigrator .Database .MigrateAsync(); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/ReportDbContext.cs b/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/ReportDbContext.cs index 10edbfb..f690620 100644 --- a/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/ReportDbContext.cs +++ b/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/ReportDbContext.cs @@ -23,40 +23,9 @@ public class ReportDbContext : IIdentityDbContext, ITenantManagementDbContext { - /* Add DbSet properties for your Aggregate Roots / Entities here. */ - - #region Entities from the modules - - /* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext - * and replaced them for this DbContext. This allows you to perform JOIN - * queries for the entities of these modules over the repositories easily. You - * typically don't need that for other modules. But, if you need, you can - * implement the DbContext interface of the needed module and use ReplaceDbContext - * attribute just like IIdentityDbContext and ITenantManagementDbContext. - * - * More info: Replacing a DbContext of a module ensures that the related module - * uses this DbContext on runtime. Otherwise, it will use its own DbContext class. - */ - - //Identity - public DbSet Users { get; set; } - public DbSet Roles { get; set; } - public DbSet ClaimTypes { get; set; } - public DbSet OrganizationUnits { get; set; } - public DbSet SecurityLogs { get; set; } - public DbSet LinkUsers { get; set; } - public DbSet UserDelegations { get; set; } - public DbSet Sessions { get; set; } - // Tenant Management - public DbSet Tenants { get; set; } - public DbSet TenantConnectionStrings { get; set; } - - #endregion - public ReportDbContext(DbContextOptions options) : base(options) { - } protected override void OnModelCreating(ModelBuilder builder) @@ -83,4 +52,35 @@ public class ReportDbContext : // //... //}); } -} + /* Add DbSet properties for your Aggregate Roots / Entities here. */ + + #region Entities from the modules + + /* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext + * and replaced them for this DbContext. This allows you to perform JOIN + * queries for the entities of these modules over the repositories easily. You + * typically don't need that for other modules. But, if you need, you can + * implement the DbContext interface of the needed module and use ReplaceDbContext + * attribute just like IIdentityDbContext and ITenantManagementDbContext. + * + * More info: Replacing a DbContext of a module ensures that the related module + * uses this DbContext on runtime. Otherwise, it will use its own DbContext class. + */ + + //Identity + public DbSet Users { get; set; } + public DbSet Roles { get; set; } + public DbSet ClaimTypes { get; set; } + public DbSet OrganizationUnits { get; set; } + public DbSet SecurityLogs { get; set; } + public DbSet LinkUsers { get; set; } + public DbSet UserDelegations { get; set; } + + public DbSet Sessions { get; set; } + + // Tenant Management + public DbSet Tenants { get; set; } + public DbSet TenantConnectionStrings { get; set; } + + #endregion +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/ReportDbContextFactory.cs b/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/ReportDbContextFactory.cs index d394ab6..ad396ea 100644 --- a/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/ReportDbContextFactory.cs +++ b/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/ReportDbContextFactory.cs @@ -29,8 +29,8 @@ public class ReportDbContextFactory : IDesignTimeDbContextFactory { - /* You can configure extra properties for the - * entities defined in the modules used by your application. - * - * This class can be used to map these extra properties to table fields in the database. - * - * USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING. - * USE ReportModuleExtensionConfigurator CLASS (in the Domain.Shared project) - * FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES - * - * Example: Map a property to a table field: + /* You can configure extra properties for the + * entities defined in the modules used by your application. + * + * This class can be used to map these extra properties to table fields in the database. + * + * USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING. + * USE ReportModuleExtensionConfigurator CLASS (in the Domain.Shared project) + * FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES + * + * Example: Map a property to a table field: - ObjectExtensionManager.Instance - .MapEfCoreProperty( - "MyProperty", - (entityBuilder, propertyBuilder) => - { - propertyBuilder.HasMaxLength(128); - } - ); + ObjectExtensionManager.Instance + .MapEfCoreProperty( + "MyProperty", + (entityBuilder, propertyBuilder) => + { + propertyBuilder.HasMaxLength(128); + } + ); - * See the documentation for more: - * https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities - */ + * See the documentation for more: + * https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities + */ }); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/ReportEntityFrameworkCoreModule.cs b/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/ReportEntityFrameworkCoreModule.cs index cabe4ec..d08fcfc 100644 --- a/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/ReportEntityFrameworkCoreModule.cs +++ b/modules/report/src/KonSoft.Report.EntityFrameworkCore/EntityFrameworkCore/ReportEntityFrameworkCoreModule.cs @@ -1,6 +1,5 @@ using System; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Uow; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; @@ -26,7 +25,7 @@ namespace KonSoft.Report.EntityFrameworkCore; typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule) - )] +)] public class ReportEntityFrameworkCoreModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -41,17 +40,16 @@ public class ReportEntityFrameworkCoreModule : AbpModule { context.Services.AddAbpDbContext(options => { - /* Remove "includeAllEntities: true" to create - * default repositories only for aggregate roots */ - options.AddDefaultRepositories(includeAllEntities: true); + /* Remove "includeAllEntities: true" to create + * default repositories only for aggregate roots */ + options.AddDefaultRepositories(true); }); Configure(options => { - /* The main point to change your DBMS. - * See also ReportMigrationsDbContextFactory for EF Core tooling. */ + /* The main point to change your DBMS. + * See also ReportMigrationsDbContextFactory for EF Core tooling. */ options.UseNpgsql(); }); - } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.EntityFrameworkCore/Properties/AssemblyInfo.cs b/modules/report/src/KonSoft.Report.EntityFrameworkCore/Properties/AssemblyInfo.cs index b45c97b..8cdfa75 100644 --- a/modules/report/src/KonSoft.Report.EntityFrameworkCore/Properties/AssemblyInfo.cs +++ b/modules/report/src/KonSoft.Report.EntityFrameworkCore/Properties/AssemblyInfo.cs @@ -1,2 +1,3 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.Report.EntityFrameworkCore.Tests")] + +[assembly: InternalsVisibleToAttribute("KonSoft.Report.EntityFrameworkCore.Tests")] \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.HttpApi.Client/ReportHttpApiClientModule.cs b/modules/report/src/KonSoft.Report.HttpApi.Client/ReportHttpApiClientModule.cs index 0ec52d7..29fd98c 100644 --- a/modules/report/src/KonSoft.Report.HttpApi.Client/ReportHttpApiClientModule.cs +++ b/modules/report/src/KonSoft.Report.HttpApi.Client/ReportHttpApiClientModule.cs @@ -4,8 +4,8 @@ using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; -using Volo.Abp.TenantManagement; using Volo.Abp.SettingManagement; +using Volo.Abp.TenantManagement; using Volo.Abp.VirtualFileSystem; namespace KonSoft.Report; @@ -26,8 +26,7 @@ public class ReportHttpApiClientModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddHttpClientProxies( - typeof(ReportApplicationContractsModule).Assembly, - RemoteServiceName + typeof(ReportApplicationContractsModule).Assembly ); Configure(options => @@ -35,4 +34,4 @@ public class ReportHttpApiClientModule : AbpModule options.FileSets.AddEmbedded(); }); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.HttpApi/Controllers/ReportController.cs b/modules/report/src/KonSoft.Report.HttpApi/Controllers/ReportController.cs index e2843e2..48b11aa 100644 --- a/modules/report/src/KonSoft.Report.HttpApi/Controllers/ReportController.cs +++ b/modules/report/src/KonSoft.Report.HttpApi/Controllers/ReportController.cs @@ -11,4 +11,4 @@ public abstract class ReportController : AbpControllerBase { LocalizationResource = typeof(ReportResource); } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.HttpApi/Models/Test/TestModel.cs b/modules/report/src/KonSoft.Report.HttpApi/Models/Test/TestModel.cs index 0673740..125b678 100644 --- a/modules/report/src/KonSoft.Report.HttpApi/Models/Test/TestModel.cs +++ b/modules/report/src/KonSoft.Report.HttpApi/Models/Test/TestModel.cs @@ -7,4 +7,4 @@ public class TestModel public string? Name { get; set; } public DateTime BirthDate { get; set; } -} +} \ No newline at end of file diff --git a/modules/report/src/KonSoft.Report.HttpApi/ReportHttpApiModule.cs b/modules/report/src/KonSoft.Report.HttpApi/ReportHttpApiModule.cs index ee189b5..067ed7c 100644 --- a/modules/report/src/KonSoft.Report.HttpApi/ReportHttpApiModule.cs +++ b/modules/report/src/KonSoft.Report.HttpApi/ReportHttpApiModule.cs @@ -1,5 +1,5 @@ -using Localization.Resources.AbpUi; -using KonSoft.Report.Localization; +using KonSoft.Report.Localization; +using Localization.Resources.AbpUi; using Volo.Abp.Account; using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; @@ -19,7 +19,7 @@ namespace KonSoft.Report; typeof(AbpTenantManagementHttpApiModule), typeof(AbpFeatureManagementHttpApiModule), typeof(AbpSettingManagementHttpApiModule) - )] +)] public class ReportHttpApiModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) @@ -38,4 +38,4 @@ public class ReportHttpApiModule : AbpModule ); }); } -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.Application.Tests/ReportApplicationTestBase.cs b/modules/report/test/KonSoft.Report.Application.Tests/ReportApplicationTestBase.cs index 634c92a..4f1b5be 100644 --- a/modules/report/test/KonSoft.Report.Application.Tests/ReportApplicationTestBase.cs +++ b/modules/report/test/KonSoft.Report.Application.Tests/ReportApplicationTestBase.cs @@ -5,5 +5,4 @@ namespace KonSoft.Report; public abstract class ReportApplicationTestBase : ReportTestBase where TStartupModule : IAbpModule { - -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.Application.Tests/ReportApplicationTestModule.cs b/modules/report/test/KonSoft.Report.Application.Tests/ReportApplicationTestModule.cs index b612b5f..0b4ee98 100644 --- a/modules/report/test/KonSoft.Report.Application.Tests/ReportApplicationTestModule.cs +++ b/modules/report/test/KonSoft.Report.Application.Tests/ReportApplicationTestModule.cs @@ -8,5 +8,4 @@ namespace KonSoft.Report; )] public class ReportApplicationTestModule : AbpModule { - -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.Application.Tests/Samples/SampleAppServiceTests.cs b/modules/report/test/KonSoft.Report.Application.Tests/Samples/SampleAppServiceTests.cs index b597da9..7cf086b 100644 --- a/modules/report/test/KonSoft.Report.Application.Tests/Samples/SampleAppServiceTests.cs +++ b/modules/report/test/KonSoft.Report.Application.Tests/Samples/SampleAppServiceTests.cs @@ -1,5 +1,5 @@ -using Shouldly; -using System.Threading.Tasks; +using System.Threading.Tasks; +using Shouldly; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Xunit; @@ -31,4 +31,4 @@ public abstract class SampleAppServiceTests : ReportApplicationT result.TotalCount.ShouldBeGreaterThan(0); result.Items.ShouldContain(u => u.UserName == "admin"); } -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.Domain.Tests/ReportDomainTestBase.cs b/modules/report/test/KonSoft.Report.Domain.Tests/ReportDomainTestBase.cs index 1840a70..4806187 100644 --- a/modules/report/test/KonSoft.Report.Domain.Tests/ReportDomainTestBase.cs +++ b/modules/report/test/KonSoft.Report.Domain.Tests/ReportDomainTestBase.cs @@ -6,5 +6,4 @@ namespace KonSoft.Report; public abstract class ReportDomainTestBase : ReportTestBase where TStartupModule : IAbpModule { - -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.Domain.Tests/ReportDomainTestModule.cs b/modules/report/test/KonSoft.Report.Domain.Tests/ReportDomainTestModule.cs index 59edb92..60fe7ee 100644 --- a/modules/report/test/KonSoft.Report.Domain.Tests/ReportDomainTestModule.cs +++ b/modules/report/test/KonSoft.Report.Domain.Tests/ReportDomainTestModule.cs @@ -8,5 +8,4 @@ namespace KonSoft.Report; )] public class ReportDomainTestModule : AbpModule { - -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.Domain.Tests/Samples/SampleDomainTests.cs b/modules/report/test/KonSoft.Report.Domain.Tests/Samples/SampleDomainTests.cs index 4b4729f..ffd41a5 100644 --- a/modules/report/test/KonSoft.Report.Domain.Tests/Samples/SampleDomainTests.cs +++ b/modules/report/test/KonSoft.Report.Domain.Tests/Samples/SampleDomainTests.cs @@ -14,8 +14,8 @@ namespace KonSoft.Report.Samples; public abstract class SampleDomainTests : ReportDomainTestBase where TStartupModule : IAbpModule { - private readonly IIdentityUserRepository _identityUserRepository; private readonly IdentityUserManager _identityUserManager; + private readonly IIdentityUserRepository _identityUserRepository; protected SampleDomainTests() { @@ -43,4 +43,4 @@ public abstract class SampleDomainTests : ReportDomainTestBase { - -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs index 4019f10..727d570 100644 --- a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs +++ b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs @@ -6,5 +6,4 @@ namespace KonSoft.Report.EntityFrameworkCore.Domains; [Collection(ReportTestConsts.CollectionDefinitionName)] public class EfCoreSampleDomainTests : SampleDomainTests { - -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreCollection.cs b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreCollection.cs index beeedd5..b7c76b6 100644 --- a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreCollection.cs +++ b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreCollection.cs @@ -5,5 +5,4 @@ namespace KonSoft.Report.EntityFrameworkCore; [CollectionDefinition(ReportTestConsts.CollectionDefinitionName)] public class ReportEntityFrameworkCoreCollection : ICollectionFixture { - -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreCollectionFixtureBase.cs b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreCollectionFixtureBase.cs index 1fd8ecb..641e795 100644 --- a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreCollectionFixtureBase.cs +++ b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreCollectionFixtureBase.cs @@ -1,9 +1,7 @@ -using KonSoft.Report.EntityFrameworkCore; -using Xunit; +using Xunit; namespace KonSoft.Report.EntityFrameworkCore; public class ReportEntityFrameworkCoreCollectionFixtureBase : ICollectionFixture { - -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreFixture.cs b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreFixture.cs index 62ce6b1..9e86d35 100644 --- a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreFixture.cs +++ b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreFixture.cs @@ -6,6 +6,5 @@ public class ReportEntityFrameworkCoreFixture : IDisposable { public void Dispose() { - } -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreTestBase.cs b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreTestBase.cs index 13022d1..5ef92cd 100644 --- a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreTestBase.cs +++ b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreTestBase.cs @@ -1,8 +1,5 @@ -using Volo.Abp; - -namespace KonSoft.Report.EntityFrameworkCore; +namespace KonSoft.Report.EntityFrameworkCore; public abstract class ReportEntityFrameworkCoreTestBase : ReportTestBase { - -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreTestModule.cs b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreTestModule.cs index ef01433..57cf16c 100644 --- a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreTestModule.cs +++ b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/ReportEntityFrameworkCoreTestModule.cs @@ -18,7 +18,7 @@ namespace KonSoft.Report.EntityFrameworkCore; typeof(ReportApplicationTestModule), typeof(ReportEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqliteModule) - )] +)] public class ReportEntityFrameworkCoreTestModule : AbpModule { private SqliteConnection? _sqliteConnection; @@ -51,10 +51,7 @@ public class ReportEntityFrameworkCoreTestModule : AbpModule services.Configure(options => { - options.Configure(context => - { - context.DbContextOptions.UseSqlite(_sqliteConnection); - }); + options.Configure(context => { context.DbContextOptions.UseSqlite(_sqliteConnection); }); }); } @@ -79,4 +76,4 @@ public class ReportEntityFrameworkCoreTestModule : AbpModule return connection; } -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs index c1dd450..a22e1e9 100644 --- a/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs +++ b/modules/report/test/KonSoft.Report.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs @@ -1,8 +1,8 @@ -using Microsoft.EntityFrameworkCore; -using Shouldly; -using System; +using System; using System.Linq; using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Shouldly; using Volo.Abp.Domain.Repositories; using Volo.Abp.Identity; using Xunit; @@ -32,13 +32,13 @@ public class SampleRepositoryTests : ReportEntityFrameworkCoreTestBase */ await WithUnitOfWorkAsync(async () => { - //Act - var adminUser = await (await _appUserRepository.GetQueryableAsync()) + //Act + var adminUser = await (await _appUserRepository.GetQueryableAsync()) .Where(u => u.UserName == "admin") .FirstOrDefaultAsync(); - //Assert - adminUser.ShouldNotBeNull(); + //Assert + adminUser.ShouldNotBeNull(); }); } -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs index 8b4d7a3..4889dff 100644 --- a/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs +++ b/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs @@ -22,4 +22,4 @@ public class ClientDemoService : ITransientDependency Console.WriteLine($"Name : {output.Name}"); Console.WriteLine($"Surname : {output.Surname}"); } -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs index 125fa85..a8923dc 100644 --- a/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs +++ b/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -1,8 +1,8 @@ -using Microsoft.Extensions.Hosting; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Volo.Abp; namespace KonSoft.Report.HttpApi.Client.ConsoleTestApp; @@ -19,10 +19,10 @@ public class ConsoleTestAppHostedService : IHostedService public async Task StartAsync(CancellationToken cancellationToken) { using (var application = await AbpApplicationFactory.CreateAsync(options => - { - options.Services.ReplaceConfiguration(_configuration); - options.UseAutofac(); - })) + { + options.Services.ReplaceConfiguration(_configuration); + options.UseAutofac(); + })) { await application.InitializeAsync(); @@ -37,4 +37,4 @@ public class ConsoleTestAppHostedService : IHostedService { return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/Program.cs b/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/Program.cs index 288c22a..0bee3ad 100644 --- a/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/Program.cs @@ -1,22 +1,23 @@ using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace KonSoft.Report.HttpApi.Client.ConsoleTestApp; -class Program +internal class Program { - static async Task Main(string[] args) + private static async Task Main(string[] args) { await CreateHostBuilder(args).RunConsoleAsync(); } - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) + public static IHostBuilder CreateHostBuilder(string[] args) + { + return Host.CreateDefaultBuilder(args) .AddAppSettingsSecretsJson() .ConfigureServices((hostContext, services) => { services.AddHostedService(); }); -} + } +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/ReportConsoleApiClientModule.cs b/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/ReportConsoleApiClientModule.cs index 08ba7f7..0651f20 100644 --- a/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/ReportConsoleApiClientModule.cs +++ b/modules/report/test/KonSoft.Report.HttpApi.Client.ConsoleTestApp/ReportConsoleApiClientModule.cs @@ -12,7 +12,7 @@ namespace KonSoft.Report.HttpApi.Client.ConsoleTestApp; typeof(AbpAutofacModule), typeof(ReportHttpApiClientModule), typeof(AbpHttpClientIdentityModelModule) - )] +)] public class ReportConsoleApiClientModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -21,10 +21,10 @@ public class ReportConsoleApiClientModule : AbpModule { options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) => { - clientBuilder.AddTransientHttpErrorPolicy( - policyBuilder => policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) + clientBuilder.AddTransientHttpErrorPolicy(policyBuilder => + policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) ); }); }); } -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.TestBase/ReportTestBase.cs b/modules/report/test/KonSoft.Report.TestBase/ReportTestBase.cs index 70f614d..4a1321b 100644 --- a/modules/report/test/KonSoft.Report.TestBase/ReportTestBase.cs +++ b/modules/report/test/KonSoft.Report.TestBase/ReportTestBase.cs @@ -3,8 +3,8 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Modularity; -using Volo.Abp.Uow; using Volo.Abp.Testing; +using Volo.Abp.Uow; namespace KonSoft.Report; @@ -43,7 +43,8 @@ public abstract class ReportTestBase : AbpIntegratedTest WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func> func) + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, + Func> func) { using (var scope = ServiceProvider.CreateScope()) { @@ -57,4 +58,4 @@ public abstract class ReportTestBase : AbpIntegratedTest(options => - { - options.IsJobExecutionEnabled = false; - }); + Configure(options => { options.IsJobExecutionEnabled = false; }); context.Services.AddAlwaysAllowAuthorization(); } @@ -44,4 +41,4 @@ public class ReportTestBaseModule : AbpModule } }); } -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.TestBase/ReportTestConsts.cs b/modules/report/test/KonSoft.Report.TestBase/ReportTestConsts.cs index 552b154..dca095c 100644 --- a/modules/report/test/KonSoft.Report.TestBase/ReportTestConsts.cs +++ b/modules/report/test/KonSoft.Report.TestBase/ReportTestConsts.cs @@ -3,4 +3,4 @@ public static class ReportTestConsts { public const string CollectionDefinitionName = "Report collection"; -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.TestBase/ReportTestDataSeedContributor.cs b/modules/report/test/KonSoft.Report.TestBase/ReportTestDataSeedContributor.cs index 2931d7e..801e886 100644 --- a/modules/report/test/KonSoft.Report.TestBase/ReportTestDataSeedContributor.cs +++ b/modules/report/test/KonSoft.Report.TestBase/ReportTestDataSeedContributor.cs @@ -12,4 +12,4 @@ public class ReportTestDataSeedContributor : IDataSeedContributor, ITransientDep return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/report/test/KonSoft.Report.TestBase/Security/FakeCurrentPrincipalAccessor.cs b/modules/report/test/KonSoft.Report.TestBase/Security/FakeCurrentPrincipalAccessor.cs index 184f07f..728652a 100644 --- a/modules/report/test/KonSoft.Report.TestBase/Security/FakeCurrentPrincipalAccessor.cs +++ b/modules/report/test/KonSoft.Report.TestBase/Security/FakeCurrentPrincipalAccessor.cs @@ -17,9 +17,9 @@ public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor { return new ClaimsPrincipal(new ClaimsIdentity(new List { - new Claim(AbpClaimTypes.UserId, "2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), - new Claim(AbpClaimTypes.UserName, "admin"), - new Claim(AbpClaimTypes.Email, "admin@abp.io") + new(AbpClaimTypes.UserId, "2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), + new(AbpClaimTypes.UserName, "admin"), + new(AbpClaimTypes.Email, "admin@abp.io") })); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/Permissions/TenantManagementPermissionDefinitionProvider.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/Permissions/TenantManagementPermissionDefinitionProvider.cs index 1bf7394..953fe4f 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/Permissions/TenantManagementPermissionDefinitionProvider.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/Permissions/TenantManagementPermissionDefinitionProvider.cs @@ -17,4 +17,4 @@ public class TenantManagementPermissionDefinitionProvider : PermissionDefinition { return LocalizableString.Create(name); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/Permissions/TenantManagementPermissions.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/Permissions/TenantManagementPermissions.cs index b18cbdd..b85d84e 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/Permissions/TenantManagementPermissions.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/Permissions/TenantManagementPermissions.cs @@ -6,4 +6,4 @@ public static class TenantManagementPermissions //Add your own permission names. Example: //public const string MyPermission1 = GroupName + ".MyPermission1"; -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/TenantManagementApplicationContractsModule.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/TenantManagementApplicationContractsModule.cs index cb1dc8c..1edb951 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/TenantManagementApplicationContractsModule.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/TenantManagementApplicationContractsModule.cs @@ -25,4 +25,4 @@ public class TenantManagementApplicationContractsModule : AbpModule { TenantManagementDtoExtensions.Configure(); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/TenantManagementDtoExtensions.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/TenantManagementDtoExtensions.cs index 8f59d3e..451da57 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/TenantManagementDtoExtensions.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Application.Contracts/TenantManagementDtoExtensions.cs @@ -1,28 +1,26 @@ -using Volo.Abp.Identity; -using Volo.Abp.ObjectExtending; -using Volo.Abp.Threading; +using Volo.Abp.Threading; namespace KonSoft.TenantManagement; public static class TenantManagementDtoExtensions { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { OneTimeRunner.Run(() => { - /* You can add extension properties to DTOs - * defined in the depended modules. - * - * Example: - * - * ObjectExtensionManager.Instance - * .AddOrUpdateProperty("Title"); - * - * See the documentation for more: - * https://docs.abp.io/en/abp/latest/Object-Extensions - */ + /* You can add extension properties to DTOs + * defined in the depended modules. + * + * Example: + * + * ObjectExtensionManager.Instance + * .AddOrUpdateProperty("Title"); + * + * See the documentation for more: + * https://docs.abp.io/en/abp/latest/Object-Extensions + */ }); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Application/Properties/AssemblyInfo.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Application/Properties/AssemblyInfo.cs index 532c436..e2e5efe 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Application/Properties/AssemblyInfo.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Application/Properties/AssemblyInfo.cs @@ -1,2 +1,3 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.TenantManagement.Application.Tests")] + +[assembly: InternalsVisibleToAttribute("KonSoft.TenantManagement.Application.Tests")] \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Application/TenantManagementAppService.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Application/TenantManagementAppService.cs index 73aab41..a10260c 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Application/TenantManagementAppService.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Application/TenantManagementAppService.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using KonSoft.TenantManagement.Localization; +using KonSoft.TenantManagement.Localization; using Volo.Abp.Application.Services; namespace KonSoft.TenantManagement; @@ -14,4 +11,4 @@ public abstract class TenantManagementAppService : ApplicationService { LocalizationResource = typeof(TenantManagementResource); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Application/TenantManagementApplicationAutoMapperProfile.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Application/TenantManagementApplicationAutoMapperProfile.cs index cd54bf0..20d4dd3 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Application/TenantManagementApplicationAutoMapperProfile.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Application/TenantManagementApplicationAutoMapperProfile.cs @@ -4,10 +4,4 @@ namespace KonSoft.TenantManagement; public class TenantManagementApplicationAutoMapperProfile : Profile { - public TenantManagementApplicationAutoMapperProfile() - { - /* You can configure your AutoMapper mapping configuration here. - * Alternatively, you can split your mapping configurations - * into multiple profile classes for a better organization. */ - } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Application/TenantManagementApplicationModule.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Application/TenantManagementApplicationModule.cs index abcec47..caec0be 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Application/TenantManagementApplicationModule.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Application/TenantManagementApplicationModule.cs @@ -18,14 +18,11 @@ namespace KonSoft.TenantManagement; typeof(AbpTenantManagementApplicationModule), typeof(AbpFeatureManagementApplicationModule), typeof(AbpSettingManagementApplicationModule) - )] +)] public class TenantManagementApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => - { - options.AddMaps(); - }); + Configure(options => { options.AddMaps(); }); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/Localization/TenantManagementResource.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/Localization/TenantManagementResource.cs index 63c87f1..8dd60fe 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/Localization/TenantManagementResource.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/Localization/TenantManagementResource.cs @@ -5,5 +5,4 @@ namespace KonSoft.TenantManagement.Localization; [LocalizationResourceName("TenantManagement")] public class TenantManagementResource { - -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs index 16fc670..3f0ed6e 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/MultiTenancy/MultiTenancyConsts.cs @@ -7,4 +7,4 @@ public static class MultiTenancyConsts * related modules and code parts, including this file. */ public const bool IsEnabled = true; -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementDomainErrorCodes.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementDomainErrorCodes.cs index 5c8ea27..4b2073d 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementDomainErrorCodes.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementDomainErrorCodes.cs @@ -3,4 +3,4 @@ public static class TenantManagementDomainErrorCodes { /* You can add your business exception error codes here, as constants */ -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementDomainSharedModule.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementDomainSharedModule.cs index 70a3f90..50fc2e3 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementDomainSharedModule.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementDomainSharedModule.cs @@ -23,8 +23,8 @@ namespace KonSoft.TenantManagement; typeof(AbpOpenIddictDomainSharedModule), typeof(AbpPermissionManagementDomainSharedModule), typeof(AbpSettingManagementDomainSharedModule), - typeof(AbpTenantManagementDomainSharedModule) - )] + typeof(AbpTenantManagementDomainSharedModule) +)] public class TenantManagementDomainSharedModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -55,4 +55,4 @@ public class TenantManagementDomainSharedModule : AbpModule options.MapCodeNamespace("TenantManagement", typeof(TenantManagementResource)); }); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementGlobalFeatureConfigurator.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementGlobalFeatureConfigurator.cs index a26c94b..936655e 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementGlobalFeatureConfigurator.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementGlobalFeatureConfigurator.cs @@ -4,19 +4,19 @@ namespace KonSoft.TenantManagement; public static class TenantManagementGlobalFeatureConfigurator { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { OneTimeRunner.Run(() => { - /* You can configure (enable/disable) global features of the used modules here. - * - * YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! - * - * Please refer to the documentation to lear more about the Global Features System: - * https://docs.abp.io/en/abp/latest/Global-Features - */ + /* You can configure (enable/disable) global features of the used modules here. + * + * YOU CAN SAFELY DELETE THIS CLASS AND REMOVE ITS USAGES IF YOU DON'T NEED TO IT! + * + * Please refer to the documentation to lear more about the Global Features System: + * https://docs.abp.io/en/abp/latest/Global-Features + */ }); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementModuleExtensionConfigurator.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementModuleExtensionConfigurator.cs index c42519f..5869521 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementModuleExtensionConfigurator.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain.Shared/TenantManagementModuleExtensionConfigurator.cs @@ -1,13 +1,10 @@ -using System.ComponentModel.DataAnnotations; -using Volo.Abp.Identity; -using Volo.Abp.ObjectExtending; -using Volo.Abp.Threading; +using Volo.Abp.Threading; namespace KonSoft.TenantManagement; public static class TenantManagementModuleExtensionConfigurator { - private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); + private static readonly OneTimeRunner OneTimeRunner = new(); public static void Configure() { @@ -57,7 +54,7 @@ public static class TenantManagementModuleExtensionConfigurator //validation rules property.Attributes.Add(new RequiredAttribute()); property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4}); - + property.Configuration[IdentityModuleExtensionConsts.ConfigurationNames.AllowUserToEdit] = true; //...other configurations for this property @@ -70,4 +67,4 @@ public static class TenantManagementModuleExtensionConfigurator * https://docs.abp.io/en/abp/latest/Module-Entity-Extensions */ } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Data/ITenantManagementDbSchemaMigrator.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Data/ITenantManagementDbSchemaMigrator.cs index 134f8ef..0ff0039 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Data/ITenantManagementDbSchemaMigrator.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Data/ITenantManagementDbSchemaMigrator.cs @@ -5,4 +5,4 @@ namespace KonSoft.TenantManagement.Data; public interface ITenantManagementDbSchemaMigrator { Task MigrateAsync(); -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Data/NullTenantManagementDbSchemaMigrator.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Data/NullTenantManagementDbSchemaMigrator.cs index 4d10344..49c3b99 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Data/NullTenantManagementDbSchemaMigrator.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Data/NullTenantManagementDbSchemaMigrator.cs @@ -12,4 +12,4 @@ public class NullTenantManagementDbSchemaMigrator : ITenantManagementDbSchemaMig { return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Data/TenantManagementDbMigrationService.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Data/TenantManagementDbMigrationService.cs index 38df252..167870b 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Data/TenantManagementDbMigrationService.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Data/TenantManagementDbMigrationService.cs @@ -17,12 +17,11 @@ namespace KonSoft.TenantManagement.Data; public class TenantManagementDbMigrationService : ITransientDependency { - public ILogger Logger { get; set; } + private readonly ICurrentTenant _currentTenant; private readonly IDataSeeder _dataSeeder; private readonly IEnumerable _dbSchemaMigrators; private readonly ITenantRepository _tenantRepository; - private readonly ICurrentTenant _currentTenant; public TenantManagementDbMigrationService( IDataSeeder dataSeeder, @@ -38,6 +37,8 @@ public class TenantManagementDbMigrationService : ITransientDependency Logger = NullLogger.Instance; } + public ILogger Logger { get; set; } + public async Task MigrateAsync() { var initialMigrationAdded = AddInitialMigrationIfNotExist(); @@ -52,7 +53,7 @@ public class TenantManagementDbMigrationService : ITransientDependency await MigrateDatabaseSchemaAsync(); await SeedDataAsync(); - Logger.LogInformation($"Successfully completed host database migrations."); + Logger.LogInformation("Successfully completed host database migrations."); var tenants = await _tenantRepository.GetListAsync(includeDetails: true); @@ -101,8 +102,10 @@ public class TenantManagementDbMigrationService : ITransientDependency Logger.LogInformation($"Executing {(tenant == null ? "host" : tenant.Name + " tenant")} database seed..."); await _dataSeeder.SeedAsync(new DataSeedContext(tenant?.Id) - .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, IdentityDataSeedContributor.AdminEmailDefaultValue) - .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, IdentityDataSeedContributor.AdminPasswordDefaultValue) + .WithProperty(IdentityDataSeedContributor.AdminEmailPropertyName, + IdentityDataSeedContributor.AdminEmailDefaultValue) + .WithProperty(IdentityDataSeedContributor.AdminPasswordPropertyName, + IdentityDataSeedContributor.AdminPasswordDefaultValue) ); } @@ -127,10 +130,8 @@ public class TenantManagementDbMigrationService : ITransientDependency AddInitialMigration(); return true; } - else - { - return false; - } + + return false; } catch (Exception e) { @@ -149,7 +150,8 @@ public class TenantManagementDbMigrationService : ITransientDependency private bool MigrationsFolderExists() { var dbMigrationsProjectFolder = GetEntityFrameworkCoreProjectFolderPath(); - return dbMigrationsProjectFolder != null && Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations")); + return dbMigrationsProjectFolder != null && + Directory.Exists(Path.Combine(dbMigrationsProjectFolder, "Migrations")); } private void AddInitialMigration() @@ -207,7 +209,8 @@ public class TenantManagementDbMigrationService : ITransientDependency { currentDirectory = Directory.GetParent(currentDirectory.FullName); - if (currentDirectory != null && Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) + if (currentDirectory != null && + Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f => f.EndsWith(".sln")) != null) { return currentDirectory.FullName; } @@ -215,4 +218,4 @@ public class TenantManagementDbMigrationService : ITransientDependency return null; } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Entities/HouseholdWorker.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Entities/HouseholdWorker.cs deleted file mode 100644 index 2947aae..0000000 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Entities/HouseholdWorker.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Identity; - -namespace KonSoft.TenantManagement.Entities -{ - /// - /// 家政服务工人实体 - /// - public class HouseholdWorker:IdentityUser - { - /// - /// 接单数 - /// - public int OrderCount { get; set; } - /// - /// 职业 - /// - public required string Profession { get; set; } - /// - /// 能力范围 - /// - public required string ScopeOfCompetence { get; set; } - - } -} diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/IRepositories/IHouseholdWorkerRepository.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/IRepositories/IHouseholdWorkerRepository.cs deleted file mode 100644 index 929fc91..0000000 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/IRepositories/IHouseholdWorkerRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using KonSoft.TenantManagement.Entities; -using Volo.Abp.Domain.Repositories; - -namespace KonSoft.TenantManagement.IRepositories -{ - public interface IHouseholdWorkerRepository: EfCoreRepository, IRepository - { - } -} diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/KonSoft.TenantManagement.Domain.csproj b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/KonSoft.TenantManagement.Domain.csproj index c04d11a..fe6ddbc 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/KonSoft.TenantManagement.Domain.csproj +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/KonSoft.TenantManagement.Domain.csproj @@ -1,4 +1,4 @@ - + net8.0 diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/OpenIddict/OpenIddictDataSeedContributor.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/OpenIddict/OpenIddictDataSeedContributor.cs index b085f69..8b2bfcb 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/OpenIddict/OpenIddictDataSeedContributor.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/OpenIddict/OpenIddictDataSeedContributor.cs @@ -23,12 +23,12 @@ namespace KonSoft.TenantManagement.OpenIddict; */ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDependency { + private readonly IAbpApplicationManager _applicationManager; private readonly IConfiguration _configuration; private readonly IOpenIddictApplicationRepository _openIddictApplicationRepository; - private readonly IAbpApplicationManager _applicationManager; private readonly IOpenIddictScopeRepository _openIddictScopeRepository; - private readonly IOpenIddictScopeManager _scopeManager; private readonly IPermissionDataSeeder _permissionDataSeeder; + private readonly IOpenIddictScopeManager _scopeManager; private readonly IStringLocalizer L; public OpenIddictDataSeedContributor( @@ -38,7 +38,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep IOpenIddictScopeRepository openIddictScopeRepository, IOpenIddictScopeManager scopeManager, IPermissionDataSeeder permissionDataSeeder, - IStringLocalizer l ) + IStringLocalizer l) { _configuration = configuration; _openIddictApplicationRepository = openIddictApplicationRepository; @@ -60,7 +60,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep { if (await _openIddictScopeRepository.FindByNameAsync("TenantManagement") == null) { - await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor { + await _scopeManager.CreateAsync(new OpenIddictScopeDescriptor + { Name = "TenantManagement", DisplayName = "TenantManagement API", Resources = { "TenantManagement" } }); } @@ -68,7 +69,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep private async Task CreateApplicationsAsync() { - var commonScopes = new List { + var commonScopes = new List + { OpenIddictConstants.Permissions.Scopes.Address, OpenIddictConstants.Permissions.Scopes.Email, OpenIddictConstants.Permissions.Scopes.Phone, @@ -80,10 +82,6 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var configurationSection = _configuration.GetSection("OpenIddict:Applications"); - - - - // Swagger Client var swaggerClientId = configurationSection["TenantManagement_Swagger:ClientId"]; if (!swaggerClientId.IsNullOrWhiteSpace()) @@ -91,13 +89,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var swaggerRootUrl = configurationSection["TenantManagement_Swagger:RootUrl"]?.TrimEnd('/'); await CreateApplicationAsync( - name: swaggerClientId!, - type: OpenIddictConstants.ClientTypes.Public, - consentType: OpenIddictConstants.ConsentTypes.Implicit, - displayName: "Swagger Application", - secret: null, - grantTypes: [OpenIddictConstants.GrantTypes.AuthorizationCode], - scopes: commonScopes, + swaggerClientId!, + OpenIddictConstants.ClientTypes.Public, + OpenIddictConstants.ConsentTypes.Implicit, + "Swagger Application", + null, + [OpenIddictConstants.GrantTypes.AuthorizationCode], + commonScopes, redirectUri: $"{swaggerRootUrl}/swagger/oauth2-redirect.html", clientUri: swaggerRootUrl ); @@ -131,13 +129,14 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep var client = await _openIddictApplicationRepository.FindByClientIdAsync(name); - var application = new AbpApplicationDescriptor { + var application = new AbpApplicationDescriptor + { ClientId = name, ClientType = type, ClientSecret = secret, ConsentType = consentType, DisplayName = displayName, - ClientUri = clientUri, + ClientUri = clientUri }; Check.NotNullOrEmpty(grantTypes, nameof(grantTypes)); @@ -160,7 +159,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep application.Permissions.Add(OpenIddictConstants.Permissions.Endpoints.Logout); } - var buildInGrantTypes = new[] { + var buildInGrantTypes = new[] + { OpenIddictConstants.GrantTypes.Implicit, OpenIddictConstants.GrantTypes.Password, OpenIddictConstants.GrantTypes.AuthorizationCode, OpenIddictConstants.GrantTypes.ClientCredentials, OpenIddictConstants.GrantTypes.DeviceCode, OpenIddictConstants.GrantTypes.RefreshToken @@ -233,7 +233,8 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep } } - var buildInScopes = new[] { + var buildInScopes = new[] + { OpenIddictConstants.Permissions.Scopes.Address, OpenIddictConstants.Permissions.Scopes.Email, OpenIddictConstants.Permissions.Scopes.Phone, OpenIddictConstants.Permissions.Scopes.Profile, OpenIddictConstants.Permissions.Scopes.Roles @@ -289,8 +290,7 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep await _permissionDataSeeder.SeedAsync( ClientPermissionValueProvider.ProviderName, name, - permissions, - null + permissions ); } @@ -302,8 +302,10 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep if (!HasSameRedirectUris(client, application)) { - client.RedirectUris = JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); - client.PostLogoutRedirectUris = JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/'))); + client.RedirectUris = + JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); + client.PostLogoutRedirectUris = + JsonSerializer.Serialize(application.PostLogoutRedirectUris.Select(q => q.ToString().TrimEnd('/'))); await _applicationManager.UpdateAsync(client.ToModel()); } @@ -317,11 +319,13 @@ public class OpenIddictDataSeedContributor : IDataSeedContributor, ITransientDep private bool HasSameRedirectUris(OpenIddictApplication existingClient, AbpApplicationDescriptor application) { - return existingClient.RedirectUris == JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); + return existingClient.RedirectUris == + JsonSerializer.Serialize(application.RedirectUris.Select(q => q.ToString().TrimEnd('/'))); } private bool HasSameScopes(OpenIddictApplication existingClient, AbpApplicationDescriptor application) { - return existingClient.Permissions == JsonSerializer.Serialize(application.Permissions.Select(q => q.ToString().TrimEnd('/'))); + return existingClient.Permissions == + JsonSerializer.Serialize(application.Permissions.Select(q => q.ToString().TrimEnd('/'))); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Properties/AssemblyInfo.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Properties/AssemblyInfo.cs index 41dfbc0..0740c71 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Properties/AssemblyInfo.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Properties/AssemblyInfo.cs @@ -1,3 +1,4 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.TenantManagement.Domain.Tests")] -[assembly:InternalsVisibleToAttribute("KonSoft.TenantManagement.TestBase")] + +[assembly: InternalsVisibleToAttribute("KonSoft.TenantManagement.Domain.Tests")] +[assembly: InternalsVisibleToAttribute("KonSoft.TenantManagement.TestBase")] \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Settings/TenantManagementSettingDefinitionProvider.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Settings/TenantManagementSettingDefinitionProvider.cs index b986266..fe90af3 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Settings/TenantManagementSettingDefinitionProvider.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Settings/TenantManagementSettingDefinitionProvider.cs @@ -9,4 +9,4 @@ public class TenantManagementSettingDefinitionProvider : SettingDefinitionProvid //Define your own settings here. Example: //context.Add(new SettingDefinition(TenantManagementSettings.MySetting1)); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Settings/TenantManagementSettings.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Settings/TenantManagementSettings.cs index 054278d..9b54d4b 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Settings/TenantManagementSettings.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/Settings/TenantManagementSettings.cs @@ -6,4 +6,4 @@ public static class TenantManagementSettings //Add your own setting names here. Example: //public const string MySetting1 = Prefix + ".MySetting1"; -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/TenantManagementConsts.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/TenantManagementConsts.cs index 8a46643..2735604 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/TenantManagementConsts.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/TenantManagementConsts.cs @@ -5,4 +5,4 @@ public static class TenantManagementConsts public const string DbTablePrefix = "App"; public const string DbSchema = null; -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/TenantManagementDomainModule.cs b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/TenantManagementDomainModule.cs index 0e3b699..f734e51 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.Domain/TenantManagementDomainModule.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.Domain/TenantManagementDomainModule.cs @@ -1,6 +1,6 @@ -using Microsoft.Extensions.DependencyInjection; +using KonSoft.TenantManagement.MultiTenancy; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using KonSoft.TenantManagement.MultiTenancy; using Volo.Abp.AuditLogging; using Volo.Abp.BackgroundJobs; using Volo.Abp.Emailing; @@ -56,13 +56,10 @@ public class TenantManagementDomainModule : AbpModule options.Languages.Add(new LanguageInfo("es", "es", "Español")); }); - Configure(options => - { - options.IsEnabled = MultiTenancyConsts.IsEnabled; - }); + Configure(options => { options.IsEnabled = MultiTenancyConsts.IsEnabled; }); #if DEBUG context.Services.Replace(ServiceDescriptor.Singleton()); #endif } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreTenantManagementDbSchemaMigrator.cs b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreTenantManagementDbSchemaMigrator.cs index ce41516..448247c 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreTenantManagementDbSchemaMigrator.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/EntityFrameworkCoreTenantManagementDbSchemaMigrator.cs @@ -1,8 +1,8 @@ using System; using System.Threading.Tasks; +using KonSoft.TenantManagement.Data; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; -using KonSoft.TenantManagement.Data; using Volo.Abp.DependencyInjection; namespace KonSoft.TenantManagement.EntityFrameworkCore; @@ -31,4 +31,4 @@ public class EntityFrameworkCoreTenantManagementDbSchemaMigrator .Database .MigrateAsync(); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/Repositories/HouseholdWorkerRepository.cs b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/Repositories/HouseholdWorkerRepository.cs deleted file mode 100644 index 908279d..0000000 --- a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/Repositories/HouseholdWorkerRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using KonSoft.TenantManagement.Entities; -using KonSoft.TenantManagement.IRepositories; -using Volo.Abp.Domain.Repositories.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore; - -namespace KonSoft.TenantManagement.EntityFrameworkCore.Repositories -{ - public class HouseholdWorkerRepository: EfCoreRepository,IHouseholdWorkerRepository - { - public HouseholdWorkerRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) - { - } - } -} diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/TenantManagementDbContext.cs b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/TenantManagementDbContext.cs index b85529d..49edeaa 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/TenantManagementDbContext.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/TenantManagementDbContext.cs @@ -1,5 +1,4 @@ -using KonSoft.TenantManagement.Entities; -using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; using Volo.Abp.Data; @@ -24,40 +23,9 @@ public class TenantManagementDbContext : IIdentityDbContext, ITenantManagementDbContext { - /* Add DbSet properties for your Aggregate Roots / Entities here. */ - - #region Entities from the modules - - /* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext - * and replaced them for this DbContext. This allows you to perform JOIN - * queries for the entities of these modules over the repositories easily. You - * typically don't need that for other modules. But, if you need, you can - * implement the DbContext interface of the needed module and use ReplaceDbContext - * attribute just like IIdentityDbContext and ITenantManagementDbContext. - * - * More info: Replacing a DbContext of a module ensures that the related module - * uses this DbContext on runtime. Otherwise, it will use its own DbContext class. - */ - - //Identity - public DbSet Users { get; set; } - public DbSet Roles { get; set; } - public DbSet ClaimTypes { get; set; } - public DbSet OrganizationUnits { get; set; } - public DbSet SecurityLogs { get; set; } - public DbSet LinkUsers { get; set; } - public DbSet UserDelegations { get; set; } - public DbSet Sessions { get; set; } - // Tenant Management - public DbSet Tenants { get; set; } - public DbSet TenantConnectionStrings { get; set; } - - #endregion - public DbSet HouseholdWorkers { get; set; } public TenantManagementDbContext(DbContextOptions options) : base(options) { - } protected override void OnModelCreating(ModelBuilder builder) @@ -84,4 +52,35 @@ public class TenantManagementDbContext : // //... //}); } -} + /* Add DbSet properties for your Aggregate Roots / Entities here. */ + + #region Entities from the modules + + /* Notice: We only implemented IIdentityDbContext and ITenantManagementDbContext + * and replaced them for this DbContext. This allows you to perform JOIN + * queries for the entities of these modules over the repositories easily. You + * typically don't need that for other modules. But, if you need, you can + * implement the DbContext interface of the needed module and use ReplaceDbContext + * attribute just like IIdentityDbContext and ITenantManagementDbContext. + * + * More info: Replacing a DbContext of a module ensures that the related module + * uses this DbContext on runtime. Otherwise, it will use its own DbContext class. + */ + + //Identity + public DbSet Users { get; set; } + public DbSet Roles { get; set; } + public DbSet ClaimTypes { get; set; } + public DbSet OrganizationUnits { get; set; } + public DbSet SecurityLogs { get; set; } + public DbSet LinkUsers { get; set; } + public DbSet UserDelegations { get; set; } + + public DbSet Sessions { get; set; } + + // Tenant Management + public DbSet Tenants { get; set; } + public DbSet TenantConnectionStrings { get; set; } + + #endregion +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/TenantManagementDbContextFactory.cs b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/TenantManagementDbContextFactory.cs index 491c202..c9c9ad5 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/TenantManagementDbContextFactory.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/TenantManagementDbContextFactory.cs @@ -29,8 +29,8 @@ public class TenantManagementDbContextFactory : IDesignTimeDbContextFactory { - /* You can configure extra properties for the - * entities defined in the modules used by your application. - * - * This class can be used to map these extra properties to table fields in the database. - * - * USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING. - * USE TenantManagementModuleExtensionConfigurator CLASS (in the Domain.Shared project) - * FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES - * - * Example: Map a property to a table field: + /* You can configure extra properties for the + * entities defined in the modules used by your application. + * + * This class can be used to map these extra properties to table fields in the database. + * + * USE THIS CLASS ONLY TO CONFIGURE EF CORE RELATED MAPPING. + * USE TenantManagementModuleExtensionConfigurator CLASS (in the Domain.Shared project) + * FOR A HIGH LEVEL API TO DEFINE EXTRA PROPERTIES TO ENTITIES OF THE USED MODULES + * + * Example: Map a property to a table field: - ObjectExtensionManager.Instance - .MapEfCoreProperty( - "MyProperty", - (entityBuilder, propertyBuilder) => - { - propertyBuilder.HasMaxLength(128); - } - ); + ObjectExtensionManager.Instance + .MapEfCoreProperty( + "MyProperty", + (entityBuilder, propertyBuilder) => + { + propertyBuilder.HasMaxLength(128); + } + ); - * See the documentation for more: - * https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities - */ + * See the documentation for more: + * https://docs.abp.io/en/abp/latest/Customizing-Application-Modules-Extending-Entities + */ }); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/TenantManagementEntityFrameworkCoreModule.cs b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/TenantManagementEntityFrameworkCoreModule.cs index 19ad7ae..489960e 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/TenantManagementEntityFrameworkCoreModule.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/EntityFrameworkCore/TenantManagementEntityFrameworkCoreModule.cs @@ -1,6 +1,5 @@ using System; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Uow; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.BackgroundJobs.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; @@ -26,7 +25,7 @@ namespace KonSoft.TenantManagement.EntityFrameworkCore; typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule) - )] +)] public class TenantManagementEntityFrameworkCoreModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -41,17 +40,16 @@ public class TenantManagementEntityFrameworkCoreModule : AbpModule { context.Services.AddAbpDbContext(options => { - /* Remove "includeAllEntities: true" to create - * default repositories only for aggregate roots */ - options.AddDefaultRepositories(includeAllEntities: true); + /* Remove "includeAllEntities: true" to create + * default repositories only for aggregate roots */ + options.AddDefaultRepositories(true); }); Configure(options => { - /* The main point to change your DBMS. - * See also TenantManagementMigrationsDbContextFactory for EF Core tooling. */ + /* The main point to change your DBMS. + * See also TenantManagementMigrationsDbContextFactory for EF Core tooling. */ options.UseNpgsql(); }); - } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/KonSoft.TenantManagement.EntityFrameworkCore.csproj b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/KonSoft.TenantManagement.EntityFrameworkCore.csproj index e5217c1..3eb3c3f 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/KonSoft.TenantManagement.EntityFrameworkCore.csproj +++ b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/KonSoft.TenantManagement.EntityFrameworkCore.csproj @@ -29,4 +29,8 @@ + + + + diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/Properties/AssemblyInfo.cs b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/Properties/AssemblyInfo.cs index 135e6af..45a8aa7 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/Properties/AssemblyInfo.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.EntityFrameworkCore/Properties/AssemblyInfo.cs @@ -1,2 +1,3 @@ using System.Runtime.CompilerServices; -[assembly:InternalsVisibleToAttribute("KonSoft.TenantManagement.EntityFrameworkCore.Tests")] + +[assembly: InternalsVisibleToAttribute("KonSoft.TenantManagement.EntityFrameworkCore.Tests")] \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi.Client/TenantManagementHttpApiClientModule.cs b/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi.Client/TenantManagementHttpApiClientModule.cs index ed63970..d090729 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi.Client/TenantManagementHttpApiClientModule.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi.Client/TenantManagementHttpApiClientModule.cs @@ -4,8 +4,8 @@ using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; -using Volo.Abp.TenantManagement; using Volo.Abp.SettingManagement; +using Volo.Abp.TenantManagement; using Volo.Abp.VirtualFileSystem; namespace KonSoft.TenantManagement; @@ -26,8 +26,7 @@ public class TenantManagementHttpApiClientModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { context.Services.AddHttpClientProxies( - typeof(TenantManagementApplicationContractsModule).Assembly, - RemoteServiceName + typeof(TenantManagementApplicationContractsModule).Assembly ); Configure(options => @@ -35,4 +34,4 @@ public class TenantManagementHttpApiClientModule : AbpModule options.FileSets.AddEmbedded(); }); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi/Controllers/TenantManagementController.cs b/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi/Controllers/TenantManagementController.cs index e4b323b..ed241fa 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi/Controllers/TenantManagementController.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi/Controllers/TenantManagementController.cs @@ -11,4 +11,4 @@ public abstract class TenantManagementController : AbpControllerBase { LocalizationResource = typeof(TenantManagementResource); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi/Models/Test/TestModel.cs b/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi/Models/Test/TestModel.cs index e790d7b..cf1a6ab 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi/Models/Test/TestModel.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi/Models/Test/TestModel.cs @@ -7,4 +7,4 @@ public class TestModel public string? Name { get; set; } public DateTime BirthDate { get; set; } -} +} \ No newline at end of file diff --git a/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi/TenantManagementHttpApiModule.cs b/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi/TenantManagementHttpApiModule.cs index 3e5bea8..16ef17e 100644 --- a/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi/TenantManagementHttpApiModule.cs +++ b/modules/tenant-management/src/KonSoft.TenantManagement.HttpApi/TenantManagementHttpApiModule.cs @@ -1,5 +1,5 @@ -using Localization.Resources.AbpUi; -using KonSoft.TenantManagement.Localization; +using KonSoft.TenantManagement.Localization; +using Localization.Resources.AbpUi; using Volo.Abp.Account; using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; @@ -19,7 +19,7 @@ namespace KonSoft.TenantManagement; typeof(AbpTenantManagementHttpApiModule), typeof(AbpFeatureManagementHttpApiModule), typeof(AbpSettingManagementHttpApiModule) - )] +)] public class TenantManagementHttpApiModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) @@ -38,4 +38,4 @@ public class TenantManagementHttpApiModule : AbpModule ); }); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.Application.Tests/Samples/SampleAppServiceTests.cs b/modules/tenant-management/test/KonSoft.TenantManagement.Application.Tests/Samples/SampleAppServiceTests.cs index a0ce7da..517ad0f 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.Application.Tests/Samples/SampleAppServiceTests.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.Application.Tests/Samples/SampleAppServiceTests.cs @@ -1,5 +1,5 @@ -using Shouldly; -using System.Threading.Tasks; +using System.Threading.Tasks; +using Shouldly; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Xunit; @@ -31,4 +31,4 @@ public abstract class SampleAppServiceTests : TenantManagementAp result.TotalCount.ShouldBeGreaterThan(0); result.Items.ShouldContain(u => u.UserName == "admin"); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.Application.Tests/TenantManagementApplicationTestBase.cs b/modules/tenant-management/test/KonSoft.TenantManagement.Application.Tests/TenantManagementApplicationTestBase.cs index e6b0448..5adbaf9 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.Application.Tests/TenantManagementApplicationTestBase.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.Application.Tests/TenantManagementApplicationTestBase.cs @@ -5,5 +5,4 @@ namespace KonSoft.TenantManagement; public abstract class TenantManagementApplicationTestBase : TenantManagementTestBase where TStartupModule : IAbpModule { - -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.Application.Tests/TenantManagementApplicationTestModule.cs b/modules/tenant-management/test/KonSoft.TenantManagement.Application.Tests/TenantManagementApplicationTestModule.cs index b57a624..67eed6e 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.Application.Tests/TenantManagementApplicationTestModule.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.Application.Tests/TenantManagementApplicationTestModule.cs @@ -8,5 +8,4 @@ namespace KonSoft.TenantManagement; )] public class TenantManagementApplicationTestModule : AbpModule { - -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.Domain.Tests/Samples/SampleDomainTests.cs b/modules/tenant-management/test/KonSoft.TenantManagement.Domain.Tests/Samples/SampleDomainTests.cs index c7a2b7b..7e2abf6 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.Domain.Tests/Samples/SampleDomainTests.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.Domain.Tests/Samples/SampleDomainTests.cs @@ -14,8 +14,8 @@ namespace KonSoft.TenantManagement.Samples; public abstract class SampleDomainTests : TenantManagementDomainTestBase where TStartupModule : IAbpModule { - private readonly IIdentityUserRepository _identityUserRepository; private readonly IdentityUserManager _identityUserManager; + private readonly IIdentityUserRepository _identityUserRepository; protected SampleDomainTests() { @@ -43,4 +43,4 @@ public abstract class SampleDomainTests : TenantManagementDomain adminUser = await _identityUserRepository.FindByNormalizedUserNameAsync("ADMIN"); adminUser.Email.ShouldBe("newemail@abp.io"); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.Domain.Tests/TenantManagementDomainTestBase.cs b/modules/tenant-management/test/KonSoft.TenantManagement.Domain.Tests/TenantManagementDomainTestBase.cs index c73497f..1916336 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.Domain.Tests/TenantManagementDomainTestBase.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.Domain.Tests/TenantManagementDomainTestBase.cs @@ -6,5 +6,4 @@ namespace KonSoft.TenantManagement; public abstract class TenantManagementDomainTestBase : TenantManagementTestBase where TStartupModule : IAbpModule { - -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.Domain.Tests/TenantManagementDomainTestModule.cs b/modules/tenant-management/test/KonSoft.TenantManagement.Domain.Tests/TenantManagementDomainTestModule.cs index 6847984..7762587 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.Domain.Tests/TenantManagementDomainTestModule.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.Domain.Tests/TenantManagementDomainTestModule.cs @@ -8,5 +8,4 @@ namespace KonSoft.TenantManagement; )] public class TenantManagementDomainTestModule : AbpModule { - -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs index a6e4e59..39945eb 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/Applications/EfCoreSampleAppServiceTests.cs @@ -6,5 +6,4 @@ namespace KonSoft.TenantManagement.EntityFrameworkCore.Applications; [Collection(TenantManagementTestConsts.CollectionDefinitionName)] public class EfCoreSampleAppServiceTests : SampleAppServiceTests { - -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs index 9fddfdc..b343f0a 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/Domains/EfCoreSampleDomainTests.cs @@ -6,5 +6,4 @@ namespace KonSoft.TenantManagement.EntityFrameworkCore.Domains; [Collection(TenantManagementTestConsts.CollectionDefinitionName)] public class EfCoreSampleDomainTests : SampleDomainTests { - -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs index 239ff03..e146c1c 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/Samples/SampleRepositoryTests.cs @@ -1,8 +1,8 @@ -using Microsoft.EntityFrameworkCore; -using Shouldly; -using System; +using System; using System.Linq; using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Shouldly; using Volo.Abp.Domain.Repositories; using Volo.Abp.Identity; using Xunit; @@ -32,13 +32,13 @@ public class SampleRepositoryTests : TenantManagementEntityFrameworkCoreTestBase */ await WithUnitOfWorkAsync(async () => { - //Act - var adminUser = await (await _appUserRepository.GetQueryableAsync()) + //Act + var adminUser = await (await _appUserRepository.GetQueryableAsync()) .Where(u => u.UserName == "admin") .FirstOrDefaultAsync(); - //Assert - adminUser.ShouldNotBeNull(); + //Assert + adminUser.ShouldNotBeNull(); }); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreCollection.cs b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreCollection.cs index 060cb03..4095e33 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreCollection.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreCollection.cs @@ -3,7 +3,7 @@ namespace KonSoft.TenantManagement.EntityFrameworkCore; [CollectionDefinition(TenantManagementTestConsts.CollectionDefinitionName)] -public class TenantManagementEntityFrameworkCoreCollection : ICollectionFixture +public class + TenantManagementEntityFrameworkCoreCollection : ICollectionFixture { - -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreCollectionFixtureBase.cs b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreCollectionFixtureBase.cs index 850ce94..3bfe197 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreCollectionFixtureBase.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreCollectionFixtureBase.cs @@ -1,9 +1,9 @@ -using KonSoft.TenantManagement.EntityFrameworkCore; -using Xunit; +using Xunit; namespace KonSoft.TenantManagement.EntityFrameworkCore; -public class TenantManagementEntityFrameworkCoreCollectionFixtureBase : ICollectionFixture +public class + TenantManagementEntityFrameworkCoreCollectionFixtureBase : ICollectionFixture< + TenantManagementEntityFrameworkCoreFixture> { - -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreFixture.cs b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreFixture.cs index f4b25a7..75a70f2 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreFixture.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreFixture.cs @@ -6,6 +6,5 @@ public class TenantManagementEntityFrameworkCoreFixture : IDisposable { public void Dispose() { - } -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreTestBase.cs b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreTestBase.cs index 89a75dd..d06d8b5 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreTestBase.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreTestBase.cs @@ -1,8 +1,7 @@ -using Volo.Abp; +namespace KonSoft.TenantManagement.EntityFrameworkCore; -namespace KonSoft.TenantManagement.EntityFrameworkCore; - -public abstract class TenantManagementEntityFrameworkCoreTestBase : TenantManagementTestBase +public abstract class + TenantManagementEntityFrameworkCoreTestBase : TenantManagementTestBase< + TenantManagementEntityFrameworkCoreTestModule> { - -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreTestModule.cs b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreTestModule.cs index 9a4e308..4fdcfa6 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreTestModule.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.EntityFrameworkCore.Tests/EntityFrameworkCore/TenantManagementEntityFrameworkCoreTestModule.cs @@ -18,7 +18,7 @@ namespace KonSoft.TenantManagement.EntityFrameworkCore; typeof(TenantManagementApplicationTestModule), typeof(TenantManagementEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqliteModule) - )] +)] public class TenantManagementEntityFrameworkCoreTestModule : AbpModule { private SqliteConnection? _sqliteConnection; @@ -51,10 +51,7 @@ public class TenantManagementEntityFrameworkCoreTestModule : AbpModule services.Configure(options => { - options.Configure(context => - { - context.DbContextOptions.UseSqlite(_sqliteConnection); - }); + options.Configure(context => { context.DbContextOptions.UseSqlite(_sqliteConnection); }); }); } @@ -79,4 +76,4 @@ public class TenantManagementEntityFrameworkCoreTestModule : AbpModule return connection; } -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs b/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs index a388b25..6dda170 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/ClientDemoService.cs @@ -22,4 +22,4 @@ public class ClientDemoService : ITransientDependency Console.WriteLine($"Name : {output.Name}"); Console.WriteLine($"Surname : {output.Surname}"); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs index 9c4f85a..2010c24 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -1,8 +1,8 @@ -using Microsoft.Extensions.Hosting; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Volo.Abp; namespace KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp; @@ -18,11 +18,12 @@ public class ConsoleTestAppHostedService : IHostedService public async Task StartAsync(CancellationToken cancellationToken) { - using (var application = await AbpApplicationFactory.CreateAsync(options => - { - options.Services.ReplaceConfiguration(_configuration); - options.UseAutofac(); - })) + using (var application = + await AbpApplicationFactory.CreateAsync(options => + { + options.Services.ReplaceConfiguration(_configuration); + options.UseAutofac(); + })) { await application.InitializeAsync(); @@ -37,4 +38,4 @@ public class ConsoleTestAppHostedService : IHostedService { return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/Program.cs b/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/Program.cs index d836b73..891d756 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/Program.cs @@ -1,22 +1,23 @@ using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp; -class Program +internal class Program { - static async Task Main(string[] args) + private static async Task Main(string[] args) { await CreateHostBuilder(args).RunConsoleAsync(); } - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) + public static IHostBuilder CreateHostBuilder(string[] args) + { + return Host.CreateDefaultBuilder(args) .AddAppSettingsSecretsJson() .ConfigureServices((hostContext, services) => { services.AddHostedService(); }); -} + } +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/TenantManagementConsoleApiClientModule.cs b/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/TenantManagementConsoleApiClientModule.cs index a265cfd..a3be6de 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/TenantManagementConsoleApiClientModule.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp/TenantManagementConsoleApiClientModule.cs @@ -12,7 +12,7 @@ namespace KonSoft.TenantManagement.HttpApi.Client.ConsoleTestApp; typeof(AbpAutofacModule), typeof(TenantManagementHttpApiClientModule), typeof(AbpHttpClientIdentityModelModule) - )] +)] public class TenantManagementConsoleApiClientModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -21,10 +21,10 @@ public class TenantManagementConsoleApiClientModule : AbpModule { options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) => { - clientBuilder.AddTransientHttpErrorPolicy( - policyBuilder => policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) + clientBuilder.AddTransientHttpErrorPolicy(policyBuilder => + policyBuilder.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(Math.Pow(2, i))) ); }); }); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/Security/FakeCurrentPrincipalAccessor.cs b/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/Security/FakeCurrentPrincipalAccessor.cs index e08ed88..41a6736 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/Security/FakeCurrentPrincipalAccessor.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/Security/FakeCurrentPrincipalAccessor.cs @@ -17,9 +17,9 @@ public class FakeCurrentPrincipalAccessor : ThreadCurrentPrincipalAccessor { return new ClaimsPrincipal(new ClaimsIdentity(new List { - new Claim(AbpClaimTypes.UserId, "2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), - new Claim(AbpClaimTypes.UserName, "admin"), - new Claim(AbpClaimTypes.Email, "admin@abp.io") + new(AbpClaimTypes.UserId, "2e701e62-0953-4dd3-910b-dc6cc93ccb0d"), + new(AbpClaimTypes.UserName, "admin"), + new(AbpClaimTypes.Email, "admin@abp.io") })); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestBase.cs b/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestBase.cs index b5e1fbe..b882382 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestBase.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestBase.cs @@ -3,8 +3,8 @@ using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; using Volo.Abp.Modularity; -using Volo.Abp.Uow; using Volo.Abp.Testing; +using Volo.Abp.Uow; namespace KonSoft.TenantManagement; @@ -43,7 +43,8 @@ public abstract class TenantManagementTestBase : AbpIntegratedTe return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); } - protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, Func> func) + protected virtual async Task WithUnitOfWorkAsync(AbpUnitOfWorkOptions options, + Func> func) { using (var scope = ServiceProvider.CreateScope()) { @@ -57,4 +58,4 @@ public abstract class TenantManagementTestBase : AbpIntegratedTe } } } -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestBaseModule.cs b/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestBaseModule.cs index 2ed6282..8c1a604 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestBaseModule.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestBaseModule.cs @@ -14,15 +14,12 @@ namespace KonSoft.TenantManagement; typeof(AbpTestBaseModule), typeof(AbpAuthorizationModule), typeof(AbpBackgroundJobsAbstractionsModule) - )] +)] public class TenantManagementTestBaseModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => - { - options.IsJobExecutionEnabled = false; - }); + Configure(options => { options.IsJobExecutionEnabled = false; }); context.Services.AddAlwaysAllowAuthorization(); } @@ -44,4 +41,4 @@ public class TenantManagementTestBaseModule : AbpModule } }); } -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestConsts.cs b/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestConsts.cs index fbb37d2..61bd383 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestConsts.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestConsts.cs @@ -3,4 +3,4 @@ public static class TenantManagementTestConsts { public const string CollectionDefinitionName = "TenantManagement collection"; -} +} \ No newline at end of file diff --git a/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestDataSeedContributor.cs b/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestDataSeedContributor.cs index ffc9d62..54d1732 100644 --- a/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestDataSeedContributor.cs +++ b/modules/tenant-management/test/KonSoft.TenantManagement.TestBase/TenantManagementTestDataSeedContributor.cs @@ -12,4 +12,4 @@ public class TenantManagementTestDataSeedContributor : IDataSeedContributor, ITr return Task.CompletedTask; } -} +} \ No newline at end of file diff --git a/shared/KonSoft.Shared.Hosting.AspNetCore/ApplicationBuilderHelper.cs b/shared/KonSoft.Shared.Hosting.AspNetCore/ApplicationBuilderHelper.cs index 18e2eee..220fb30 100644 --- a/shared/KonSoft.Shared.Hosting.AspNetCore/ApplicationBuilderHelper.cs +++ b/shared/KonSoft.Shared.Hosting.AspNetCore/ApplicationBuilderHelper.cs @@ -1,8 +1,10 @@ -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Serilog; +using System; +using System.Threading.Tasks; using Volo.Abp.Modularity; namespace KonSoft.Shared.Hosting.AspNetCore; @@ -13,6 +15,11 @@ public static class ApplicationBuilderHelper where TStartupModule : IAbpModule { var builder = WebApplication.CreateBuilder(args); + builder.Configuration + .AddAgileConfig(option => + { + option.ENV = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Development"; + }); builder.Host .AddAppSettingsSecretsJson() .UseAutofac() diff --git a/shared/KonSoft.Shared.Hosting.AspNetCore/KonSoft.Shared.Hosting.AspNetCore.csproj b/shared/KonSoft.Shared.Hosting.AspNetCore/KonSoft.Shared.Hosting.AspNetCore.csproj index c60ec75..67e692d 100644 --- a/shared/KonSoft.Shared.Hosting.AspNetCore/KonSoft.Shared.Hosting.AspNetCore.csproj +++ b/shared/KonSoft.Shared.Hosting.AspNetCore/KonSoft.Shared.Hosting.AspNetCore.csproj @@ -12,6 +12,7 @@ + diff --git a/shared/KonSoft.Shared.Hosting.AspNetCore/KonSoftBrandingProvider.cs b/shared/KonSoft.Shared.Hosting.AspNetCore/KonSoftBrandingProvider.cs index 891b26c..c318369 100644 --- a/shared/KonSoft.Shared.Hosting.AspNetCore/KonSoftBrandingProvider.cs +++ b/shared/KonSoft.Shared.Hosting.AspNetCore/KonSoftBrandingProvider.cs @@ -1,11 +1,10 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.Ui.Branding; -namespace KonSoft.Shared.Hosting.AspNetCore +namespace KonSoft.Shared.Hosting.AspNetCore; + +[Dependency(ReplaceServices = true)] +public class KonSoftBrandingProvider : DefaultBrandingProvider { - [Dependency(ReplaceServices = true)] - public class KonSoftBrandingProvider : DefaultBrandingProvider - { - public override string AppName => "KonSoft"; - } -} + public override string AppName => "KonSoft"; +} \ No newline at end of file diff --git a/shared/KonSoft.Shared.Hosting.AspNetCore/KonSoftSharedHostingAspNetCoreModule.cs b/shared/KonSoft.Shared.Hosting.AspNetCore/KonSoftSharedHostingAspNetCoreModule.cs index d9e269d..fd8588b 100644 --- a/shared/KonSoft.Shared.Hosting.AspNetCore/KonSoftSharedHostingAspNetCoreModule.cs +++ b/shared/KonSoft.Shared.Hosting.AspNetCore/KonSoftSharedHostingAspNetCoreModule.cs @@ -5,28 +5,24 @@ using Volo.Abp.MultiTenancy; using Volo.Abp.Swashbuckle; using Volo.Abp.VirtualFileSystem; -namespace KonSoft.Shared.Hosting.AspNetCore -{ - [DependsOn( - typeof(KonSoftSharedLocalizationModule), - typeof(KonSoftSharedHostingModule), - typeof(AbpAspNetCoreSerilogModule), - typeof(AbpSwashbuckleModule), - typeof(AbpMultiTenancyModule) - )] - public class KonSoftSharedHostingAspNetCoreModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - Configure(options => - { - options.FileSets.AddEmbedded("KonSoft.Shared.Hosting.AspNetCore"); - }); +namespace KonSoft.Shared.Hosting.AspNetCore; - Configure(options => - { - options.IsEnabled = KonSoftConsts.MultiTenancyEnabled; - }); - } +[DependsOn( + typeof(KonSoftSharedLocalizationModule), + typeof(KonSoftSharedHostingModule), + typeof(AbpAspNetCoreSerilogModule), + typeof(AbpSwashbuckleModule), + typeof(AbpMultiTenancyModule) +)] +public class KonSoftSharedHostingAspNetCoreModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded("KonSoft.Shared.Hosting.AspNetCore"); + }); + + Configure(options => { options.IsEnabled = KonSoftConsts.MultiTenancyEnabled; }); } -} +} \ No newline at end of file diff --git a/shared/KonSoft.Shared.Hosting.AspNetCore/SwaggerConfigurationHelper.cs b/shared/KonSoft.Shared.Hosting.AspNetCore/SwaggerConfigurationHelper.cs index d2a0537..d88666f 100644 --- a/shared/KonSoft.Shared.Hosting.AspNetCore/SwaggerConfigurationHelper.cs +++ b/shared/KonSoft.Shared.Hosting.AspNetCore/SwaggerConfigurationHelper.cs @@ -18,10 +18,10 @@ public static class SwaggerConfigurationHelper ) { context.Services.AddAbpSwaggerGenWithOidc( - authority: authority, - scopes: scopes, - flows: flows, - discoveryEndpoint: discoveryEndpoint, + authority, + scopes, + flows, + discoveryEndpoint, options => { options.SwaggerDoc(apiName, new OpenApiInfo { Title = apiTitle, Version = apiVersion }); diff --git a/shared/KonSoft.Shared.Hosting.Gateways/Class1.cs b/shared/KonSoft.Shared.Hosting.Gateways/Class1.cs deleted file mode 100644 index 1570854..0000000 --- a/shared/KonSoft.Shared.Hosting.Gateways/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace KonSoft.Shared.Hosting.Gateways -{ - public class Class1 - { - - } -} diff --git a/shared/KonSoft.Shared.Hosting.Gateways/KonSoft.Shared.Hosting.Gateways.csproj b/shared/KonSoft.Shared.Hosting.Gateways/KonSoft.Shared.Hosting.Gateways.csproj index 51a05d1..d380fd6 100644 --- a/shared/KonSoft.Shared.Hosting.Gateways/KonSoft.Shared.Hosting.Gateways.csproj +++ b/shared/KonSoft.Shared.Hosting.Gateways/KonSoft.Shared.Hosting.Gateways.csproj @@ -6,4 +6,8 @@ enable + + + + diff --git a/shared/KonSoft.Shared.Hosting.Gateways/KonSoftSharedHostingGatewaysModule.cs b/shared/KonSoft.Shared.Hosting.Gateways/KonSoftSharedHostingGatewaysModule.cs new file mode 100644 index 0000000..a412920 --- /dev/null +++ b/shared/KonSoft.Shared.Hosting.Gateways/KonSoftSharedHostingGatewaysModule.cs @@ -0,0 +1,11 @@ +using KonSoft.Shared.Hosting.AspNetCore; +using Volo.Abp.Modularity; + +namespace KonSoft.Shared.Hosting.Gateways; + +[DependsOn( + typeof(KonSoftSharedHostingAspNetCoreModule) + )] +public class KonSoftSharedHostingGatewaysModule : AbpModule +{ +} \ No newline at end of file diff --git a/shared/KonSoft.Shared.Hosting.Microservices/DbMigrations/EfCore/PendingEfCoreMigrationsChecker.cs b/shared/KonSoft.Shared.Hosting.Microservices/DbMigrations/EfCore/PendingEfCoreMigrationsChecker.cs index 2579c4c..dadf1df 100644 --- a/shared/KonSoft.Shared.Hosting.Microservices/DbMigrations/EfCore/PendingEfCoreMigrationsChecker.cs +++ b/shared/KonSoft.Shared.Hosting.Microservices/DbMigrations/EfCore/PendingEfCoreMigrationsChecker.cs @@ -1,9 +1,9 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using Serilog; -using System; +using System; using System.Linq; using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using Serilog; using Volo.Abp; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; @@ -12,98 +12,97 @@ using Volo.Abp.EventBus.Distributed; using Volo.Abp.MultiTenancy; using Volo.Abp.Uow; -namespace KonSoft.Shared.Hosting.Microservices.DbMigrations.EfCore +namespace KonSoft.Shared.Hosting.Microservices.DbMigrations.EfCore; + +public abstract class PendingEfCoreMigrationsChecker : ITransientDependency + where TDbContext : DbContext { - public abstract class PendingEfCoreMigrationsChecker : ITransientDependency - where TDbContext : DbContext + protected PendingEfCoreMigrationsChecker( + IUnitOfWorkManager unitOfWorkManager, + IServiceProvider serviceProvider, + ICurrentTenant currentTenant, + IDistributedEventBus distributedEventBus, + IAbpDistributedLock abpDistributedLock, + string databaseName) { - protected IUnitOfWorkManager UnitOfWorkManager { get; } - protected IServiceProvider ServiceProvider { get; } - protected ICurrentTenant CurrentTenant { get; } - protected IDistributedEventBus DistributedEventBus { get; } - protected IAbpDistributedLock DistributedLockProvider { get; } - protected string DatabaseName { get; } + UnitOfWorkManager = unitOfWorkManager; + ServiceProvider = serviceProvider; + CurrentTenant = currentTenant; + DistributedEventBus = distributedEventBus; + DistributedLockProvider = abpDistributedLock; + DatabaseName = databaseName; + } - protected PendingEfCoreMigrationsChecker( - IUnitOfWorkManager unitOfWorkManager, - IServiceProvider serviceProvider, - ICurrentTenant currentTenant, - IDistributedEventBus distributedEventBus, - IAbpDistributedLock abpDistributedLock, - string databaseName) + protected IUnitOfWorkManager UnitOfWorkManager { get; } + protected IServiceProvider ServiceProvider { get; } + protected ICurrentTenant CurrentTenant { get; } + protected IDistributedEventBus DistributedEventBus { get; } + protected IAbpDistributedLock DistributedLockProvider { get; } + protected string DatabaseName { get; } + + public virtual async Task CheckAndApplyDatabaseMigrationsAsync() + { + await TryAsync(LockAndApplyDatabaseMigrationsAsync); + } + + protected async Task TryAsync(Func task, int retryCount = 3) + { + try { - UnitOfWorkManager = unitOfWorkManager; - ServiceProvider = serviceProvider; - CurrentTenant = currentTenant; - DistributedEventBus = distributedEventBus; - DistributedLockProvider = abpDistributedLock; - DatabaseName = databaseName; + await task(); } - - public virtual async Task CheckAndApplyDatabaseMigrationsAsync() + catch (Exception ex) { - await TryAsync(LockAndApplyDatabaseMigrationsAsync); - } + retryCount--; - protected async Task TryAsync(Func task, int retryCount = 3) - { - try + if (retryCount <= 0) { - await task(); + throw; } - catch (Exception ex) - { - retryCount--; - if (retryCount <= 0) - { - throw; - } + Log.Warning( + $"{ex.GetType().Name} has been thrown. The operation will be tried {retryCount} times more. Exception:\n{ex.Message}"); - Log.Warning($"{ex.GetType().Name} has been thrown. The operation will be tried {retryCount} times more. Exception:\n{ex.Message}"); + await Task.Delay(RandomHelper.GetRandom(5000, 15000)); - await Task.Delay(RandomHelper.GetRandom(5000, 15000)); - - await TryAsync(task, retryCount); - } - } - - protected virtual async Task LockAndApplyDatabaseMigrationsAsync() - { - await using (var handle = await DistributedLockProvider.TryAcquireAsync("Migration_" + DatabaseName)) - { - Log.Information($"Lock is acquired for db migration and seeding on database named: {DatabaseName}..."); - - if (handle is null) - { - Log.Information($"Handle is null because of the locking for : {DatabaseName}"); - return; - } - - using (CurrentTenant.Change(null)) - { - // Create database tables if needed - using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) - { - var dbContext = ServiceProvider.GetRequiredService(); - - var pendingMigrations = await dbContext - .Database - .GetPendingMigrationsAsync(); - - if (pendingMigrations.Any()) - { - await dbContext.Database.MigrateAsync(); - } - - await uow.CompleteAsync(); - } - - await ServiceProvider.GetRequiredService() - .SeedAsync(); - } - Log.Information($"Lock is released for db migration and seeding on database named: {DatabaseName}..."); - } + await TryAsync(task, retryCount); } } -} + + protected virtual async Task LockAndApplyDatabaseMigrationsAsync() + { + await using var handle = await DistributedLockProvider.TryAcquireAsync("Migration_" + DatabaseName); + Log.Information($"Lock is acquired for db migration and seeding on database named: {DatabaseName}..."); + + if (handle is null) + { + Log.Information($"Handle is null because of the locking for : {DatabaseName}"); + return; + } + + using (CurrentTenant.Change(null)) + { + // Create database tables if needed + using (var uow = UnitOfWorkManager.Begin(true, false)) + { + var dbContext = ServiceProvider.GetRequiredService(); + + var pendingMigrations = await dbContext + .Database + .GetPendingMigrationsAsync(); + + if (pendingMigrations.Any()) + { + await dbContext.Database.MigrateAsync(); + } + + await uow.CompleteAsync(); + } + + await ServiceProvider.GetRequiredService() + .SeedAsync(); + } + + Log.Information($"Lock is released for db migration and seeding on database named: {DatabaseName}..."); + } +} \ No newline at end of file diff --git a/shared/KonSoft.Shared.Hosting.Microservices/KonSoftSharedHostingMicroservivesModule.cs b/shared/KonSoft.Shared.Hosting.Microservices/KonSoftSharedHostingMicroservivesModule.cs index fae114e..3d02834 100644 --- a/shared/KonSoft.Shared.Hosting.Microservices/KonSoftSharedHostingMicroservivesModule.cs +++ b/shared/KonSoft.Shared.Hosting.Microservices/KonSoftSharedHostingMicroservivesModule.cs @@ -1,4 +1,6 @@ -using KonSoft.Shared.Hosting.AspNetCore; +using System; +using System.Linq; +using KonSoft.Shared.Hosting.AspNetCore; using Medallion.Threading; using Medallion.Threading.Redis; using Microsoft.AspNetCore.Authentication.JwtBearer; @@ -7,8 +9,6 @@ using Microsoft.AspNetCore.DataProtection; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using StackExchange.Redis; -using System; -using System.Linq; using Volo.Abp.AspNetCore.Authentication.JwtBearer; using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; using Volo.Abp.BackgroundJobs.RabbitMQ; @@ -21,84 +21,83 @@ using Volo.Abp.Modularity; using Volo.Abp.Security.Claims; using Volo.Abp.Swashbuckle; -namespace KonSoft.Shared.Hosting.Microservices +namespace KonSoft.Shared.Hosting.Microservices; + +[DependsOn( + typeof(KonSoftSharedHostingAspNetCoreModule), + typeof(AbpBackgroundJobsRabbitMqModule), + typeof(AbpAspNetCoreAuthenticationJwtBearerModule), + typeof(AbpEventBusRabbitMqModule), + typeof(AbpCachingStackExchangeRedisModule), + typeof(AbpDistributedLockingModule), + typeof(AbpAspNetCoreMvcUiMultiTenancyModule), + typeof(AbpEntityFrameworkCoreModule), + typeof(AbpSwashbuckleModule) +)] +public class KonSoftSharedHostingMicroservicesModule : AbpModule { - [DependsOn( - typeof(KonSoftSharedHostingAspNetCoreModule), - typeof(AbpBackgroundJobsRabbitMqModule), - typeof(AbpAspNetCoreAuthenticationJwtBearerModule), - typeof(AbpEventBusRabbitMqModule), - typeof(AbpCachingStackExchangeRedisModule), - typeof(AbpDistributedLockingModule), - typeof(AbpAspNetCoreMvcUiMultiTenancyModule), - typeof(AbpEntityFrameworkCoreModule), - typeof(AbpSwashbuckleModule) - )] - public class KonSoftSharedHostingMicroservicesModule : AbpModule + public override void ConfigureServices(ServiceConfigurationContext context) { - public override void ConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - var hostingEnvironment = context.Services.GetHostingEnvironment(); + var configuration = context.Services.GetConfiguration(); + var hostingEnvironment = context.Services.GetHostingEnvironment(); - ConfigureCache(); - ConfigureDataProtection(context, configuration); - ConfigureAuthentication(context, configuration); - ConfigureCors(context, configuration); - } - - private void ConfigureCache() - { - Configure(options => { options.KeyPrefix = "KonSoft:"; }); - } - - private void ConfigureDataProtection( - ServiceConfigurationContext context, - IConfiguration configuration) - { - context.Services.AddDataProtection().SetApplicationName("KonSoft") - .PersistKeysToStackExchangeRedis(ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!), - "KonSoft-Protection-Keys"); - - context.Services.AddSingleton(_ => - new RedisDistributedSynchronizationProvider(ConnectionMultiplexer - .Connect(configuration["Redis:Configuration"]!).GetDatabase())); - } - - private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) - { - context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddAbpJwtBearer(options => - { - options.Authority = configuration["AuthServer:Authority"]; - options.RequireHttpsMetadata = configuration.GetValue("AuthServer:RequireHttpsMetadata"); - options.Audience = KonSoftConsts.AuthServerAudience; - }); - - context.Services.Configure(options => - { - options.IsDynamicClaimsEnabled = true; - }); - } - - private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration) - { - context.Services.AddCors(options => - { - options.AddDefaultPolicy(builder => - { - builder - .WithOrigins(configuration["App:CorsOrigins"]? - .Split(",", StringSplitOptions.RemoveEmptyEntries) - .Select(o => o.RemovePostFix("/")) - .ToArray() ?? []) - .WithAbpExposedHeaders() - .SetIsOriginAllowedToAllowWildcardSubdomains() - .AllowAnyHeader() - .AllowAnyMethod() - .AllowCredentials(); - }); - }); - } + ConfigureCache(); + ConfigureDataProtection(context, configuration); + ConfigureAuthentication(context, configuration); + ConfigureCors(context, configuration); } -} + + private void ConfigureCache() + { + Configure(options => { options.KeyPrefix = "KonSoft:"; }); + } + + private void ConfigureDataProtection( + ServiceConfigurationContext context, + IConfiguration configuration) + { + context.Services.AddDataProtection().SetApplicationName("KonSoft") + .PersistKeysToStackExchangeRedis(ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!), + "KonSoft-Protection-Keys"); + + context.Services.AddSingleton(_ => + new RedisDistributedSynchronizationProvider(ConnectionMultiplexer + .Connect(configuration["Redis:Configuration"]!).GetDatabase())); + } + + private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) + { + context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) + .AddAbpJwtBearer(options => + { + options.Authority = configuration["AuthServer:Authority"]; + options.RequireHttpsMetadata = configuration.GetValue("AuthServer:RequireHttpsMetadata"); + options.Audience = KonSoftConsts.AuthServerAudience; + }); + + context.Services.Configure(options => + { + options.IsDynamicClaimsEnabled = true; + }); + } + + private void ConfigureCors(ServiceConfigurationContext context, IConfiguration configuration) + { + context.Services.AddCors(options => + { + options.AddDefaultPolicy(builder => + { + builder + .WithOrigins(configuration["App:CorsOrigins"]? + .Split(",", StringSplitOptions.RemoveEmptyEntries) + .Select(o => o.RemovePostFix("/")) + .ToArray() ?? []) + .WithAbpExposedHeaders() + .SetIsOriginAllowedToAllowWildcardSubdomains() + .AllowAnyHeader() + .AllowAnyMethod() + .AllowCredentials(); + }); + }); + } +} \ No newline at end of file diff --git a/shared/KonSoft.Shared.Hosting/KonSoftSharedHostingModule.cs b/shared/KonSoft.Shared.Hosting/KonSoftSharedHostingModule.cs index ab097b3..9c01128 100644 --- a/shared/KonSoft.Shared.Hosting/KonSoftSharedHostingModule.cs +++ b/shared/KonSoft.Shared.Hosting/KonSoftSharedHostingModule.cs @@ -2,20 +2,19 @@ using Volo.Abp.Data; using Volo.Abp.Modularity; -namespace KonSoft.Shared.Hosting +namespace KonSoft.Shared.Hosting; + +[DependsOn( + typeof(AbpAutofacModule), + typeof(AbpDataModule) +)] +public class KonSoftSharedHostingModule : AbpModule { - [DependsOn( - typeof(AbpAutofacModule), - typeof(AbpDataModule) - )] - public class KonSoftSharedHostingModule : AbpModule + public override void ConfigureServices(ServiceConfigurationContext context) { - public override void ConfigureServices(ServiceConfigurationContext context) + Configure(options => { - Configure(options => - { - // TODO Mapping DbConnections - }); - } + // TODO Mapping DbConnections + }); } -} +} \ No newline at end of file diff --git a/shared/KonSoft.Shared.Localization/KonSoftSharedLocalizationModule.cs b/shared/KonSoft.Shared.Localization/KonSoftSharedLocalizationModule.cs index 0d8a0bd..fe6454a 100644 --- a/shared/KonSoft.Shared.Localization/KonSoftSharedLocalizationModule.cs +++ b/shared/KonSoft.Shared.Localization/KonSoftSharedLocalizationModule.cs @@ -5,31 +5,29 @@ using Volo.Abp.Validation; using Volo.Abp.Validation.Localization; using Volo.Abp.VirtualFileSystem; -namespace KonSoft.Shared.Localization +namespace KonSoft.Shared.Localization; + +[DependsOn( + typeof(AbpValidationModule) +)] +public class KonSoftSharedLocalizationModule : AbpModule { - - [DependsOn( - typeof(AbpValidationModule) - )] - public class KonSoftSharedLocalizationModule : AbpModule + public override void ConfigureServices(ServiceConfigurationContext context) { - public override void ConfigureServices(ServiceConfigurationContext context) + Configure(options => { - Configure(options => - { - options.FileSets.AddEmbedded(); - }); + options.FileSets.AddEmbedded(); + }); - Configure(options => - { - options.Resources - .Add("en") - .AddBaseTypes( - typeof(AbpValidationResource) - ).AddVirtualJson("/Localization/KonSoft"); + Configure(options => + { + options.Resources + .Add("en") + .AddBaseTypes( + typeof(AbpValidationResource) + ).AddVirtualJson("/Localization/KonSoft"); - options.DefaultResourceType = typeof(KonSoftResource); - }); - } + options.DefaultResourceType = typeof(KonSoftResource); + }); } -} +} \ No newline at end of file diff --git a/shared/KonSoft.Shared.Localization/Localization/KonSoftResource.cs b/shared/KonSoft.Shared.Localization/Localization/KonSoftResource.cs index 233da77..785f6fa 100644 --- a/shared/KonSoft.Shared.Localization/Localization/KonSoftResource.cs +++ b/shared/KonSoft.Shared.Localization/Localization/KonSoftResource.cs @@ -1,9 +1,8 @@ using Volo.Abp.Localization; -namespace KonSoft.Shared.Localization.Localization +namespace KonSoft.Shared.Localization.Localization; + +[LocalizationResourceName("KonSoft")] +public class KonSoftResource { - [LocalizationResourceName("KonSoft")] - public class KonSoftResource - { - } -} +} \ No newline at end of file