13 Commits

Author SHA1 Message Date
4a3fb91ffe Merge pull request 'Update the Thalos.BuildingBlocks library to retrieve the idToken instead of accessToken from google authentication' (#6) from feature/use-id-token into development
Reviewed-on: #6
Reviewed-by: efrain_marin <efrain.marin@agilewebs.com>
Reviewed-by: Sergio Matías <sergio.matias@agilewebs.com>
2025-08-28 17:40:06 +00:00
Oscar Morales
3673febe93 Update the Thalos.BuildingBlocks library to retrieve the idToken instead of accessToken from google authentication 2025-08-27 23:26:04 -06:00
263bcc7649 Disable temporary authorization 2025-08-26 15:11:53 -06:00
3e935aa006 Fixed: google settings 2025-08-22 21:30:20 -06:00
ee01415ebe Merge pull request 'Add tenant property' (#5) from feature/add-tenantproperty-touser into development
Reviewed-on: #5
Reviewed-by: OscarMmtz <oscar.morales@agilewebs.com>
2025-08-22 21:41:47 +00:00
69f0590e8d Add tenant property 2025-08-09 00:06:59 -06:00
42f213e09d Merge pull request 'Add tenant services and delete services' (#4) from feature/tenant-services into development
Reviewed-on: #4
Reviewed-by: OscarMmtz <oscar.morales@agilewebs.com>
Reviewed-by: efrain_marin <efrain.marin@agilewebs.com>
2025-08-08 18:06:11 +00:00
69e21e276c Add tenant services and delete services 2025-08-07 18:37:26 -06:00
6a055bc3db Revise CBB and remove unnecessary code 2025-07-27 19:32:34 -06:00
4e620e92f6 Merge pull request 'Configura authentication and authorization' (#3) from feature/configure-authentication into development
Reviewed-on: #3
Reviewed-by: efrain_marin <efrain.marin@agilewebs.com>
Reviewed-by: Sergio Matías <sergio.matias@agilewebs.com>
2025-07-18 00:59:09 +00:00
Oscar Morales
482a330a39 Configura authentication and authorization 2025-07-15 14:04:07 -06:00
0429704cac fix 2025-06-23 00:32:26 -06:00
3b0c31c38e Merge pull request #2 from SergioMatias94/feature/adapt-endpoints
Adapt endpoints and configuration
2025-06-17 15:51:37 -06:00
45 changed files with 490 additions and 294 deletions

View File

@@ -1,11 +1,8 @@
using Asp.Versioning;
using Core.Thalos.Adapters;
using Core.Thalos.Adapters.Common.Constants;
using Core.Thalos.Adapters.Contracts;
using Core.Thalos.Application.UseCases.Users.Input;
using Core.Thalos.BuildingBlocks;
using Core.Thalos.External.Clients.Thalos.Requests.Users;
using LSA.Dashboard.External.Clients.Dashboard;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Core.Thalos.BFF.Api.Controllers
@@ -18,8 +15,22 @@ namespace Core.Thalos.BFF.Api.Controllers
[Produces(MimeTypes.ApplicationJson)]
[Consumes(MimeTypes.ApplicationJson)]
[ApiController]
public class AuthenticationController(IThalosServiceClient thalosServiceClient, ILogger<AuthenticationController> logger, ITokenService tokenService) : BaseController(logger)
public class AuthenticationController(
IThalosServiceClient thalosServiceClient,
ILogger<AuthenticationController> logger,
ITokenService tokenService,
IGoogleAuthorization googleAuthorization) : BaseController(logger)
{
[HttpGet]
public IActionResult Authorize() => Ok(googleAuthorization.GetAuthorizationUrl());
[HttpGet("callback")]
public async Task<IActionResult> Callback(string code)
{
var userCredential = await googleAuthorization.ExchangeCodeForToken(code);
return Ok(new { Token = userCredential!.Token.IdToken });
}
/// <summary>
/// Get token for user.
/// </summary>
@@ -30,7 +41,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[HttpGet]
[Route(Routes.GenerateToken)]
[ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)]
[Authorize(AuthenticationSchemes = Schemes.AzureScheme)]
//[Authorize(AuthenticationSchemes = Schemes.GoogleScheme)]
public async Task<IActionResult> GenerateTokenService(CancellationToken cancellationToken)
{
try

View File

@@ -1,11 +1,8 @@
using Asp.Versioning;
using Core.Thalos.Adapters;
using Core.Thalos.Adapters.Attributes;
using Core.Thalos.Adapters.Common.Constants;
using Core.Thalos.BuildingBlocks;
using Core.Thalos.External.Clients.Thalos.Requests.Permissions;
using Lib.Architecture.BuildingBlocks;
using LSA.Dashboard.External.Clients.Dashboard;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Text.Json;
@@ -23,7 +20,7 @@ namespace Core.Thalos.BFF.Api.Controllers
public class ModuleController(IThalosServiceClient thalosServiceClient, ILogger<ModuleController> logger) : BaseController(logger)
{
/// <summary>
/// Gets all the modules.
/// Gets all modules.
/// </summary>
[HttpGet("GetAll")]
[ProducesResponseType(StatusCodes.Status200OK)]
@@ -49,7 +46,7 @@ namespace Core.Thalos.BFF.Api.Controllers
}
/// <summary>
/// Gets all the modules by module identifiers.
/// Gets all modules by module identifiers.
/// </summary>
/// <param name="request">The request containing the list of module identifiers.</param>
/// <param name="cancellationToken">Cancellation token for the asynchronous operation.</param>
@@ -139,7 +136,7 @@ namespace Core.Thalos.BFF.Api.Controllers
{
logger.LogInformation($"{nameof(GetModuleByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid module identifier");
if (string.IsNullOrEmpty(request._Id)) return BadRequest("Invalid module identifier");
return await Handle(() => thalosServiceClient.GetModuleByIdService(request, cancellationToken)).ConfigureAwait(false);
}
@@ -203,7 +200,7 @@ namespace Core.Thalos.BFF.Api.Controllers
{
logger.LogInformation($"{nameof(ChangeModuleStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid module identifier"); }
if (string.IsNullOrEmpty(request._Id)) { return BadRequest("Invalid module identifier"); }
return await Handle(() => thalosServiceClient.ChangeModuleStatusService(request, cancellationToken)).ConfigureAwait(false);
}

View File

@@ -1,13 +1,10 @@
using Asp.Versioning;
using Core.Thalos.Adapters;
using Core.Thalos.Adapters.Attributes;
using Core.Thalos.Adapters.Common.Constants;
using Core.Thalos.BuildingBlocks;
using Core.Thalos.External.Clients.Thalos.Requests.Permissions;
using Lib.Architecture.BuildingBlocks;
using LSA.Dashboard.External.Clients.Dashboard;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Graph;
using System.Text.Json;
namespace Core.Thalos.BFF.Api.Controllers
@@ -24,7 +21,7 @@ namespace Core.Thalos.BFF.Api.Controllers
public class PermissionController(IThalosServiceClient thalosServiceClient, ILogger<PermissionController> logger) : BaseController(logger)
{
/// <summary>
/// Gets all the permissions.
/// Gets all permissions.
/// </summary>
[HttpGet("GetAll")]
[ProducesResponseType(StatusCodes.Status200OK)]
@@ -33,7 +30,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("PermissionManagement.Read, RoleManagement.Read")]
//[Permission("PermissionManagement.Read, RoleManagement.Read")]
public async Task<IActionResult> GetAllPermissionsService(CancellationToken cancellationToken)
{
try
@@ -50,7 +47,7 @@ namespace Core.Thalos.BFF.Api.Controllers
}
/// <summary>
/// Gets all the permissions by permission identifiers.
/// Gets all permissions by permission identifiers.
/// </summary>
/// <param name="request">The request containing the list of permission identifiers.</param>
/// <param name="cancellationToken">Cancellation token for the asynchronous operation.</param>
@@ -66,7 +63,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("PermissionManagement.Read")]
//[Permission("PermissionManagement.Read")]
public async Task<IActionResult> GetAllPermissionsByListAsync([FromBody] GetAllPermissionsByListRequest request, CancellationToken cancellationToken)
{
try
@@ -99,7 +96,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("PermissionManagement.Write")]
//[Permission("PermissionManagement.Write")]
public async Task<IActionResult> CreatePermissionService(CreatePermissionRequest newPermission, CancellationToken cancellationToken)
{
try
@@ -131,14 +128,14 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("PermissionManagement.Read")]
//[Permission("PermissionManagement.Read")]
public async Task<IActionResult> GetPermissionByIdService(GetPermissionRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(GetPermissionByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid permission identifier");
if (string.IsNullOrEmpty(request._Id)) return BadRequest("Invalid permission identifier");
return await Handle(() => thalosServiceClient.GetPermissionByIdService(request, cancellationToken)).ConfigureAwait(false);
}
@@ -159,7 +156,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("PermissionManagement.Write")]
//[Permission("PermissionManagement.Write")]
public async Task<IActionResult> UpdatePermissionService(UpdatePermissionRequest newPermission, CancellationToken cancellationToken)
{
try
@@ -193,14 +190,14 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("PermissionManagement.Write")]
//[Permission("PermissionManagement.Write")]
public async Task<IActionResult> ChangePermissionStatusService([FromBody] ChangePermissionStatusRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(ChangePermissionStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid permission identifier"); }
if (string.IsNullOrEmpty(request._Id)) { return BadRequest("Invalid permission identifier"); }
return await Handle(() => thalosServiceClient.ChangePermissionStatusService(request, cancellationToken)).ConfigureAwait(false);
}

View File

@@ -1,7 +1,6 @@
using Asp.Versioning;
using Core.Thalos.Adapters.Attributes;
using Core.Thalos.Adapters.Common.Constants;
using Core.Thalos.Application.UseCases.Roles.Input;
using Core.Thalos.BuildingBlocks;
using Lib.Architecture.BuildingBlocks;
using LSA.Dashboard.External.Clients.Dashboard;
using Microsoft.AspNetCore.Authorization;
@@ -22,7 +21,7 @@ namespace Core.Thalos.BFF.Api.Controllers
public class RoleController(IThalosServiceClient thalosServiceClient, ILogger<RoleController> logger) : BaseController(logger)
{
/// <summary>
/// Gets all the roles.
/// Gets all roles.
/// </summary>
[HttpGet("GetAll")]
[ProducesResponseType(StatusCodes.Status200OK)]
@@ -31,7 +30,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("RoleManagement.Read")]
//[Permission("RoleManagement.Read")]
public async Task<IActionResult> GetAllRolesService(CancellationToken cancellationToken)
{
try
@@ -57,7 +56,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("RoleManagement.Write")]
//[Permission("RoleManagement.Write")]
public async Task<IActionResult> CreateRoleService(CreateRoleRequest request, CancellationToken cancellationToken)
{
try
@@ -95,14 +94,14 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("RoleManagement.Read")]
//[Permission("RoleManagement.Read")]
public async Task<IActionResult> GetRoleByIdService(GetRoleRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(GetRoleByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid role identifier");
if (string.IsNullOrEmpty(request._Id)) return BadRequest("Invalid role identifier");
return await Handle(() => thalosServiceClient.GetRoleByIdService(request, cancellationToken)).ConfigureAwait(false);
}
@@ -123,7 +122,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("RoleManagement.Write")]
//[Permission("RoleManagement.Write")]
public async Task<IActionResult> UpdateRoleService(UpdateRoleRequest request, CancellationToken cancellationToken)
{
try
@@ -134,7 +133,7 @@ namespace Core.Thalos.BFF.Api.Controllers
if (string.IsNullOrEmpty(request.Name)) return BadRequest("Invalid role name");
if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid role identifier");
if (string.IsNullOrEmpty(request._Id)) return BadRequest("Invalid role identifier");
if (string.IsNullOrEmpty(request.Description)) return BadRequest("Invalid role description");
@@ -166,14 +165,14 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("RoleManagement.Write")]
//[Permission("RoleManagement.Write")]
public async Task<IActionResult> ChangeRoleStatusService([FromBody] ChangeRoleStatusRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(ChangeRoleStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid role identifier"); }
if (string.IsNullOrEmpty(request._Id)) { return BadRequest("Invalid role identifier"); }
return await Handle(() => thalosServiceClient.ChangeRoleStatusService(request, cancellationToken)).ConfigureAwait(false);
}
@@ -196,7 +195,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("RoleManagement.Write")]
//[Permission("RoleManagement.Write")]
public async Task<IActionResult> AddApplicationToRoleService([FromBody] AddApplicationToRoleRequest request, CancellationToken cancellationToken)
{
try
@@ -226,7 +225,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Permission("RoleManagement.Write")]
//[Permission("RoleManagement.Write")]
public async Task<IActionResult> RemoveApplicationFromRoleService([FromBody] RemoveApplicationFromRoleRequest request, CancellationToken cancellationToken)
{
try

View File

@@ -0,0 +1,196 @@
using Asp.Versioning;
using Core.Thalos.BuildingBlocks;
using Core.Thalos.External.Clients.Thalos.Requests.Tenants;
using Lib.Architecture.BuildingBlocks;
using LSA.Dashboard.External.Clients.Dashboard;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Text.Json;
namespace Core.Thalos.BFF.Api.Controllers
{
/// <summary>
/// Handles all requests for Tenant authentication.
/// </summary>
[ApiVersion("1.0")]
[Route("api/v{version:apiVersion}/[controller]")]
[Consumes("application/json")]
[Produces("application/json")]
[ApiController]
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
public class TenantController(IThalosServiceClient thalosServiceClient, ILogger<TenantController> logger) : BaseController(logger)
{
/// <summary>
/// Gets all Tenants.
/// </summary>
[HttpGet("GetAll")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Permission("TenantManagement.Read, RoleManagement.Read")]
public async Task<IActionResult> GetAllTenantsService(CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(GetAllTenantsService)} - Request received - Payload: ");
return await Handle(() => thalosServiceClient.GetAllTenantsService(new GetAllTenantsRequest { }, cancellationToken)).ConfigureAwait(false);
}
catch (Exception ex)
{
logger.LogError($"{nameof(GetAllTenantsService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload");
throw;
}
}
/// <summary>
/// Creates a new Tenant.
/// </summary>
[HttpPost("Create")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Permission("TenantManagement.Write")]
public async Task<IActionResult> CreateTenantService(CreateTenantRequest newTenant, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(CreateTenantService)} - Request received - Payload: {JsonSerializer.Serialize(newTenant)}");
if (newTenant == null) return BadRequest("Invalid Tenant object");
if (string.IsNullOrEmpty(newTenant.Name)) return BadRequest("Invalid Tenant name");
return await Handle(() => thalosServiceClient.CreateTenantService(newTenant, cancellationToken)).ConfigureAwait(false);
}
catch (Exception ex)
{
logger.LogError($"{nameof(CreateTenantService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(newTenant)}");
throw;
}
}
/// <summary>
/// Gets the Tenant by identifier.
/// </summary>
[HttpPost("GetById")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Permission("TenantManagement.Read")]
public async Task<IActionResult> GetTenantByIdService(GetTenantRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(GetTenantByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request._Id)) return BadRequest("Invalid Tenant identifier");
return await Handle(() => thalosServiceClient.GetTenantByIdService(request, cancellationToken)).ConfigureAwait(false);
}
catch (Exception ex)
{
logger.LogError($"{nameof(GetTenantByIdService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
throw;
}
}
/// <summary>
/// Updates a full Tenant by identifier.
/// </summary>
[HttpPut("Update")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Permission("TenantManagement.Write")]
public async Task<IActionResult> UpdateTenantService(UpdateTenantRequest newTenant, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(UpdateTenantService)} - Request received - Payload: {JsonSerializer.Serialize(newTenant)}");
if (newTenant == null) return BadRequest("Invalid Tenant object");
if (string.IsNullOrEmpty(newTenant.Name)) return BadRequest("Invalid Tenant name");
return await Handle(() => thalosServiceClient.UpdateTenantService(newTenant, cancellationToken)).ConfigureAwait(false);
}
catch (Exception ex)
{
logger.LogError($"{nameof(UpdateTenantService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(newTenant)}");
throw;
}
}
/// <summary>
/// Changes the status of the Tenant.
/// </summary>
[HttpPatch]
[Route("ChangeStatus")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Permission("TenantManagement.Write")]
public async Task<IActionResult> ChangeTenantStatusService([FromBody] ChangeTenantStatusRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(ChangeTenantStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request._Id)) { return BadRequest("Invalid Tenant identifier"); }
return await Handle(() => thalosServiceClient.ChangeTenantStatusService(request, cancellationToken)).ConfigureAwait(false);
}
catch (Exception ex)
{
logger.LogError($"{nameof(ChangeTenantStatusService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
throw;
}
}
/// <summary>
/// Deletes the Tenant by identifier.
/// </summary>
[HttpDelete("Delete")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Permission("TenantManagement.Write")]
public async Task<IActionResult> DeleteTenantByIdService(DeleteTenantRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(DeleteTenantByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request._Id)) return BadRequest("Invalid Tenant identifier");
return await Handle(() => thalosServiceClient.DeleteTenantByIdService(request, cancellationToken)).ConfigureAwait(false);
}
catch (Exception ex)
{
logger.LogError($"{nameof(DeleteTenantByIdService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
throw;
}
}
}
}

