refactor(jobs): modularize background job handlers
Some checks failed
ci / release-gate (push) Has been cancelled

This commit is contained in:
2026-08-03 13:28:21 +08:00
parent c497a3ca8d
commit 7adcb6a3d5
21 changed files with 871 additions and 645 deletions

View File

@@ -1,9 +1,11 @@
using Microsoft.Extensions.DependencyInjection;
using Tiku.Application.Commerce;
using Tiku.Application.Growth;
using Tiku.Application.Jobs;
using Tiku.Application.Notifications;
using Tiku.Application.Points;
using Tiku.Infrastructure.Commerce;
using Tiku.Infrastructure.Commerce.Reconciliation;
using Tiku.Infrastructure.Growth;
using Tiku.Infrastructure.Notifications;
using Tiku.Infrastructure.Points;
@@ -16,6 +18,7 @@ internal static class CommerceModule
{
services.AddScoped<ICommerceService, CommerceService>();
services.AddScoped<ICommerceAdminService, CommerceAdminService>();
services.AddScoped<IBackgroundJobHandler, CommerceReconciliationJobHandler>();
services.AddScoped<IPointService, PointService>();
services.AddScoped<IReferralQrcodeGenerator, ReferralQrcodeGenerator>();
services.AddScoped<IReferralService, ReferralService>();
@@ -31,4 +34,4 @@ internal static class CommerceModule
services.AddScoped<IPaymentProvider, AlipayProvider>();
return services;
}
}
}

View File

@@ -2,6 +2,7 @@ using Microsoft.Extensions.DependencyInjection;
using Tiku.Application.Assets;
using Tiku.Application.Catalog;
using Tiku.Application.Content;
using Tiku.Application.Jobs;
using Tiku.Application.Profile;
using Tiku.Application.QuestionBanks;
using Tiku.Application.Scoreline;
@@ -10,6 +11,9 @@ using Tiku.Application.StudyContent;
using Tiku.Infrastructure.Assets;
using Tiku.Infrastructure.Catalog;
using Tiku.Infrastructure.Content;
using Tiku.Infrastructure.Content.Exports;
using Tiku.Infrastructure.Content.Imports;
using Tiku.Infrastructure.Assets.Security;
using Tiku.Infrastructure.Profile;
using Tiku.Infrastructure.QuestionBanks;
using Tiku.Infrastructure.Scoreline;
@@ -38,6 +42,9 @@ internal static class ContentModule
services.AddScoped<IAssetAccessService, AssetAccessService>();
services.AddScoped<IAssetManagementService, AssetManagementService>();
services.AddScoped<IAssetSecurityScanner, ClamAvAssetSecurityScanner>();
services.AddScoped<IBackgroundJobHandler, ContentImportJobHandler>();
services.AddScoped<IBackgroundJobHandler, ContentExportJobHandler>();
services.AddScoped<IBackgroundJobHandler, AssetSecurityScanJobHandler>();
services.AddOptions<ClamAvOptions>();
services.AddScoped<IVideoPlaybackService, VideoPlaybackService>();
services.AddOptions<AliyunOssOptions>()
@@ -48,4 +55,4 @@ internal static class ContentModule
services.AddSingleton<IObjectStorageService, AliyunOssObjectStorageService>();
return services;
}
}
}

View File

@@ -13,6 +13,7 @@ internal static class JobsModule
services.AddScoped<IBackgroundJobQueue>(provider => provider.GetRequiredService<BackgroundJobService>());
services.AddScoped<IBackgroundJobProcessor>(provider => provider.GetRequiredService<BackgroundJobService>());
services.AddScoped<IBackgroundJobOperations>(provider => provider.GetRequiredService<BackgroundJobService>());
services.AddScoped<BackgroundJobHandlerRegistry>();
return services;
}
}
}

View File

@@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Tiku.Application.Backoffice;
using Tiku.Application.Jobs;
using Tiku.Application.Security;
using Tiku.Application.Tenancy;
using Tiku.Infrastructure.Backoffice;
@@ -28,6 +29,7 @@ internal static class PlatformCoreModule
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>();
@@ -45,4 +47,4 @@ internal static class PlatformCoreModule
services.AddScoped<IBackofficeService, BackofficeService>();
return services;
}
}
}

View File

@@ -2,8 +2,10 @@ using Microsoft.Extensions.DependencyInjection;
using Tiku.Application.PlatformAdmin;
using Tiku.Application.PlatformAdmin.Operations;
using Tiku.Application.PlatformBilling;
using Tiku.Application.Jobs;
using Tiku.Infrastructure.PlatformAdmin;
using Tiku.Infrastructure.PlatformAdmin.Operations;
using Tiku.Infrastructure.PlatformAdmin.TenantProvisioning;
using Tiku.Infrastructure.PlatformBilling;
namespace Tiku.Infrastructure;
@@ -13,6 +15,7 @@ internal static class PlatformModule
internal static IServiceCollection AddPlatformModule(this IServiceCollection services)
{
services.AddScoped<IPlatformAdminService, PlatformAdminService>();
services.AddScoped<IBackgroundJobHandler, TenantExportJobHandler>();
services.AddScoped<IPlatformOperationsQueryService, PlatformOperationsQueryService>();
services.AddOptions<TenantProvisioningOptions>();
services.AddScoped<IPlatformQuestionBankService, PlatformQuestionBankService>();
@@ -33,4 +36,4 @@ internal static class PlatformModule
services.AddOptions<SaasSubscriptionLifecycleOptions>();
return services;
}
}
}

View File

@@ -1,8 +1,10 @@
using Microsoft.Extensions.DependencyInjection;
using Tiku.Application.Tenancy;
using Tiku.Application.TenantAdmin;
using Tiku.Application.Jobs;
using Tiku.Infrastructure.Tenancy;
using Tiku.Infrastructure.TenantAdmin;
using Tiku.Infrastructure.TenantAdmin.Dashboard;
namespace Tiku.Infrastructure;
@@ -13,6 +15,7 @@ internal static class TenantAdminModule
services.AddScoped<ITenantAdminDirectService, TenantAdminDirectService>();
services.AddScoped<ITenantOnboardingService, TenantOnboardingService>();
services.AddScoped<ITenantLifecycleService, TenantLifecycleService>();
services.AddScoped<IBackgroundJobHandler, StatisticsAggregationJobHandler>();
return services;
}
}
}