feat: added auth hook using RabbitMQ on client for login continue

This commit is contained in:
2025-07-25 17:12:10 +03:00
parent d2280cdc5b
commit f115760713
10 changed files with 101 additions and 5 deletions

View File

@@ -1,6 +0,0 @@
namespace JOBot.Backend.Infrastructure.Config;
public static class RabbitQueues
{
public const string AuthQueue = "auth";
}

View File

@@ -31,4 +31,8 @@
<Folder Include="Data\Migrations\"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JOBot.Infrastructure\JOBot.Infrastructure.csproj" />
</ItemGroup>
</Project>

View File

@@ -3,6 +3,7 @@ using System.Text.Json;
using JOBot.Backend.DAL.Context;
using JOBot.Backend.DTOs.HeadHunterHook;
using JOBot.Backend.Infrastructure.Config;
using JOBot.Infrastructure.Config;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
using RabbitMQ.Client;

View File

@@ -2,6 +2,7 @@ using JOBot.Backend.DAL.Context;
using JOBot.Backend.Infrastructure.Config;
using JOBot.Backend.Services;
using JOBot.Backend.Services.gRPC;
using JOBot.Infrastructure.Config;
using Microsoft.EntityFrameworkCore;
using RabbitMQ.Client;
@@ -22,8 +23,13 @@ public class Startup(IConfiguration configuration)
{
HostName = "jobot-rabbitmq"
}.CreateConnectionAsync();
await using var channel = await rabbitMqConnection.CreateChannelAsync();
await channel.QueueDeclareAsync(RabbitQueues.AuthQueue, false, false, false);
var channel = await rabbitMqConnection.CreateChannelAsync();
await channel.QueueDeclareAsync(
RabbitQueues.AuthQueue,
false,
false,
false,
arguments: null);
services.AddSingleton(channel);
services.AddDbContext<AppDbContext>(options =>