View File

@@ -1,7 +1,6 @@
using Asp.Versioning;
using Core.Thalos.Adapters.Attributes;
using Core.Thalos.Adapters.Common.Constants;
using Core.Thalos.Application.UseCases.Users.Input;
using Core.Thalos.BuildingBlocks;
using Core.Thalos.External.Clients.Thalos.Requests.Users;
using Lib.Architecture.BuildingBlocks;
using LSA.Dashboard.External.Clients.Dashboard;
@@ -22,7 +21,7 @@ namespace Core.Thalos.BFF.Api.Controllers
public class UserController(IThalosServiceClient thalosServiceClient, ILogger<UserController> logger) : BaseController(logger)
{
/// <summary>
/// Gets all the users.
/// Gets all users.
/// </summary>
[HttpGet("GetAll")]
[ProducesResponseType(StatusCodes.Status200OK)]
@@ -32,7 +31,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Read")]
//[Permission("UserManagement.Read")]
public async Task<IActionResult> GetAllUsersService(CancellationToken cancellationToken)
{
try
@@ -59,7 +58,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")]
//[Permission("UserManagement.Write")]
public async Task<IActionResult> CreateUserService(CreateUserRequest newUser, CancellationToken cancellationToken)
{
try
@@ -76,8 +75,6 @@ namespace Core.Thalos.BFF.Api.Controllers
if (string.IsNullOrEmpty(newUser.RoleId)) return BadRequest("Invalid role id");
if (!newUser.Companies.Any()) return BadRequest("The user must contain at least one company");
return await Handle(() => thalosServiceClient.CreateUserService(newUser, cancellationToken)).ConfigureAwait(false);
}
catch (Exception ex)
@@ -98,14 +95,14 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Read")]
//[Permission("UserManagement.Read")]
public async Task<IActionResult> GetUserByIdService(GetUserRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(GetUserByIdService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid user identifier");
if (string.IsNullOrEmpty(request._Id)) return BadRequest("Invalid user identifier");
return await Handle(() => thalosServiceClient.GetUserByIdService(request, cancellationToken)).ConfigureAwait(false);
}
@@ -127,7 +124,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Read")]
//[Permission("UserManagement.Read")]
public async Task<IActionResult> GetUserByEmailService(GetUserByEmailRequest request, CancellationToken cancellationToken)
{
try
@@ -156,7 +153,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")]
//[Permission("UserManagement.Write")]
public async Task<IActionResult> UpdateUserService(UpdateUserRequest request, CancellationToken cancellationToken)
{
try
@@ -194,7 +191,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = $"{Schemes.AzureScheme}, {Schemes.DefaultScheme}")]
//[Authorize(AuthenticationSchemes = $"{Schemes.GoogleScheme}, {Schemes.DefaultScheme}")]
public async Task<IActionResult> LoginUserService([FromBody] LoginUserRequest request, CancellationToken cancellationToken)
{
try
@@ -222,7 +219,7 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
[Authorize(AuthenticationSchemes = $"{Schemes.AzureScheme}, {Schemes.DefaultScheme}")]
//[Authorize(AuthenticationSchemes = $"{Schemes.GoogleScheme}, {Schemes.DefaultScheme}")]
public async Task<IActionResult> LogoutUserService([FromBody] LogoutUserRequest request, CancellationToken cancellationToken)
{
try
@@ -253,14 +250,14 @@ namespace Core.Thalos.BFF.Api.Controllers
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")]
//[Permission("UserManagement.Write")]
public async Task<IActionResult> ChangeUserStatusService([FromBody] ChangeUserStatusRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(ChangeUserStatusService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request.Id)) { return BadRequest("Invalid user identifier"); }
if (string.IsNullOrEmpty(request._Id)) { return BadRequest("Invalid user identifier"); }
return await Handle(() => thalosServiceClient.ChangeUserStatusService(request, cancellationToken)).ConfigureAwait(false);
}
@@ -271,135 +268,6 @@ namespace Core.Thalos.BFF.Api.Controllers
}
}
/// <summary>
/// Adds a company to the user's list of companies.
/// </summary>
[HttpPost]
[Route("AddCompany")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")]
public async Task<IActionResult> AddCompanyToUserService([FromBody] AddCompanyToUserRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(AddCompanyToUserService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); }
if (string.IsNullOrEmpty(request.CompanyId)) { return BadRequest("Invalid company identifier"); }
return await Handle(() => thalosServiceClient.AddCompanyToUserService(request, cancellationToken)).ConfigureAwait(false);
}
catch (Exception ex)
{
logger.LogError($"{nameof(AddCompanyToUserService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
throw;
}
}
/// <summary>
/// Removes a company from the user's list of companies.
/// </summary>
[HttpDelete]
[Route("RemoveCompany")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")]
public async Task<IActionResult> RemoveCompanyFromUserService([FromBody] RemoveCompanyFromUserRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(RemoveCompanyFromUserService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); }
if (string.IsNullOrEmpty(request.CompanyId)) { return BadRequest("Invalid company identifier"); }
return await Handle(() => thalosServiceClient.RemoveCompanyFromUserService(request, cancellationToken)).ConfigureAwait(false);
}
catch (Exception ex)
{
logger.LogError($"{nameof(RemoveCompanyFromUserService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
throw;
}
}
/// <summary>
/// Adds a project to the user's list of companies.
/// </summary>
[HttpPost]
[Route("AddProject")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")]
public async Task<IActionResult> AddProjectToUserService([FromBody] AddProjectToUserRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(AddProjectToUserService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); }
if (string.IsNullOrEmpty(request.ProjectId)) { return BadRequest("Invalid project identifier"); }
return await Handle(() => thalosServiceClient.AddProjectToUserService(request, cancellationToken)).ConfigureAwait(false);
}
catch (Exception ex)
{
logger.LogError($"{nameof(AddProjectToUserService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
throw;
}
}
/// <summary>
/// Removes a project from the user's list of companies.
/// </summary>
[HttpDelete]
[Route("RemoveProject")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)]
[ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
[Permission("UserManagement.Write")]
public async Task<IActionResult> RemoveProjectFromUserService([FromBody] RemoveProjectFromUserRequest request, CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(RemoveProjectFromUserService)} - Request received - Payload: {JsonSerializer.Serialize(request)}");
if (string.IsNullOrEmpty(request.UserId)) { return BadRequest("Invalid user identifier"); }
if (string.IsNullOrEmpty(request.ProjectId)) { return BadRequest("Invalid project identifier"); }
return await Handle(() => thalosServiceClient.RemoveProjectFromUserService(request, cancellationToken)).ConfigureAwait(false);
}
catch (Exception ex)
{
logger.LogError($"{nameof(RemoveProjectFromUserService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}");
throw;
}
}
/// <summary>
/// Gets the user by email.
/// </summary>

