22 lines
819 B
C#
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;
|
|
}
|
|
}
|