fix auth command oopsie
This commit is contained in:
parent
c475c112da
commit
72081a603f
2 changed files with 14 additions and 12 deletions
|
@ -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<IMediator>();
|
||||
return mediator.Send(command, cancellationToken);
|
||||
await mediator.Send(command, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<TResponse> Command<TResponse>(
|
||||
|
|
|
@ -29,16 +29,7 @@ public static class AuthStartup
|
|||
private static void ConfigureServices(IServiceCollection services, string connectionString, IEventPublisher publisher)
|
||||
{
|
||||
services.AddTransient<IDbConnectionFactory>(_ => new DbConnectionFactory(connectionString));
|
||||
|
||||
services.AddQuartzHostedService(options =>
|
||||
{
|
||||
options.WaitForJobsToComplete = true;
|
||||
});
|
||||
|
||||
services.AddOutbox<AuthContext, OutboxMessageHandler>();
|
||||
|
||||
services.AddMediatR(c => c.RegisterServicesFromAssembly(typeof(AuthStartup).Assembly));
|
||||
|
||||
|
||||
services.AddDbContext<AuthContext>(builder =>
|
||||
{
|
||||
builder.UseNpgsql(connectionString);
|
||||
|
@ -50,6 +41,17 @@ public static class AuthStartup
|
|||
// #endif
|
||||
});
|
||||
|
||||
services.AddQuartzHostedService(options =>
|
||||
{
|
||||
options.WaitForJobsToComplete = true;
|
||||
});
|
||||
|
||||
services.AddOutbox<AuthContext, OutboxMessageHandler>();
|
||||
|
||||
services.AddMediatR(c => c.RegisterServicesFromAssembly(typeof(AuthStartup).Assembly));
|
||||
|
||||
|
||||
|
||||
services.ConfigureDomainServices<AuthContext>();
|
||||
|
||||
services.AddSingleton(publisher);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue