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.Modules
IComponentHandler<GetAllModulesByListRequest>,
IComponentHandler<UpdateModuleRequest>,
IComponentHandler<GetModuleRequest>,
IComponentHandler<DeleteModuleRequest>,
IComponentHandler<CreateModuleRequest>
{
private readonly IModulePort _port;
@@ -46,7 +47,29 @@ namespace Core.Thalos.Application.UseCases.Modules
{
ArgumentNullException.ThrowIfNull(command);
var result = await _thalosDALService.GetModuleByIdAsync(command.Id, cancellationToken).ConfigureAwait(false);
var result = await _thalosDALService.GetModuleByIdAsync(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(DeleteModuleRequest command, CancellationToken cancellationToken = default)
{
try
{
ArgumentNullException.ThrowIfNull(command);
var result = await _thalosDALService.DeleteModuleAsync(command._Id, cancellationToken).ConfigureAwait(false);
if (result == null)
{
@@ -120,7 +143,7 @@ namespace Core.Thalos.Application.UseCases.Modules
return;
}
var result = await _thalosDALService.ChangeStatusModuleAsync(command.Id, command.Status, cancellationToken).ConfigureAwait(false);
var result = await _thalosDALService.ChangeStatusModuleAsync(command._Id, command.Status, cancellationToken).ConfigureAwait(false);
if (result == null)
{
@@ -188,7 +211,7 @@ namespace Core.Thalos.Application.UseCases.Modules
var request = new ModuleAdapter
{
Id = command.Id,
_Id = command._Id,
Name = command.Name,
Description = command.Description,
Application = command.Application,
@@ -197,7 +220,7 @@ namespace Core.Thalos.Application.UseCases.Modules
Icon = command.Icon
};
string id = command.Id;
string id = command._Id;
var result = await _thalosDALService.UpdateModuleAsync(request, id, cancellationToken).ConfigureAwait(false);