Add tenant services, change id by _id and include delete endpoint for all entities

This commit is contained in:
Sergio Matias Urquin
2025-08-07 18:27:06 -06:00
parent f3d63ca0e3
commit 296aff13fe
47 changed files with 1183 additions and 118 deletions

View File

@@ -15,6 +15,7 @@ namespace Core.Thalos.Application.UseCases.Permissions
IComponentHandler<GetAllPermissionsByListRequest>,
IComponentHandler<UpdatePermissionRequest>,
IComponentHandler<GetPermissionRequest>,
IComponentHandler<DeletePermissionRequest>,
IComponentHandler<CreatePermissionRequest>
{
private readonly IPermissionPort _port;
@@ -43,7 +44,29 @@ namespace Core.Thalos.Application.UseCases.Permissions
{
ArgumentNullException.ThrowIfNull(command);
var result = await _thalosDALService.GetPermissionByIdAsync(command.Id, cancellationToken).ConfigureAwait(false);
var result = await _thalosDALService.GetPermissionByIdAsync(command._Id, cancellationToken).ConfigureAwait(false);
if (result == null)
{
_port.NoContentSuccess();
return;
}
_port.Success(result);
}
catch (Exception ex)
{
ApiResponseHelper.EvaluatePort(ex, _port);
}
}
public async ValueTask ExecuteAsync(DeletePermissionRequest command, CancellationToken cancellationToken = default)
{
try
{
ArgumentNullException.ThrowIfNull(command);
var result = await _thalosDALService.DeletePermissionAsync(command._Id, cancellationToken).ConfigureAwait(false);
if (result == null)
{
@@ -111,7 +134,7 @@ namespace Core.Thalos.Application.UseCases.Permissions
return;
}
var result = await _thalosDALService.ChangeStatusPermissionAsync(command.Id, command.Status, cancellationToken).ConfigureAwait(false);
var result = await _thalosDALService.ChangeStatusPermissionAsync(command._Id, command.Status, cancellationToken).ConfigureAwait(false);
if (result == null)
{
@@ -176,13 +199,13 @@ namespace Core.Thalos.Application.UseCases.Permissions
var request = new PermissionAdapter
{
Id = command.Id,
_Id = command._Id,
Name = command.Name,
Description = command.Description,
AccessLevel = command.AccessLevel
};
string id = command.Id;
string id = command._Id;
var result = await _thalosDALService.UpdatePermissionAsync(request, id, cancellationToken).ConfigureAwait(false);