misc
This commit is contained in:
parent
fbc6f562e3
commit
d7e0c59559
31 changed files with 249 additions and 57 deletions
|
@ -7,11 +7,29 @@ namespace Femto.Modules.Auth.Application;
|
|||
|
||||
internal class AuthModule(IHost host) : IAuthModule
|
||||
{
|
||||
public async Task<TResponse> PostCommand<TResponse>(ICommand<TResponse> command, CancellationToken cancellationToken = default)
|
||||
public Task Command(ICommand command, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var scope = host.Services.CreateScope();
|
||||
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
|
||||
return mediator.Send(command, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<TResponse> Command<TResponse>(
|
||||
ICommand<TResponse> command,
|
||||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
using var scope = host.Services.CreateScope();
|
||||
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
|
||||
var response = await mediator.Send(command, cancellationToken);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<TResponse> Query<TResponse>(IQuery<TResponse> query, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var scope = host.Services.CreateScope();
|
||||
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
|
||||
var response = await mediator.Send(query, cancellationToken);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue