@@ -1,6 +1,7 @@
|
||||
using IRaCIS.Core.API;
|
||||
using IRaCIS.Core.Application.BusinessFilter;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Application.MassTransit.Consumer;
|
||||
using IRaCIS.Core.Application.Service.BackGroundJob;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
@@ -16,7 +17,9 @@ using Microsoft.Extensions.Hosting;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
@@ -127,6 +130,25 @@ builder.Services.AddDicomSetup();
|
||||
// 实时应用
|
||||
builder.Services.AddSignalR();
|
||||
|
||||
//MinimalAPI
|
||||
builder.Services.AddMasaMinimalAPIs(options =>
|
||||
{
|
||||
options.Prefix = "";//自定义前缀 默认是api
|
||||
options.Version = ""; //默认是V1
|
||||
options.AutoAppendId = false; //路由是否自动附加参数Id 默认是true
|
||||
options.PluralizeServiceName = false; //服务名称是否启用复数
|
||||
|
||||
//options.Assemblies = new List<Assembly>() { typeof(UserSiteSurveySubmitedEventConsumer).Assembly };
|
||||
|
||||
options.GetPrefixes = new List<string> { "Get", "Select", "Find" };
|
||||
options.PostPrefixes = new List<string> { "Post", "Add", "Create" };
|
||||
options.PutPrefixes = new List<string> { "Put", /*"Update"*/ };
|
||||
options.DeletePrefixes = new List<string> { "Delete", "Remove" };
|
||||
|
||||
|
||||
options.DisableAutoMapRoute = false;//可通过配置true禁用全局自动路由映射或者删除此配置以启用全局自动路由映射
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
var app = builder.Build();
|
||||
@@ -134,6 +156,8 @@ var env = app.Environment;
|
||||
|
||||
#region 配置中间件
|
||||
|
||||
|
||||
|
||||
app.UseMiddleware<EncryptionRequestMiddleware>();
|
||||
|
||||
#region 异常处理 全局业务异常已统一处理了,非业务错误会来到这里 400 -500状态码
|
||||
@@ -233,6 +257,13 @@ app.MapControllers();
|
||||
app.MapHub<UploadHub>("/UploadHub");
|
||||
app.MapHealthChecks("/health");
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
//Map MinimalAPI routes
|
||||
app.MapMasaMinimalAPIs();
|
||||
|
||||
// Serilog
|
||||
SerilogExtension.AddSerilogSetup(enviromentName, app.Services);
|
||||
|
||||
@@ -240,8 +271,6 @@ var hangfireJobService = app.Services.GetRequiredService<IIRaCISHangfireJob>();
|
||||
|
||||
await hangfireJobService.InitHangfireJobTaskAsync();
|
||||
|
||||
#endregion
|
||||
|
||||
try
|
||||
{
|
||||
#region 运行环境 部署平台
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace IRaCIS.Core.API
|
||||
options.SwaggerDoc("Image", new OpenApiInfo { Title = "影像模块", Version = "Image" });
|
||||
options.SwaggerDoc("Reading", new OpenApiInfo { Title = "读片模块", Version = "Reading" });
|
||||
|
||||
// Add "General" fallback group for ungrouped APIs
|
||||
//options.SwaggerDoc("General", new OpenApiInfo { Title = "未分类模块", Version = "General" });
|
||||
|
||||
// 接口排序
|
||||
options.OrderActionsBy(o => o.GroupName);
|
||||
@@ -47,6 +49,7 @@ namespace IRaCIS.Core.API
|
||||
.OfType<ApiExplorerSettingsAttribute>()
|
||||
.Select(attr => attr.GroupName);
|
||||
|
||||
//return versions.Any(v => v == docName) || (docName == "General" && !versions.Any());
|
||||
return versions.Any(v => v.ToString() == docName);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user