local references to events packages removed

This commit is contained in:
2026-01-16 00:50:07 +01:00
Unverified
parent 6a813ed439
commit 44eb5801fa
5 changed files with 46 additions and 13 deletions

View File

@@ -1,5 +1,4 @@
<Solution> <Solution>
<Project Path="../TimetableDesigner.Backend.Events/TimetableDesigner.Backend.Events/TimetableDesigner.Backend.Events.csproj" />
<Project Path="TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI/TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI.csproj" /> <Project Path="TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI/TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI.csproj" />
<Project Path="TimetableDesigner.Backend.Services.Authentication/TimetableDesigner.Backend.Services.Authentication.csproj" /> <Project Path="TimetableDesigner.Backend.Services.Authentication/TimetableDesigner.Backend.Services.Authentication.csproj" />
</Solution> </Solution>

View File

@@ -0,0 +1,18 @@
using TimetableDesigner.Backend.Events;
using TimetableDesigner.Backend.Events.Extensions.AspNetCore.OpenApi;
using TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI;
namespace TimetableDesigner.Backend.Services.Authentication.Events;
public static class Handlers
{
public static void MapEventHandlers(this WebApplication app)
{
app.AddEventHandler<RegisterRequest>(Test);
}
public static async Task Test(RegisterRequest registerRequest)
{
Console.WriteLine(registerRequest.Email);
}
}

View File

@@ -2,12 +2,14 @@ using System.Reflection;
using FluentValidation; using FluentValidation;
using Microsoft.AspNetCore.Identity.Data; using Microsoft.AspNetCore.Identity.Data;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using TimetableDesigner.Backend.Events; using TimetableDesigner.Backend.Events.Extensions.AspNetCore.OpenApi;
using TimetableDesigner.Backend.Events.RabbitMQ; using TimetableDesigner.Backend.Events.Providers.RabbitMQ;
using TimetableDesigner.Backend.Services.Authentication.API; using TimetableDesigner.Backend.Services.Authentication.API;
using TimetableDesigner.Backend.Services.Authentication.API.Validators; using TimetableDesigner.Backend.Services.Authentication.API.Validators;
using TimetableDesigner.Backend.Services.Authentication.Application.Helpers; using TimetableDesigner.Backend.Services.Authentication.Application.Helpers;
using TimetableDesigner.Backend.Services.Authentication.Database; using TimetableDesigner.Backend.Services.Authentication.Database;
using TimetableDesigner.Backend.Services.Authentication.Events;
using TimetableDesigner.Backend.Services.Authentication.WebAPI;
namespace TimetableDesigner.Backend.Services.Authentication; namespace TimetableDesigner.Backend.Services.Authentication;
@@ -27,20 +29,23 @@ public static class Program
if (app.Environment.IsDevelopment()) if (app.Environment.IsDevelopment())
app.MapOpenApi(); app.MapOpenApi();
app.InitializeDatabase(); app.InitializeDatabase();
app.UseHttpsRedirection(); //app.UseHttpsRedirection();
app.MapEndpoints(); app.MapWebAPIEndpoints();
app.MapEventHandlers();
app.Run(); app.Run();
} }
private static WebApplicationBuilder SetupOpenApi(this WebApplicationBuilder builder) private static WebApplicationBuilder SetupOpenApi(this WebApplicationBuilder builder)
{ {
builder.Services.AddEventQueue<RabbitMQEventQueueBuilder>(cfg => builder.Services.AddEventQueue<RabbitMQEventQueue>(cfg =>
{ {
cfg.Hostname = "localhost"; cfg.Hostname = "localhost";
cfg.Port = 5672; cfg.Port = 5672;
cfg.Username = "user"; cfg.Username = "user";
cfg.Password = "l4JxOIuSoyod86N"; cfg.Password = "l4JxOIuSoyod86N";
cfg.ExchangeName = "events";
cfg.QueuePrefix = "authentication";
}); });
builder.Services.AddOpenApi(); builder.Services.AddOpenApi();
return builder; return builder;

View File

@@ -12,16 +12,17 @@
<PackageReference Include="FluentValidation" Version="12.1.1" /> <PackageReference Include="FluentValidation" Version="12.1.1" />
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.1" /> <PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.1" />
<PackageReference Include="MediatR" Version="14.0.0" /> <PackageReference Include="MediatR" Version="14.0.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.9" /> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.9"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.2">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
<PackageReference Include="timetabledesigner.backend.events.extensions.aspnetcore.openapi" Version="1.0.0" />
<PackageReference Include="TimetableDesigner.Backend.Events.Providers.RabbitMQ" Version="1.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\TimetableDesigner.Backend.Events\TimetableDesigner.Backend.Events\TimetableDesigner.Backend.Events.csproj" />
<ProjectReference Include="..\TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI\TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI.csproj" /> <ProjectReference Include="..\TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI\TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI.csproj" />
</ItemGroup> </ItemGroup>

View File

@@ -2,15 +2,15 @@
using FluentValidation.Results; using FluentValidation.Results;
using MediatR; using MediatR;
using Microsoft.AspNetCore.Http.HttpResults; using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.AspNetCore.Mvc; using TimetableDesigner.Backend.Events;
using TimetableDesigner.Backend.Services.Authentication.Application.Commands.Register; using TimetableDesigner.Backend.Services.Authentication.Application.Commands.Register;
using TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI; using TimetableDesigner.Backend.Services.Authentication.DTO.WebAPI;
namespace TimetableDesigner.Backend.Services.Authentication.API; namespace TimetableDesigner.Backend.Services.Authentication.WebAPI;
public static class Endpoints public static class Endpoints
{ {
public static IEndpointRouteBuilder MapEndpoints(this IEndpointRouteBuilder app) public static IEndpointRouteBuilder MapWebAPIEndpoints(this IEndpointRouteBuilder app)
{ {
app.MapPost("/register", Register) app.MapPost("/register", Register)
.AllowAnonymous() .AllowAnonymous()
@@ -22,6 +22,9 @@ public static class Endpoints
.WithName("AuthenticatePassword"); .WithName("AuthenticatePassword");
app.MapPost("/authenticate_token", AuthenticateToken) app.MapPost("/authenticate_token", AuthenticateToken)
.WithName("AuthenticateToken"); .WithName("AuthenticateToken");
app.MapPost("/test", Test)
.AllowAnonymous()
.WithName("Test");
return app; return app;
} }
@@ -50,4 +53,11 @@ public static class Endpoints
{ {
return null; return null;
} }
public static async Task<Results<Ok, InternalServerError>> Test(IEventQueuePublisher publisher)
{
await publisher.PublishAsync(new RegisterRequest("aaaa", "bbbb", "ccccc"));
return TypedResults.Ok();
}
} }