JOBot/JOBot.Backend/Controllers/HeadHunterHookController.cs

23 lines
910 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
};
}
}