feat: added implementation of HeadHunter hook for user registration
This commit is contained in:
23
JOBot.Backend/Controllers/HeadHunterHookController.cs
Normal file
23
JOBot.Backend/Controllers/HeadHunterHookController.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using JOBot.Backend.Services;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace JOBot.Backend.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("auth")]
|
||||
public class HeadHunterHookController(HeadHunterService hhService)
|
||||
: ControllerBase
|
||||
{
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get(int userId, string? error, string authorizationCode)
|
||||
{
|
||||
var res = await hhService.AuthUser(userId, authorizationCode, error);
|
||||
return res switch
|
||||
{
|
||||
HeadHunterService.Status.Success => Ok("Авторизация завершена успешно. Вернитесь в Telegram для продолжения."),
|
||||
HeadHunterService.Status.UserNotFoundError => NotFound("Пользователь не найден."),
|
||||
_ => BadRequest("Авторизация завершена с ошибкой. Вернитесь в Telegram для продолжения.") //TODO: Add resource
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user