local references to events packages removed
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<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/TimetableDesigner.Backend.Services.Authentication.csproj" />
|
||||
</Solution>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,14 @@ using System.Reflection;
|
||||
using FluentValidation;
|
||||
using Microsoft.AspNetCore.Identity.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TimetableDesigner.Backend.Events;
|
||||
using TimetableDesigner.Backend.Events.RabbitMQ;
|
||||
using TimetableDesigner.Backend.Events.Extensions.AspNetCore.OpenApi;
|
||||
using TimetableDesigner.Backend.Events.Providers.RabbitMQ;
|
||||
using TimetableDesigner.Backend.Services.Authentication.API;
|
||||
using TimetableDesigner.Backend.Services.Authentication.API.Validators;
|
||||
using TimetableDesigner.Backend.Services.Authentication.Application.Helpers;
|
||||
using TimetableDesigner.Backend.Services.Authentication.Database;
|
||||
using TimetableDesigner.Backend.Services.Authentication.Events;
|
||||
using TimetableDesigner.Backend.Services.Authentication.WebAPI;
|
||||
|
||||
namespace TimetableDesigner.Backend.Services.Authentication;
|
||||
|
||||
@@ -27,20 +29,23 @@ public static class Program
|
||||
if (app.Environment.IsDevelopment())
|
||||
app.MapOpenApi();
|
||||
app.InitializeDatabase();
|
||||
app.UseHttpsRedirection();
|
||||
app.MapEndpoints();
|
||||
//app.UseHttpsRedirection();
|
||||
app.MapWebAPIEndpoints();
|
||||
app.MapEventHandlers();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
|
||||
private static WebApplicationBuilder SetupOpenApi(this WebApplicationBuilder builder)
|
||||
{
|
||||
builder.Services.AddEventQueue<RabbitMQEventQueueBuilder>(cfg =>
|
||||
builder.Services.AddEventQueue<RabbitMQEventQueue>(cfg =>
|
||||
{
|
||||
cfg.Hostname = "localhost";
|
||||
cfg.Port = 5672;
|
||||
cfg.Username = "user";
|
||||
cfg.Password = "l4JxOIuSoyod86N";
|
||||
cfg.ExchangeName = "events";
|
||||
cfg.QueuePrefix = "authentication";
|
||||
});
|
||||
builder.Services.AddOpenApi();
|
||||
return builder;
|
||||
|
||||
@@ -12,16 +12,17 @@
|
||||
<PackageReference Include="FluentValidation" Version="12.1.1" />
|
||||
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.1" />
|
||||
<PackageReference Include="MediatR" Version="14.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.9">
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</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>
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
using FluentValidation.Results;
|
||||
using MediatR;
|
||||
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.DTO.WebAPI;
|
||||
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.API;
|
||||
namespace TimetableDesigner.Backend.Services.Authentication.WebAPI;
|
||||
|
||||
public static class Endpoints
|
||||
{
|
||||
public static IEndpointRouteBuilder MapEndpoints(this IEndpointRouteBuilder app)
|
||||
public static IEndpointRouteBuilder MapWebAPIEndpoints(this IEndpointRouteBuilder app)
|
||||
{
|
||||
app.MapPost("/register", Register)
|
||||
.AllowAnonymous()
|
||||
@@ -22,6 +22,9 @@ public static class Endpoints
|
||||
.WithName("AuthenticatePassword");
|
||||
app.MapPost("/authenticate_token", AuthenticateToken)
|
||||
.WithName("AuthenticateToken");
|
||||
app.MapPost("/test", Test)
|
||||
.AllowAnonymous()
|
||||
.WithName("Test");
|
||||
|
||||
return app;
|
||||
}
|
||||
@@ -50,4 +53,11 @@ public static class Endpoints
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static async Task<Results<Ok, InternalServerError>> Test(IEventQueuePublisher publisher)
|
||||
{
|
||||
await publisher.PublishAsync(new RegisterRequest("aaaa", "bbbb", "ccccc"));
|
||||
|
||||
return TypedResults.Ok();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user