Files
tiku-backend.net/Tiku.Infrastructure/Modules/PlatformCoreModule.cs
xiong 7adcb6a3d5
Some checks failed
ci / release-gate (push) Has been cancelled
refactor(jobs): modularize background job handlers
2026-08-03 13:28:21 +08:00

51 lines
3.0 KiB
C#

using Microsoft.Extensions.DependencyInjection;
using Tiku.Application.Backoffice;
using Tiku.Application.Jobs;
using Tiku.Application.Security;
using Tiku.Application.Tenancy;
using Tiku.Infrastructure.Backoffice;
using Tiku.Infrastructure.Observability;
using Tiku.Infrastructure.Security;
using Tiku.Infrastructure.Tenancy;
namespace Tiku.Infrastructure;
internal static class PlatformCoreModule
{
internal static IServiceCollection AddPlatformCoreModule(this IServiceCollection services)
{
services.AddScoped<ITenantDirectory, TenantDirectory>();
services.AddScoped<IPublicTenantConfigurationQuery, PublicTenantConfigurationQuery>();
services.AddSingleton<IRedisSecurityStore, NullRedisSecurityStore>();
services.AddSingleton<NullAuthorizationCache>();
services.AddSingleton<IAccessSecurityCache>(provider => provider.GetRequiredService<NullAuthorizationCache>());
services.AddSingleton<IAuthorizationSnapshotCache>(provider =>
provider.GetRequiredService<NullAuthorizationCache>());
services.AddMemoryCache();
services.AddScoped<ITenantFrontendConfigService, TenantFrontendConfigService>();
services.AddScoped<ITenantExternalProviderConfigService, TenantExternalProviderConfigService>();
services.AddSingleton<ITenantRuntimeCacheInvalidator, TenantRuntimeCacheInvalidator>();
services.AddSingleton<ITenantPublicCacheInvalidator, NullTenantPublicCacheInvalidator>();
services.AddHttpClient<IDomainOwnershipVerifier, DnsDomainOwnershipVerifier>();
services.AddHttpClient<IDomainGatewayProvisioner, HttpDomainGatewayProvisioner>();
services.AddScoped<ITenantDomainLifecycleService, TenantDomainLifecycleService>();
services.AddScoped<IBackgroundJobHandler, TenantDomainRecheckJobHandler>();
services.AddOptions<DomainLifecycleOptions>();
services.AddSingleton<ITenantExecutionScope, TenantExecutionScope>();
services.AddScoped<ICurrentAccessContext, CurrentAccessContext>();
services.AddScoped<IAuthorizationStateInvalidator, AuthorizationStateInvalidator>();
services.AddScoped<IAuthorizationCacheInvalidationProcessor, AuthorizationCacheInvalidationProcessor>();
services.AddScoped<ITenantFeatureSnapshotProvider, TenantFeatureSnapshotProvider>();
services.AddSingleton<TenantFeatureCacheInvalidator>();
services.AddSingleton<ITenantFeatureCacheInvalidator>(provider =>
provider.GetRequiredService<TenantFeatureCacheInvalidator>());
services.AddScoped<IFeatureAccessService, FeatureAccessService>();
services.AddScoped<IFeatureUsageReconciliationService, FeatureUsageReconciliationService>();
services.AddOptions<FeatureUsageReconciliationOptions>();
services.AddScoped<IOperationAuditService, OperationAuditService>();
services.AddScoped<IDependencyReadinessProbe, DependencyReadinessProbe>();
services.AddScoped<IBackofficeService, BackofficeService>();
return services;
}
}