feat: added auth for telegram stage
This commit is contained in:
@@ -16,7 +16,7 @@ public class HeadHunterService(ILogger<HeadHunterService> logger, IOptions<HeadH
|
||||
/// </summary>
|
||||
/// <param name="userId">Telegram UserId</param>
|
||||
/// <returns>Link for auth</returns>
|
||||
public string GenerateAuthLink(int userId)
|
||||
public string GenerateAuthLink(long userId)
|
||||
{
|
||||
var redirectUri = new UriBuilder(_config.Links.HookDomain)
|
||||
{
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user