feat: added auth for telegram stage

This commit is contained in:
2025-07-16 20:34:29 +03:00
parent bae7a0267d
commit fcdc4476df
9 changed files with 68 additions and 14 deletions

View File

@@ -1,3 +1,4 @@
using Google.Protobuf.WellKnownTypes;
using Grpc.Core;
using JOBot.Backend.DAL.Context;
using JOBot.Backend.DAL.Models;
@@ -7,7 +8,7 @@ using User = JOBot.Backend.DAL.Models.User;
namespace JOBot.Backend.Services.gRPC;
public class UserService(AppDbContext dbContext) : Proto.User.UserBase
public class UserService(AppDbContext dbContext, HeadHunterService hhService) : Proto.User.UserBase
{
/// <summary>
/// Create user
@@ -62,6 +63,16 @@ public class UserService(AppDbContext dbContext) : Proto.User.UserBase
return new AcceptEulaResponse { Success = true };
}
public override Task<GetHeadHunterAuthHookResponse> GetHeadHunterAuthHook(
GetHeadHunterAuthHookRequest request,
ServerCallContext context)
{
return Task.Run(() => new GetHeadHunterAuthHookResponse
{
RegistrationUrl = hhService.GenerateAuthLink(request.UserId)
});
}
/// <summary>
/// Throw RPCException if user not found
/// </summary>