chore: some refactors

This commit is contained in:
Pavel-Savely Savianok 2025-05-01 22:29:49 +03:00
parent 9474d7b8b5
commit 6898019196
8 changed files with 30 additions and 15 deletions

View File

@ -13,4 +13,6 @@ public class User
[MaxLength(50)] [MaxLength(50)]
public string? Username { get; set; } public string? Username { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public string? HeadHunterResumeUrl { get; set; }
} }

View File

@ -33,4 +33,11 @@ public class UserService(AppDbContext dbContext) : User.UserBase
Success = false Success = false
}); });
} }
public override Task<GetUserResponse> GetUser(
GetUserRequest request,
ServerCallContext context)
{
return null;
}
} }

View File

@ -6,13 +6,17 @@ namespace JOBot.TClient.Commands;
public class StartCommand(ITelegramBotClient bot, UserService userService) : ITelegramCommand public class StartCommand(ITelegramBotClient bot, UserService userService) : ITelegramCommand
{ {
private const string ReturnMessage = "Привет! Я JOBot, помощник по поиску работы в IT.";
public async Task ExecuteAsync(Update update, CancellationToken ct) public async Task ExecuteAsync(Update update, CancellationToken ct)
{ {
var isRegistered = await userService.RegisterAsync( await userService.RegisterAsync(
update.Message?.Chat.Id ?? throw new Exception("Chat id is null"), update.Message!.Chat.Id,
update.Message.Chat.Username); update.Message.Chat.Username);
await bot.SendMessage(chatId: update.Message.Chat.Id, await bot.SendMessage(chatId: update.Message.Chat.Id,
isRegistered ? "You registered" : "Not registered", cancellationToken: ct); "Продолжая, вы принимаете политику конфиденциальности и правила сервиса" +
"\nhttps://hh.ru/article/personal_data?backurl=%2F&role=applicant" +
"\nhttps://hh.ru/account/agreement?backurl=%2Faccount%2Fsignup%3Fbackurl%3D%252F%26role%3Dapplicant&role=applicant",
cancellationToken: ct);
} }
} }

View File

@ -26,10 +26,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="appsettings.Development.json"> <None Update="appsettings.Example.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>

View File

@ -1,4 +0,0 @@
{
"TelegramToken": "7372524570:AAGLW5dXhW5Jd78i9Zguyga-5gfeSF9KU4I",
"BackendHost": "http://localhost:5001"
}

View File

@ -0,0 +1,4 @@
{
"TelegramToken": "TOKEN:HERE",
"BackendHost": "http://localhost:5001"
}

View File

@ -1,4 +0,0 @@
{
"TelegramToken": "7372524570:AAGLW5dXhW5Jd78i9Zguyga-5gfeSF9KU4I",
"BackendHost": "http://localhost:5001"
}

View File

@ -3,6 +3,7 @@ option csharp_namespace = "JOBot.Proto";
service User { service User {
rpc Register (RegisterRequest) returns (RegisterResponse); rpc Register (RegisterRequest) returns (RegisterResponse);
rpc GetUser (GetUserRequest) returns (GetUserResponse);
} }
import "google/protobuf/wrappers.proto"; import "google/protobuf/wrappers.proto";
@ -14,4 +15,12 @@ message RegisterRequest{
message RegisterResponse{ message RegisterResponse{
bool success = 1; bool success = 1;
}
message GetUserRequest {
int64 user_id = 1;
}
message GetUserResponse {
bool logged_to_hh = 1;
} }