View File

@@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="Asp.Versioning.Mvc" Version="8.1.0" />
<PackageReference Include="Core.Blueprint.Logging" Version="1.0.0" />
<PackageReference Include="Core.Blueprint.Logging" Version="1.0.1" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,23 +1,30 @@
using Asp.Versioning;
using Azure.Identity;
using Core.Blueprint.KeyVault.Configuration;
using Core.Blueprint.Logging.Configuration;
using Core.Thalos.Adapters.Extensions;
using Core.Thalos.BuildingBlocks;
using Core.Thalos.BuildingBlocks.Configuration;
using Core.Thalos.BuildingBlocks.Extensions;
using Core.Thalos.External.ClientConfiguration;
using Microsoft.AspNetCore.ResponseCompression;
using Microsoft.Extensions.Configuration.AzureAppConfiguration;
using OpenTelemetry.Logs;
using OpenTelemetry.Resources;
using Swashbuckle.AspNetCore.SwaggerUI;
using System.IO.Compression;
using System.Reflection;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Configuration
.AddUserSecrets(Assembly.GetExecutingAssembly())
.AddEnvironmentVariables();
var services = builder.Services.AddKeyVault(builder.Configuration);
var authSettings = await AuthHelper.GetAuthSettings(builder.Services, builder, "thalos_common");
builder.Services.ConfigureAuthentication(builder.Configuration, authSettings);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddResponseCompression();
builder.Services.AddProblemDetails();
builder.Services.AddLogs(builder);
@@ -80,20 +87,13 @@ builder.Host.ConfigureServices((context, services) =>
});
services.AddResponseCaching();
services.AddControllers();
services.AddEndpointsApiExplorer();
services.AddSwaggerGen();
services.AddSwaggerGen(builder.Configuration, "Core.Thalos.BFF.Api.xml", authSettings);
services.AddVersioning(builder.Configuration);
services.AddLogging();
services.AddProblemDetails();
services.AddHttpContextAccessor();
services.AddTransient<TrackingMechanismExtension>(); // Register the TrackingIdHandler
services.RegisterExternalLayer(builder.Configuration);
services.AddApiVersioning(options => options.ReportApiVersions = true)
.AddApiExplorer(options =>
{
options.GroupNameFormat = "'v'VVV";
options.SubstituteApiVersionInUrl = true;
});
});
builder.Services.AddCors(options =>
@@ -107,30 +107,37 @@ builder.Services.AddCors(options =>
});
});
builder.Services.AddScoped<ITokenService, TokenService>();
builder.Services.AddOutputCache(options =>
{
options.AddBasePolicy(builder =>
builder.Expire(TimeSpan.FromSeconds(10)));
options.AddPolicy("Expire20", builder =>
builder.Expire(TimeSpan.FromSeconds(20)));
options.AddPolicy("Expire30", builder =>
builder.Expire(TimeSpan.FromSeconds(30)));
});
//*************************************************************************//
var app = builder.Build();
app.UseLogging(builder.Configuration);
app.UseSwaggerUI(builder.Configuration, authSettings);
app.ConfigureSwagger(builder.Configuration);
app.UseCors(options => options.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin());
app.UseSwagger();
app.UseSwaggerUI(options =>
{
foreach (var version in app.DescribeApiVersions().Select(version => version.GroupName))
options.SwaggerEndpoint($"/swagger/{version}/swagger.json", version);
options.DisplayRequestDuration();
options.EnableTryItOutByDefault();
options.DocExpansion(DocExpansion.None);
});
app.UseResponseCompression();
app.UseResponseCaching();
app.UseRouting();
app.UseCors();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseResponseCompression();
app.UseOutputCache();
app.UseResponseCaching();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.UseHsts();
app.UseAntiforgery();
app.UseLogging(builder.Configuration);
//app.MapHealthChecks("/health");
app.Run();

