Skip to content

Commit d01743b

Browse files
author
stone1985
committed
- bugfix
1 parent c27e06b commit d01743b

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

Samples/Auth.Sample.Telegram/Commands/Processors/RegisterCommandProcessor.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Botticelli.Auth.Data;
22
using Botticelli.Auth.Data.Models;
3+
using Botticelli.Auth.Dto.User;
34
using Botticelli.Auth.Services;
45
using Botticelli.Client.Analytics;
56
using Botticelli.Framework.Commands.Processors;
@@ -21,8 +22,8 @@ namespace Auth.Sample.Telegram.Commands.Processors;
2122
/// <param name="messageValidator"></param>
2223
/// <typeparam name="TReplyMarkup"></typeparam>
2324
public class RegisterCommandProcessor<TReplyMarkup>(
24-
IManager<BotUser> userManager,
25-
IManager<BotUserRole> roleManager,
25+
IManager<BotUserInfo> userManager,
26+
IManager<BotUserRoleInfo> roleManager,
2627
ILogger<InfoCommandProcessor<TReplyMarkup>> logger,
2728
ICommandValidator<RegisterCommand> commandValidator,
2829
MetricsProcessor metricsProcessor,
@@ -83,12 +84,11 @@ protected override async Task InnerProcess(Message message, CancellationToken to
8384
{
8485
var role = await GetUserRole();
8586

86-
user = new BotUser
87+
user = new BotUserInfo
8788
{
8889
UserId = chatId,
8990
UserName = string.Empty,
90-
RoleId = role!.Id,
91-
IsActive = true
91+
RoleId = role!.Id
9292
};
9393

9494
await userManager.Add(user);
@@ -107,7 +107,7 @@ protected override async Task InnerProcess(Message message, CancellationToken to
107107
await Bot.SendMessageAsync(registeredRequest, token)!;
108108
}
109109

110-
private async Task<BotUserRole?> GetUserRole()
110+
private async Task<BotUserRoleInfo?> GetUserRole()
111111
{
112112
return (await roleManager.Get()).FirstOrDefault(r => r.RoleName == DefaultRoles.User);
113113
}

Samples/Auth.Sample.Telegram/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
.AddProcessor<StartCommandProcessor<ReplyKeyboardMarkup>>()
2020
.AddValidator<PassValidator<StartCommand>>();
2121

22+
builder.Services.AddBotCommand<RegisterCommand>()
23+
.AddProcessor<RegisterCommandProcessor<ReplyKeyboardMarkup>>()
24+
.AddValidator<PassValidator<RegisterCommand>>();
25+
2226
builder.Services.AddBotCommand<InfoCommand>()
2327
.AddProcessor<InfoCommandProcessor<ReplyKeyboardMarkup>>()
2428
.AddValidator<PassValidator<InfoCommand>>();

Samples/Auth.Sample.Telegram/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
"name": "TestBot"
2222
},
2323
"AuthSettings": {
24-
"ConnectionString": "database_auth.db;Password=123"
24+
"ConnectionString": "Data Source=database_auth.db;Password=123"
2525
}
2626
}

0 commit comments

Comments
 (0)