feat: added RabbitMQ queue from back-end to hook auth for client
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Web;
|
||||
using JOBot.Backend.DAL.Context;
|
||||
using JOBot.Backend.DTOs.HeadHunterHook;
|
||||
using JOBot.Backend.Infrastructure.Config;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using RabbitMQ.Client;
|
||||
|
||||
namespace JOBot.Backend.Services;
|
||||
|
||||
public class HeadHunterService(ILogger<HeadHunterService> logger, IOptions<HeadHunterConfig> config, AppDbContext dbContext)
|
||||
public class HeadHunterService(
|
||||
IChannel channel,
|
||||
ILogger<HeadHunterService> logger,
|
||||
IOptions<HeadHunterConfig> config,
|
||||
AppDbContext dbContext)
|
||||
{
|
||||
private readonly HeadHunterConfig _config = config.Value;
|
||||
|
||||
@@ -88,6 +93,14 @@ public class HeadHunterService(ILogger<HeadHunterService> logger, IOptions<HeadH
|
||||
await dbContext.SaveChangesAsync();
|
||||
|
||||
logger.LogInformation($"User {userId} auth completed!");
|
||||
|
||||
await channel.BasicPublishAsync(
|
||||
string.Empty,
|
||||
RabbitQueues.AuthQueue,
|
||||
Encoding.UTF8.GetBytes(userId.ToString()));
|
||||
|
||||
logger.LogInformation($"RabbitMQ event was created");
|
||||
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user