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.Role
IComponentHandler<UpdateRoleRequest>,
IComponentHandler<CreateRoleRequest>,
IComponentHandler<GetRoleRequest>,
IComponentHandler<DeleteRoleRequest>,
IComponentHandler<AddApplicationToRoleRequest>,
IComponentHandler<RemoveApplicationFromRoleRequest>
@@ -45,7 +46,29 @@ namespace Core.Thalos.Application.UseCases.Role
{
ArgumentNullException.ThrowIfNull(command);
var result = await _thalosDALService.GetRoleByIdAsync(command.Id, cancellationToken).ConfigureAwait(false);
var result = await _thalosDALService.GetRoleByIdAsync(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(DeleteRoleRequest command, CancellationToken cancellationToken = default)
{
try
{
ArgumentNullException.ThrowIfNull(command);
var result = await _thalosDALService.DeleteRoleAsync(command._Id, cancellationToken).ConfigureAwait(false);
if (result == null)
{
@@ -93,7 +116,7 @@ namespace Core.Thalos.Application.UseCases.Role
return;
}
var result = await _thalosDALService.ChangeRoleStatusAsync(command.Id, command.Status, cancellationToken).ConfigureAwait(false);
var result = await _thalosDALService.ChangeRoleStatusAsync(command._Id, command.Status, cancellationToken).ConfigureAwait(false);
if (result == null)
{
@@ -161,7 +184,7 @@ namespace Core.Thalos.Application.UseCases.Role
var request = new RoleAdapter
{
Id = command.Id,
_Id = command._Id,
Name = command.Name,
Description = command.Description,
Applications = command.Applications,
@@ -169,7 +192,7 @@ namespace Core.Thalos.Application.UseCases.Role
Permissions = command.Permissions
};
string id = command.Id;
string id = command._Id;
var result = await _thalosDALService.UpdateRoleAsync(request, id, cancellationToken).ConfigureAwait(false);