refresh user
This commit is contained in:
parent
4e24796a5d
commit
0d34774059
12 changed files with 141 additions and 32 deletions
|
@ -5,31 +5,18 @@ using Microsoft.Extensions.Hosting;
|
|||
|
||||
namespace Femto.Modules.Auth.Application;
|
||||
|
||||
internal class AuthModule(IHost host) : IAuthModule
|
||||
internal class AuthModule(IMediator mediator) : IAuthModule
|
||||
{
|
||||
public async Task Command(ICommand command, CancellationToken cancellationToken = default)
|
||||
{
|
||||
using var scope = host.Services.CreateScope();
|
||||
var mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
|
||||
public async Task Command(ICommand command, CancellationToken cancellationToken = default) =>
|
||||
await 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;
|
||||
}
|
||||
) => await mediator.Send(command, cancellationToken);
|
||||
|
||||
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;
|
||||
}
|
||||
public async Task<TResponse> Query<TResponse>(
|
||||
IQuery<TResponse> query,
|
||||
CancellationToken cancellationToken = default
|
||||
) => await mediator.Send(query, cancellationToken);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue