From fac6f04943e89a680fe9c5e7c08bdfe46d34e21e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B7=B3?= <454313500@qq.com> Date: Mon, 22 Jan 2024 11:12:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20swagger=E9=9B=86=E6=88=90=E7=A7=9F?= =?UTF-8?q?=E6=88=B7header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.Abp.Net8/Yi.Abp.sln | 2 +- .../SwaggerAddExtensions.cs | 21 ++++++++++++++++++- .../Entities/AuditLogEntity.cs | 0 .../SqlSugarCoreAuditLogRepository.cs | 0 ...ramework.AuditLogging.SqlSugarCore.csproj} | 0 .../YiAuditLoggingDbContext.cs | 0 ...rameworkAuditLoggingSqlSugarCoreModule.cs} | 2 +- 7 files changed, 22 insertions(+), 3 deletions(-) rename Yi.Abp.Net8/module/audit-logging/{Yi.AuditLogging.SqlSugarCore => Yi.Framework.AuditLogging.SqlSugarCore}/Entities/AuditLogEntity.cs (100%) rename Yi.Abp.Net8/module/audit-logging/{Yi.AuditLogging.SqlSugarCore => Yi.Framework.AuditLogging.SqlSugarCore}/SqlSugarCoreAuditLogRepository.cs (100%) rename Yi.Abp.Net8/module/audit-logging/{Yi.AuditLogging.SqlSugarCore/Yi.AuditLogging.SqlSugarCore.csproj => Yi.Framework.AuditLogging.SqlSugarCore/Yi.Framework.AuditLogging.SqlSugarCore.csproj} (100%) rename Yi.Abp.Net8/module/audit-logging/{Yi.AuditLogging.SqlSugarCore => Yi.Framework.AuditLogging.SqlSugarCore}/YiAuditLoggingDbContext.cs (100%) rename Yi.Abp.Net8/module/audit-logging/{Yi.AuditLogging.SqlSugarCore/YiAuditLoggingSqlSugarCoreModule.cs => Yi.Framework.AuditLogging.SqlSugarCore/YiFrameworkAuditLoggingSqlSugarCoreModule.cs} (90%) diff --git a/Yi.Abp.Net8/Yi.Abp.sln b/Yi.Abp.Net8/Yi.Abp.sln index 3791f61e..b3d316e5 100644 --- a/Yi.Abp.Net8/Yi.Abp.sln +++ b/Yi.Abp.Net8/Yi.Abp.sln @@ -70,7 +70,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Bbs.SqlSugarCo EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "audit-logging", "audit-logging", "{73CCF2C4-B9FD-44AB-8D4B-0A421805B094}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.AuditLogging.SqlSugarCore", "module\audit-logging\Yi.AuditLogging.SqlSugarCore\Yi.AuditLogging.SqlSugarCore.csproj", "{48806510-8E18-4E1E-9BAF-5B97E88C5FC3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.AuditLogging.SqlSugarCore", "module\audit-logging\Yi.Framework.AuditLogging.SqlSugarCore\Yi.Framework.AuditLogging.SqlSugarCore.csproj", "{48806510-8E18-4E1E-9BAF-5B97E88C5FC3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.AspNetCore.Authentication.OAuth", "framework\Yi.Framework.AspNetCore.Authentication.OAuth\Yi.Framework.AspNetCore.Authentication.OAuth.csproj", "{791AC2FA-50D3-4408-8D68-31DA72F608BE}" EndProject diff --git a/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Microsoft/Extensions/DependencyInjection/SwaggerAddExtensions.cs b/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Microsoft/Extensions/DependencyInjection/SwaggerAddExtensions.cs index dc7c5b99..260cb64f 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Microsoft/Extensions/DependencyInjection/SwaggerAddExtensions.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Microsoft/Extensions/DependencyInjection/SwaggerAddExtensions.cs @@ -80,7 +80,7 @@ namespace Yi.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection [scheme] = new string[0] }); - + options.OperationFilter(); options.SchemaFilter(); } ); @@ -134,4 +134,23 @@ namespace Yi.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection } } + + + public class AddRequiredHeaderParameter : IOperationFilter + { + public static string HeaderKey { get; set; } = "__tenant"; + public void Apply(OpenApiOperation operation, OperationFilterContext context) + { + if (operation.Parameters == null) + operation.Parameters = new List(); + operation.Parameters.Add(new OpenApiParameter + { + Name = HeaderKey, + In = ParameterLocation.Header, + Required = false, + AllowEmptyValue = true, + Description="租户id或者租户名称(可空为默认租户)" + }); + } + } } diff --git a/Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/Entities/AuditLogEntity.cs b/Yi.Abp.Net8/module/audit-logging/Yi.Framework.AuditLogging.SqlSugarCore/Entities/AuditLogEntity.cs similarity index 100% rename from Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/Entities/AuditLogEntity.cs rename to Yi.Abp.Net8/module/audit-logging/Yi.Framework.AuditLogging.SqlSugarCore/Entities/AuditLogEntity.cs diff --git a/Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/SqlSugarCoreAuditLogRepository.cs b/Yi.Abp.Net8/module/audit-logging/Yi.Framework.AuditLogging.SqlSugarCore/SqlSugarCoreAuditLogRepository.cs similarity index 100% rename from Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/SqlSugarCoreAuditLogRepository.cs rename to Yi.Abp.Net8/module/audit-logging/Yi.Framework.AuditLogging.SqlSugarCore/SqlSugarCoreAuditLogRepository.cs diff --git a/Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/Yi.AuditLogging.SqlSugarCore.csproj b/Yi.Abp.Net8/module/audit-logging/Yi.Framework.AuditLogging.SqlSugarCore/Yi.Framework.AuditLogging.SqlSugarCore.csproj similarity index 100% rename from Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/Yi.AuditLogging.SqlSugarCore.csproj rename to Yi.Abp.Net8/module/audit-logging/Yi.Framework.AuditLogging.SqlSugarCore/Yi.Framework.AuditLogging.SqlSugarCore.csproj diff --git a/Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/YiAuditLoggingDbContext.cs b/Yi.Abp.Net8/module/audit-logging/Yi.Framework.AuditLogging.SqlSugarCore/YiAuditLoggingDbContext.cs similarity index 100% rename from Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/YiAuditLoggingDbContext.cs rename to Yi.Abp.Net8/module/audit-logging/Yi.Framework.AuditLogging.SqlSugarCore/YiAuditLoggingDbContext.cs diff --git a/Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/YiAuditLoggingSqlSugarCoreModule.cs b/Yi.Abp.Net8/module/audit-logging/Yi.Framework.AuditLogging.SqlSugarCore/YiFrameworkAuditLoggingSqlSugarCoreModule.cs similarity index 90% rename from Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/YiAuditLoggingSqlSugarCoreModule.cs rename to Yi.Abp.Net8/module/audit-logging/Yi.Framework.AuditLogging.SqlSugarCore/YiFrameworkAuditLoggingSqlSugarCoreModule.cs index ff7b4db0..78201f19 100644 --- a/Yi.Abp.Net8/module/audit-logging/Yi.AuditLogging.SqlSugarCore/YiAuditLoggingSqlSugarCoreModule.cs +++ b/Yi.Abp.Net8/module/audit-logging/Yi.Framework.AuditLogging.SqlSugarCore/YiFrameworkAuditLoggingSqlSugarCoreModule.cs @@ -8,7 +8,7 @@ namespace Yi.AuditLogging.SqlSugarCore { [DependsOn(typeof(AbpAuditLoggingDomainModule))] [DependsOn(typeof(YiFrameworkSqlSugarCoreModule))] - public class YiAuditLoggingSqlSugarCoreModule : AbpModule + public class YiFrameworkAuditLoggingSqlSugarCoreModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) {