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
|
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();
|
using var scope = host.Services.CreateScope();
|
||||||
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
|
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
|
||||||
return mediator.Send(command, cancellationToken);
|
await mediator.Send(command, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<TResponse> Command<TResponse>(
|
public async Task<TResponse> Command<TResponse>(
|
||||||
|
|
|
@ -30,15 +30,6 @@ public static class AuthStartup
|
||||||
{
|
{
|
||||||
services.AddTransient<IDbConnectionFactory>(_ => new DbConnectionFactory(connectionString));
|
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 =>
|
services.AddDbContext<AuthContext>(builder =>
|
||||||
{
|
{
|
||||||
builder.UseNpgsql(connectionString);
|
builder.UseNpgsql(connectionString);
|
||||||
|
@ -50,6 +41,17 @@ public static class AuthStartup
|
||||||
// #endif
|
// #endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
services.AddQuartzHostedService(options =>
|
||||||
|
{
|
||||||
|
options.WaitForJobsToComplete = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
services.AddOutbox<AuthContext, OutboxMessageHandler>();
|
||||||
|
|
||||||
|
services.AddMediatR(c => c.RegisterServicesFromAssembly(typeof(AuthStartup).Assembly));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
services.ConfigureDomainServices<AuthContext>();
|
services.ConfigureDomainServices<AuthContext>();
|
||||||
|
|
||||||
services.AddSingleton(publisher);
|
services.AddSingleton(publisher);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue