Files
forkmessager/backend/src/Modules/TelegramImport/DependencyInjection.cs
Халимов Рустам 1558b20470 Импорт
2026-04-06 22:20:13 +03:00

22 lines
819 B
C#

using Knot.Modules.TelegramImport.Application.Abstractions;
using Knot.Modules.TelegramImport.Infrastructure.Background;
using Knot.Modules.TelegramImport.Infrastructure.Parser;
using Microsoft.Extensions.DependencyInjection;
namespace Knot.Modules.TelegramImport;
public static class DependencyInjection
{
public static IServiceCollection AddTelegramImportModule(this IServiceCollection services)
{
services.AddSingleton<ITelegramHtmlParser, TelegramHtmlParser>();
services.AddSingleton<IImportJobStore, ImportJobStore>();
// Register worker as itself and as a hosted service
services.AddSingleton<TelegramImportWorker>();
services.AddHostedService<TelegramImportWorker>(sp => sp.GetRequiredService<TelegramImportWorker>());
return services;
}
}