WIP: implemented registration and EULA accept, WIP on auth issue

This commit is contained in:
2025-07-12 01:24:39 +03:00
parent ac39117cf4
commit 67a3457f2d
17 changed files with 569 additions and 87 deletions

View File

@@ -2,7 +2,10 @@ using Grpc.Core;
using Grpc.Net.Client;
using JOBot.Proto;
using JOBot.TClient.Commands;
using JOBot.TClient.Core.Services;
using JOBot.TClient.Commands.Buttons;
using JOBot.TClient.Core.HostedServices;
using JOBot.TClient.Services;
using JOBot.TClient.Statements;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@@ -19,15 +22,29 @@ public static class DependencyInjection
services.AddScoped<ChannelBase, GrpcChannel>(_ => GrpcChannel.ForAddress(config.GetValue<string>("BackendHost")
?? throw new MissingFieldException("Host is not defined")));
//Commands
#region Commands
services.AddScoped<StartCommand>();
//buttons
services.AddScoped<EulaAgreementButtonCommand>();
#endregion
#region gRPC Clients
services.AddGrpcClient<User.UserClient>(o => o.Address = new Uri("http://backend:5001"));
#endregion
#region Services
services.AddSingleton<UserService>();
services.AddScoped<PrepareUserService>();
services.AddScoped<MenuService>();
#endregion
//gRPC Clients
services.AddScoped<User.UserClient>();
#region States
services.AddScoped<PrepareUserState>();
#endregion
// Telegram Bot
// Bot service
services.AddHostedService<BotBackgroundService>();
services.AddSingleton<ITelegramBotClient>(_ =>
new TelegramBotClient(config.GetValue<string>("TelegramToken")
?? throw new MissingFieldException("TelegramToken is not set")));