View File

@@ -7,6 +7,19 @@
},
"LocalGateways": {
"ThalosService": "https://localhost:7253/api"
},
"ServiceSettings": {
"ApplicationName": "thalos",
"LayerName": "bff"
},
"Vault": {
"Address": "http://100.123.31.103:8200",
"Token": "hvs.e37LQvLuPhTd5ALS5QQ03Cwm",
"SecretMount": "secret"
},
"IdentityProviders": {
"Google": true,
"Azure": true
}
}

View File

@@ -5,8 +5,5 @@
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"Endpoints": {
"AppConfigurationURI": "https://sandbox-hci-usc-appcg.azconfig.io"
}
"AllowedHosts": "*"
}

View File

@@ -1,6 +1,4 @@
using Core.Thalos.Adapters.Contracts;
using Core.Thalos.Adapters.Handlers;
using Core.Thalos.Adapters.TokenProvider;
using Core.Thalos.BuildingBlocks;
using Core.Thalos.External.GatewayConfigurations;
using LSA.Dashboard.External.Clients.Dashboard;
using Microsoft.AspNetCore.Http;

View File

@@ -1,7 +1,8 @@
using Core.Thalos.Adapters;
using Core.Thalos.Application.UseCases.Roles.Input;
using Core.Thalos.Application.UseCases.Roles.Input;
using Core.Thalos.Application.UseCases.Users.Input;
using Core.Thalos.BuildingBlocks;
using Core.Thalos.External.Clients.Thalos.Requests.Permissions;
using Core.Thalos.External.Clients.Thalos.Requests.Tenants;
using Core.Thalos.External.Clients.Thalos.Requests.Users;
using Microsoft.AspNetCore.Mvc;
using Refit;
@@ -31,6 +32,9 @@ namespace LSA.Dashboard.External.Clients.Dashboard
[Put("/v1/User/Update")]
Task<ApiResponse<UserAdapter>> UpdateUserService([Header("TrackingId")][Body] UpdateUserRequest request, CancellationToken cancellationToken = default);
[Delete("/v1/User/Delete")]
Task<ApiResponse<UserAdapter>> DeleteUserByIdService([Header("TrackingId")][Body] DeleteUserRequest request, CancellationToken cancellationToken = default);
[Patch("/v1/User/LoginUser")]
Task<ApiResponse<UserAdapter>> LoginUserService([Header("TrackingId")][Body] LoginUserRequest request, CancellationToken cancellationToken = default);
@@ -40,18 +44,6 @@ namespace LSA.Dashboard.External.Clients.Dashboard
[Patch("/v1/User/ChangeStatus")]
Task<ApiResponse<UserAdapter>> ChangeUserStatusService([Header("TrackingId")][Body] ChangeUserStatusRequest request, CancellationToken cancellationToken = default);
[Post("/v1/User/AddCompany")]
Task<ApiResponse<UserAdapter>> AddCompanyToUserService([Header("TrackingId")][Body] AddCompanyToUserRequest request, CancellationToken cancellationToken = default);
[Delete("/v1/User/RemoveCompany")]
Task<ApiResponse<UserAdapter>> RemoveCompanyFromUserService([Header("TrackingId")][Body] RemoveCompanyFromUserRequest request, CancellationToken cancellationToken = default);
[Post("/v1/User/AddProject")]
Task<ApiResponse<UserAdapter>> AddProjectToUserService([Header("TrackingId")][Body] AddProjectToUserRequest request, CancellationToken cancellationToken = default);
[Delete("/v1/User/RemoveProject")]
Task<ApiResponse<UserAdapter>> RemoveProjectFromUserService([Header("TrackingId")][Body] RemoveProjectFromUserRequest request, CancellationToken cancellationToken = default);
[Post("/v1/User/GetTokenAdapter")]
Task<ApiResponse<TokenAdapter>> GetTokenAdapterService([Header("TrackingId")][Body] GetTokenAdapterRequest request, CancellationToken cancellationToken = default);
@@ -73,6 +65,9 @@ namespace LSA.Dashboard.External.Clients.Dashboard
[Patch("/v1/Role/ChangeStatus")]
Task<ApiResponse<RoleAdapter>> ChangeRoleStatusService([Header("TrackingId")][Body] ChangeRoleStatusRequest request, CancellationToken cancellationToken = default);
[Delete("/v1/Role/Delete")]
Task<ApiResponse<RoleAdapter>> DeleteRoleByIdService([Header("TrackingId")][Body] DeleteRoleRequest request, CancellationToken cancellationToken = default);
[Post("/v1/Role/AddApplication")]
Task<ApiResponse<RoleAdapter>> AddApplicationToRoleService([Header("TrackingId")][Body] AddApplicationToRoleRequest request, CancellationToken cancellationToken = default);
@@ -97,6 +92,9 @@ namespace LSA.Dashboard.External.Clients.Dashboard
[Patch("/v1/Permission/ChangeStatus")]
Task<ApiResponse<PermissionAdapter>> ChangePermissionStatusService([Header("TrackingId")][Body] ChangePermissionStatusRequest request, CancellationToken cancellationToken = default);
[Delete("/v1/Permission/Delete")]
Task<ApiResponse<PermissionAdapter>> DeletePermissionByIdService([Header("TrackingId")][Body] DeletePermissionRequest request, CancellationToken cancellationToken = default);
[Post("/v1/Module/Create")]
Task<ApiResponse<ModuleAdapter>> CreateModuleService([Header("TrackingId")][Body] CreateModuleRequest request, CancellationToken cancellationToken = default);
@@ -114,5 +112,27 @@ namespace LSA.Dashboard.External.Clients.Dashboard
[Patch("/v1/Module/ChangeStatus")]
Task<ApiResponse<ModuleAdapter>> ChangeModuleStatusService([Header("TrackingId")][Body] ChangeModuleStatusRequest request, CancellationToken cancellationToken = default);
[Delete("/v1/Module/Delete")]
Task<ApiResponse<ModuleAdapter>> DeleteModuleByIdService([Header("TrackingId")][Body] DeleteModuleRequest request, CancellationToken cancellationToken = default);
[Post("/v1/Tenant/Create")]
Task<ApiResponse<TenantAdapter>> CreateTenantService([Header("TrackingId")][Body] CreateTenantRequest request, CancellationToken cancellationToken = default);
[Post("/v1/Tenant/GetById")]
Task<ApiResponse<TenantAdapter>> GetTenantByIdService([Header("TrackingId")][Body] GetTenantRequest request, CancellationToken cancellationToken = default);
[Get("/v1/Tenant/GetAll")]
Task<ApiResponse<IEnumerable<TenantAdapter>>> GetAllTenantsService([Header("TrackingId")][Body] GetAllTenantsRequest request, CancellationToken cancellationToken = default);
[Put("/v1/Tenant/Update")]
Task<ApiResponse<TenantAdapter>> UpdateTenantService([Header("TrackingId")][Body] UpdateTenantRequest request, CancellationToken cancellationToken = default);
[Patch("/v1/Tenant/ChangeStatus")]
Task<ApiResponse<TenantAdapter>> ChangeTenantStatusService([Header("TrackingId")][Body] ChangeTenantStatusRequest request, CancellationToken cancellationToken = default);
[Delete("/v1/Tenant/Delete")]
Task<ApiResponse<UserAdapter>> DeleteTenantByIdService([Header("TrackingId")][Body] DeleteTenantRequest request, CancellationToken cancellationToken = default);
}
}

