|
|
@ -1,4 +1,5 @@ |
|
|
using EShopOnAbp.CmskitService.EntityFrameworkCore; |
|
|
using EShopOnAbp.CmskitService.DbMigrations; |
|
|
|
|
|
using EShopOnAbp.CmskitService.EntityFrameworkCore; |
|
|
using EShopOnAbp.Shared.Hosting.AspNetCore; |
|
|
using EShopOnAbp.Shared.Hosting.AspNetCore; |
|
|
using EShopOnAbp.Shared.Hosting.Microservices; |
|
|
using EShopOnAbp.Shared.Hosting.Microservices; |
|
|
using Microsoft.AspNetCore.Builder; |
|
|
using Microsoft.AspNetCore.Builder; |
|
|
@ -9,16 +10,24 @@ using Microsoft.Extensions.Hosting; |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
|
|
|
using System.Threading.Tasks; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp.AspNetCore.Mvc; |
|
|
using Volo.Abp.AspNetCore.Mvc; |
|
|
|
|
|
using Volo.Abp.AspNetCore.Mvc.AntiForgery; |
|
|
|
|
|
using Volo.Abp.Http.Client.IdentityModel.Web; |
|
|
|
|
|
using Volo.Abp.Identity; |
|
|
using Volo.Abp.Modularity; |
|
|
using Volo.Abp.Modularity; |
|
|
|
|
|
using Volo.CmsKit.Comments; |
|
|
|
|
|
using Volo.CmsKit.Ratings; |
|
|
|
|
|
|
|
|
namespace EShopOnAbp.CmskitService; |
|
|
namespace EShopOnAbp.CmskitService; |
|
|
[DependsOn( |
|
|
[DependsOn( |
|
|
typeof(EShopOnAbpSharedHostingMicroservicesModule), |
|
|
typeof(EShopOnAbpSharedHostingMicroservicesModule), |
|
|
typeof(CmskitServiceApplicationModule), |
|
|
typeof(CmskitServiceApplicationModule), |
|
|
typeof(CmskitServiceHttpApiModule), |
|
|
typeof(CmskitServiceHttpApiModule), |
|
|
typeof(CmskitServiceEntityFrameworkCoreModule) |
|
|
typeof(CmskitServiceEntityFrameworkCoreModule), |
|
|
|
|
|
typeof(AbpIdentityHttpApiClientModule), |
|
|
|
|
|
typeof(AbpHttpClientIdentityModelWebModule) |
|
|
)] |
|
|
)] |
|
|
public class CmskitServiceHttpApiHostModule : AbpModule |
|
|
public class CmskitServiceHttpApiHostModule : AbpModule |
|
|
{ |
|
|
{ |
|
|
@ -26,13 +35,13 @@ public class CmskitServiceHttpApiHostModule : AbpModule |
|
|
{ |
|
|
{ |
|
|
FeatureConfigurer.Configure(); |
|
|
FeatureConfigurer.Configure(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
{ |
|
|
{ |
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
|
|
|
|
|
|
|
|
|
JwtBearerConfigurationHelper.Configure(context, "CmskitService"); |
|
|
JwtBearerConfigurationHelper.Configure(context, "CmskitService"); |
|
|
|
|
|
|
|
|
|
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
|
|
|
|
|
|
SwaggerConfigurationHelper.ConfigureWithAuth( |
|
|
SwaggerConfigurationHelper.ConfigureWithAuth( |
|
|
context: context, |
|
|
context: context, |
|
|
authority: configuration["AuthServer:Authority"], |
|
|
authority: configuration["AuthServer:Authority"], |
|
|
@ -71,6 +80,22 @@ public class CmskitServiceHttpApiHostModule : AbpModule |
|
|
opts.RemoteServiceName = "Cmskit"; |
|
|
opts.RemoteServiceName = "Cmskit"; |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
Configure<AbpAntiForgeryOptions>(options => |
|
|
|
|
|
{ |
|
|
|
|
|
options.AutoValidate = false; //TODO
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Configure<CmsKitCommentOptions>(options => |
|
|
|
|
|
{ |
|
|
|
|
|
options.EntityTypes.Add(new CommentEntityTypeDefinition("quote")); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
Configure<CmsKitRatingOptions>(options => |
|
|
|
|
|
{ |
|
|
|
|
|
options.EntityTypes.Add(new RatingEntityTypeDefinition("quote")); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|
|
@ -105,11 +130,10 @@ public class CmskitServiceHttpApiHostModule : AbpModule |
|
|
app.UseConfiguredEndpoints(); |
|
|
app.UseConfiguredEndpoints(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//TODO don't forget here... It gives error
|
|
|
public override async Task OnPostApplicationInitializationAsync(ApplicationInitializationContext context) |
|
|
//public override async Task OnPostApplicationInitializationAsync(ApplicationInitializationContext context)
|
|
|
{ |
|
|
//{
|
|
|
await context.ServiceProvider |
|
|
//await context.ServiceProvider
|
|
|
.GetRequiredService<CmskitServiceDatabaseMigrationChecker>() |
|
|
// .GetRequiredService<CmskitServiceDatabaseMigrationChecker>()
|
|
|
.CheckAndApplyDatabaseMigrationsAsync(); |
|
|
// .CheckAndApplyDatabaseMigrationsAsync();
|
|
|
} |
|
|
//}
|
|
|
|
|
|
} |
|
|
} |
|
|
|