From 72081a603ff480ccab0a3bb3488342363f519bf5 Mon Sep 17 00:00:00 2001 From: john Date: Sun, 18 May 2025 22:45:18 +0200 Subject: [PATCH] fix auth command oopsie --- Femto.Modules.Auth/Application/AuthModule.cs | 4 ++-- Femto.Modules.Auth/Application/AuthStartup.cs | 22 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Femto.Modules.Auth/Application/AuthModule.cs b/Femto.Modules.Auth/Application/AuthModule.cs index 03b34d3..aa85984 100644 --- a/Femto.Modules.Auth/Application/AuthModule.cs +++ b/Femto.Modules.Auth/Application/AuthModule.cs @@ -7,11 +7,11 @@ namespace Femto.Modules.Auth.Application; internal class AuthModule(IHost host) : IAuthModule { - public Task Command(ICommand command, CancellationToken cancellationToken = default) + public async Task Command(ICommand command, CancellationToken cancellationToken = default) { using var scope = host.Services.CreateScope(); var mediator = scope.ServiceProvider.GetRequiredService(); - return mediator.Send(command, cancellationToken); + await mediator.Send(command, cancellationToken); } public async Task Command( diff --git a/Femto.Modules.Auth/Application/AuthStartup.cs b/Femto.Modules.Auth/Application/AuthStartup.cs index 4cad89b..48bf182 100644 --- a/Femto.Modules.Auth/Application/AuthStartup.cs +++ b/Femto.Modules.Auth/Application/AuthStartup.cs @@ -29,16 +29,7 @@ public static class AuthStartup private static void ConfigureServices(IServiceCollection services, string connectionString, IEventPublisher publisher) { services.AddTransient(_ => new DbConnectionFactory(connectionString)); - - services.AddQuartzHostedService(options => - { - options.WaitForJobsToComplete = true; - }); - - services.AddOutbox(); - - services.AddMediatR(c => c.RegisterServicesFromAssembly(typeof(AuthStartup).Assembly)); - + services.AddDbContext(builder => { builder.UseNpgsql(connectionString); @@ -50,6 +41,17 @@ public static class AuthStartup // #endif }); + services.AddQuartzHostedService(options => + { + options.WaitForJobsToComplete = true; + }); + + services.AddOutbox(); + + services.AddMediatR(c => c.RegisterServicesFromAssembly(typeof(AuthStartup).Assembly)); + + + services.ConfigureDomainServices(); services.AddSingleton(publisher);