24 lines
942 B
C#
24 lines
942 B
C#
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 code)
|
||
{
|
||
var res = await hhService.AuthUser(userId, code, error);
|
||
return res switch
|
||
{
|
||
HeadHunterService.Status.Success => Ok(
|
||
"Авторизация завершена успешно. Вернитесь в Telegram для продолжения."),
|
||
HeadHunterService.Status.UserNotFoundError => NotFound("Пользователь не найден."),
|
||
_ => BadRequest(
|
||
"Авторизация завершена с ошибкой. Вернитесь в Telegram для продолжения.") //TODO: Add resource
|
||
};
|
||
}
|
||
} |