View File

@@ -4,7 +4,7 @@ namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{
public class ChangeModuleStatusRequest
{
public string Id { get; set; }
public string _Id { get; set; }
public StatusEnum Status { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
using Core.Thalos.Adapters.Common.Enums;
using Core.Thalos.BuildingBlocks;
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{

View File

@@ -0,0 +1,7 @@
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{
public class DeleteModuleRequest
{
public string _Id { get; set; }
}
}

View File

@@ -2,6 +2,6 @@
{
public class GetModuleRequest
{
public string Id { get; set; }
public string _Id { get; set; }
}
}

View File

@@ -1,12 +1,11 @@
using Core.Blueprint.Mongo;
using Core.Thalos.Adapters.Common.Enums;
using Core.Thalos.BuildingBlocks;
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{
public class UpdateModuleRequest
{
public string Id { get; set; } = null!;
public string _Id { get; set; } = null!;
public string Name { get; set; } = null!;
public string? Description { get; set; }
public string? Icon { get; set; }

View File

@@ -4,7 +4,7 @@ namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{
public class ChangePermissionStatusRequest
{
public string Id { get; set; }
public string _Id { get; set; }
public StatusEnum Status { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
using Core.Thalos.Adapters.Common.Constants;
using Core.Thalos.BuildingBlocks;
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{

View File

@@ -0,0 +1,7 @@
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{
public class DeletePermissionRequest
{
public string _Id { get; set; }
}
}

View File

@@ -2,6 +2,6 @@
{
public class GetPermissionRequest
{
public string Id { get; set; }
public string _Id { get; set; }
}
}

View File

@@ -1,11 +1,11 @@
using Core.Thalos.Adapters.Common.Constants;
using Core.Thalos.BuildingBlocks;
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
namespace Core.Thalos.External.Clients.Thalos.Requests.Permissions
{
public class UpdatePermissionRequest
{
public string Id { get; set; } = null!;
public string _Id { get; set; } = null!;
public string Name { get; set; } = null!;
public string? Description { get; set; }
public AccessLevelEnum? AccessLevel { get; set; } = null!;

View File

@@ -1,4 +1,4 @@
using Core.Thalos.Adapters.Common.Enums;
using Core.Thalos.BuildingBlocks;
namespace Core.Thalos.Application.UseCases.Roles.Input
{

View File

@@ -4,7 +4,7 @@ namespace Core.Thalos.Application.UseCases.Roles.Input
{
public class ChangeRoleStatusRequest
{
public string Id { get; set; }
public string _Id { get; set; }
public StatusEnum Status { get; set; }
}

View File

@@ -1,4 +1,4 @@
using Core.Thalos.Adapters.Common.Enums;
using Core.Thalos.BuildingBlocks;
using System.Text.Json.Serialization;
namespace Core.Thalos.Application.UseCases.Roles.Input

View File

@@ -0,0 +1,7 @@
namespace Core.Thalos.Application.UseCases.Roles.Input
{
public class DeleteRoleRequest
{
public string _Id { get; set; }
}
}

View File

@@ -2,6 +2,6 @@
{
public class GetRoleRequest
{
public string Id { get; set; }
public string _Id { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
using Core.Thalos.Adapters.Common.Enums;
using Core.Thalos.BuildingBlocks;
namespace Core.Thalos.Application.UseCases.Roles.Input
{

View File

@@ -1,4 +1,4 @@
using Core.Thalos.Adapters.Common.Enums;
using Core.Thalos.BuildingBlocks;
using System.Text.Json.Serialization;
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
@@ -6,7 +6,7 @@ namespace Core.Thalos.Application.UseCases.Roles.Input
{
public class UpdateRoleRequest
{
public string Id { get; set; } = null!;
public string _Id { get; set; } = null!;
public string Name { get; set; } = null!;
public string? Description { get; set; }
[JsonConverter(typeof(EnumArrayJsonConverter<ApplicationsEnum>))]

View File

@@ -0,0 +1,10 @@
using Core.Blueprint.Mongo;
namespace Core.Thalos.External.Clients.Thalos.Requests.Tenants
{
public class ChangeTenantStatusRequest
{
public string _Id { get; set; }
public StatusEnum Status { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
namespace Core.Thalos.External.Clients.Thalos.Requests.Tenants
{
public class CreateTenantRequest
{
public string Name { get; set; } = null!;
public string TaxIdentifier { get; set; } = null!;
public string AddressLine1 { get; set; } = null!;
public string? AddressLine2 { get; set; }
public string City { get; set; } = null!;
public string State { get; set; } = null!;
public string Country { get; set; } = null!;
public string PostalCode { get; set; } = null!;
public string ContactEmail { get; set; } = null!;
public string ContactPhone { get; set; } = null!;
public string? Website { get; set; }
public string? ConnectionString { get; set; }
public bool Isolated { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace Core.Thalos.External.Clients.Thalos.Requests.Tenants
{
public class DeleteTenantRequest
{
public string _Id { get; set; }
}
}

View File

@@ -0,0 +1,6 @@
namespace Core.Thalos.External.Clients.Thalos.Requests.Tenants
{
public class GetAllTenantsRequest
{
}
}

View File

@@ -0,0 +1,7 @@
namespace Core.Thalos.External.Clients.Thalos.Requests.Tenants
{
public class GetTenantRequest
{
public string _Id { get; set; }
}
}

View File

@@ -0,0 +1,39 @@
namespace Core.Thalos.External.Clients.Thalos.Requests.Tenants
{
public class UpdateTenantRequest
{
public string Name { get; set; } = null!;
public string TaxIdentifier { get; set; } = null!;
public string AddressLine1 { get; set; } = null!;
public string? AddressLine2 { get; set; }
public string City { get; set; } = null!;
public string State { get; set; } = null!;
public string Country { get; set; } = null!;
public string PostalCode { get; set; } = null!;
public string ContactEmail { get; set; } = null!;
public string ContactPhone { get; set; } = null!;
public string? Website { get; set; }
public string? ConnectionString { get; set; }
public bool Isolated { get; set; }
public string _Id { get; set; } = null!;
public string Id { get; init; } = null!;
public DateTime CreatedAt { get; set; }
public string? CreatedBy { get; set; }
public DateTime? UpdatedAt { get; set; }
public string? UpdatedBy { get; set; }
public Blueprint.Mongo.StatusEnum Status { get; set; }
}
}

View File

@@ -1,8 +0,0 @@
namespace Core.Thalos.Application.UseCases.Users.Input
{
public class AddCompanyToUserRequest
{
public string UserId { get; set; }
public string CompanyId { get; set; }
}
}

View File

@@ -1,8 +0,0 @@
namespace Core.Thalos.Application.UseCases.Users.Input
{
public class AddProjectToUserRequest
{
public string UserId { get; set; }
public string ProjectId { get; set; }
}
}

View File

@@ -4,7 +4,7 @@ namespace Core.Thalos.Application.UseCases.Users.Input
{
public class ChangeUserStatusRequest
{
public string Id { get; set; }
public string _Id { get; set; }
public StatusEnum Status { get; set; }
}
}

View File

@@ -7,8 +7,6 @@
public string? MiddleName { get; set; }
public string LastName { get; set; } = null!;
public string RoleId { get; set; } = null!;
public string[] Companies { get; set; } = null!;
public string[]? Projects { get; set; }
public bool SendInvitation { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace Core.Thalos.Application.UseCases.Users.Input
{
public class DeleteUserRequest
{
public string _Id { get; set; }
}
}

View File

@@ -2,6 +2,6 @@
{
public class GetUserRequest
{
public string Id { get; set; }
public string _Id { get; set; }
}
}

View File

@@ -1,8 +0,0 @@
namespace Core.Thalos.Application.UseCases.Users.Input
{
public class RemoveCompanyFromUserRequest
{
public string UserId { get; set; }
public string CompanyId { get; set; }
}
}

View File

@@ -1,8 +0,0 @@
namespace Core.Thalos.Application.UseCases.Users.Input
{
public class RemoveProjectFromUserRequest
{
public string UserId { get; set; }
public string ProjectId { get; set; }
}
}

View File

@@ -4,7 +4,7 @@ namespace Core.Thalos.Application.UseCases.Users.Input
{
public class UpdateUserRequest
{
public string Id { get; set; } = null!;
public string _Id { get; set; } = null!;
public string Email { get; set; } = null!;
public string Name { get; set; } = null!;
public string? MiddleName { get; set; }

View File

@@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.0.2" />
<PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.1.8" />
<PackageReference Include="Lib.Architecture.BuildingBlocks" Version="1.0.0" />
<PackageReference Include="Refit" Version="8.0.0" />
</ItemGroup>