remove user consent services
This commit is contained in:
parent
7d760b589e
commit
f6595ed1df
@ -22,9 +22,7 @@ namespace Core.Cerberos.Application.UseCases.Users
|
||||
IComponentHandler<LoginUserRequest>,
|
||||
IComponentHandler<LogoutUserRequest>,
|
||||
IComponentHandler<ValidateUserExistenceRequest>,
|
||||
IComponentHandler<GetTokenAdapterRequest>,
|
||||
IComponentHandler<GetConsentFormPDFRequest>,
|
||||
IComponentHandler<AcceptUserConsentFormRequest>
|
||||
IComponentHandler<GetTokenAdapterRequest>
|
||||
{
|
||||
private readonly IUserPort _port;
|
||||
private readonly IValidator<ChangeUserStatusRequest> _changeUserStatusValidator;
|
||||
@ -380,48 +378,6 @@ namespace Core.Cerberos.Application.UseCases.Users
|
||||
var result = await _cerberosDALService.GetTokenAdapter(command.Email, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_port.NoContentSuccess();
|
||||
return;
|
||||
}
|
||||
|
||||
_port.Success(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ApiResponseHelper.EvaluatePort(ex, _port);
|
||||
}
|
||||
}
|
||||
|
||||
public async ValueTask ExecuteAsync(GetConsentFormPDFRequest command, CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(command);
|
||||
|
||||
var _result = await _cerberosDALService.GetConsentFormPDFAsync(cancellationToken).ConfigureAwait(false);
|
||||
if (_result == null)
|
||||
{
|
||||
_port.NoContentSuccess();
|
||||
return;
|
||||
}
|
||||
_port.Success(_result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ApiResponseHelper.EvaluatePort(ex, _port);
|
||||
}
|
||||
}
|
||||
|
||||
public async ValueTask ExecuteAsync(AcceptUserConsentFormRequest command, CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(command);
|
||||
|
||||
var result = await _cerberosDALService.AcceptUserConsentFormAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
_port.NoContentSuccess();
|
||||
|
||||
@ -52,12 +52,6 @@ namespace Core.Cerberos.External.Clients
|
||||
[Delete("/v1/User/" + Routes.RemoveProject)]
|
||||
Task<UserAdapter> RemoveProjectToUserAsync([FromRoute] string userId, [FromRoute] string projectId, CancellationToken cancellationToken = default);
|
||||
|
||||
[Get("/v1/User/GetConsentFormPDF")]
|
||||
Task<BlobDownloadUriAdapter> GetConsentFormPDFAsync(CancellationToken cancellationToken = default);
|
||||
|
||||
[Patch("/v1/User/AcceptUserConsentForm")]
|
||||
Task<UserAdapter> AcceptUserConsentFormAsync(CancellationToken cancellationToken = default);
|
||||
|
||||
[Get("/v1/Role")]
|
||||
Task<IEnumerable<RoleAdapter>> GetAllRolesAsync(CancellationToken cancellationToken = default);
|
||||
|
||||
|
||||
@ -388,45 +388,5 @@ namespace Core.Cerberos.Service.API.Controllers
|
||||
|
||||
return port.ViewModel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Consent Form PDF.
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[Route("GetConsentFormPDF")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
|
||||
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[Authorize(AuthenticationSchemes = Schemes.HeathScheme)]
|
||||
[Permission("UserManagement.Read")]
|
||||
public async Task<IActionResult> GetConsentFormPDFAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
await getConsentFormPDFHandler.ExecuteAsync(new GetConsentFormPDFRequest { }, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return port.ViewModel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Accept user consent form.
|
||||
/// </summary>
|
||||
[HttpPatch("AcceptUserConsentForm")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
|
||||
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
[Authorize(AuthenticationSchemes = $"{Schemes.HeathScheme}, {Schemes.AzureScheme}")]
|
||||
public async Task<IActionResult> AcceptUserConsentFormAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
await acceptUserConsentFormHandler.ExecuteAsync(new AcceptUserConsentFormRequest { }, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return port.ViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,8 +84,6 @@ builder.Host.ConfigureServices((context, services) =>
|
||||
services.AddScoped<IComponentHandler<RemoveProjectFromUserRequest>, UserHandler>();
|
||||
services.AddScoped<IComponentHandler<ValidateUserExistenceRequest>, UserHandler>();
|
||||
services.AddScoped<IComponentHandler<GetTokenAdapterRequest>, UserHandler>();
|
||||
services.AddScoped<IComponentHandler<GetConsentFormPDFRequest>, UserHandler>();
|
||||
services.AddScoped<IComponentHandler<AcceptUserConsentFormRequest>, UserHandler>();
|
||||
|
||||
|
||||
services.AddValidatorsFromAssemblyContaining<CreateUserValidator>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user