Compare commits
3 Commits
827e5ec270
...
bugfix/adj
| Author | SHA1 | Date | |
|---|---|---|---|
| 35a0a01221 | |||
| 24a5fd28fb | |||
| fc8d385a13 |
@@ -66,7 +66,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
var result = await service.GetModuleById(_id, cancellationToken);
|
var result = await service.GetModuleById(_id, cancellationToken);
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
return NotFound("Entity not found");
|
return NotFound("Module not found");
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
@@ -112,6 +112,10 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
public async Task<IActionResult> ChangeModuleStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
public async Task<IActionResult> ChangeModuleStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = await service.ChangeModuleStatus(_id, newStatus, cancellationToken);
|
var result = await service.ChangeModuleStatus(_id, newStatus, cancellationToken);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
return NotFound("Module not found");
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +137,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
{
|
{
|
||||||
var result = await service.DeleteModule(_id, cancellationToken);
|
var result = await service.DeleteModule(_id, cancellationToken);
|
||||||
if (result == null)
|
if (result == null)
|
||||||
return NotFound("Entity not found");
|
return NotFound("Module not found");
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ using Core.Thalos.BuildingBlocks;
|
|||||||
using Core.Thalos.Provider.Contracts;
|
using Core.Thalos.Provider.Contracts;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Graph;
|
|
||||||
using PermissionRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.PermissionRequest;
|
using PermissionRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.PermissionRequest;
|
||||||
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
|
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
|
||||||
|
|
||||||
@@ -91,7 +90,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
return NotFound("Entity not found");
|
return NotFound("Permission not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
@@ -162,6 +161,10 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
public async Task<IActionResult> ChangePermissionStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
public async Task<IActionResult> ChangePermissionStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = await service.ChangePermissionStatus(_id, newStatus, cancellationToken).ConfigureAwait(false);
|
var result = await service.ChangePermissionStatus(_id, newStatus, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
return NotFound("Permission not found");
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
return NotFound("Entity not found");
|
return NotFound("Role not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
@@ -126,6 +126,10 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
public async Task<IActionResult> ChangeRoleStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
public async Task<IActionResult> ChangeRoleStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = await service.ChangeRoleStatus(_id, newStatus, cancellationToken).ConfigureAwait(false);
|
var result = await service.ChangeRoleStatus(_id, newStatus, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
return NotFound("Role not found");
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
using Asp.Versioning;
|
using Asp.Versioning;
|
||||||
using Core.Thalos.BuildingBlocks;
|
using Core.Thalos.BuildingBlocks;
|
||||||
using Core.Thalos.Provider.Contracts;
|
using Core.Thalos.Provider.Contracts;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
|
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
|
||||||
using TenantRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.TenantRequest;
|
using TenantRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.TenantRequest;
|
||||||
@@ -21,7 +22,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
[Produces(MimeTypes.ApplicationJson)]
|
[Produces(MimeTypes.ApplicationJson)]
|
||||||
[Consumes(MimeTypes.ApplicationJson)]
|
[Consumes(MimeTypes.ApplicationJson)]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
// [Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||||
public class TenantController(ITenantProvider service) : ControllerBase
|
public class TenantController(ITenantProvider service) : ControllerBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -35,7 +36,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
[Consumes(MimeTypes.ApplicationJson)]
|
[Consumes(MimeTypes.ApplicationJson)]
|
||||||
[Produces(MimeTypes.ApplicationJson)]
|
[Produces(MimeTypes.ApplicationJson)]
|
||||||
[ProducesResponseType(typeof(IEnumerable<TenantAdapter>), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(IEnumerable<TenantAdapter>), StatusCodes.Status200OK)]
|
||||||
// [Permission("TenantManagement.Read, RoleManagement.Read")]
|
[Permission("TenantManagement.Read, RoleManagement.Read")]
|
||||||
public async Task<IActionResult> GetAllTenantsAsync(CancellationToken cancellationToken)
|
public async Task<IActionResult> GetAllTenantsAsync(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = await service.GetAllTenants(cancellationToken).ConfigureAwait(false);
|
var result = await service.GetAllTenants(cancellationToken).ConfigureAwait(false);
|
||||||
@@ -56,14 +57,14 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
[Consumes(MimeTypes.ApplicationJson)]
|
[Consumes(MimeTypes.ApplicationJson)]
|
||||||
[Produces(MimeTypes.ApplicationJson)]
|
[Produces(MimeTypes.ApplicationJson)]
|
||||||
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status200OK)]
|
||||||
// [Permission("TenantManagement.Read")]
|
[Permission("TenantManagement.Read")]
|
||||||
public async Task<IActionResult> GetTenantByIdAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
public async Task<IActionResult> GetTenantByIdAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = await service.GetTenantById(_id, cancellationToken).ConfigureAwait(false);
|
var result = await service.GetTenantById(_id, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
return NotFound("Entity not found");
|
return NotFound("Tenant not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
@@ -80,7 +81,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
/// <response code="500">The service internal error.</response>
|
/// <response code="500">The service internal error.</response>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status201Created)]
|
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status201Created)]
|
||||||
// [Permission("TenantManagement.Write")]
|
[Permission("TenantManagement.Write")]
|
||||||
public async Task<IActionResult> CreateTenantAsync([FromBody] TenantRequest newTenant, CancellationToken cancellationToken)
|
public async Task<IActionResult> CreateTenantAsync([FromBody] TenantRequest newTenant, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = await service.CreateTenant(newTenant, cancellationToken).ConfigureAwait(false);
|
var result = await service.CreateTenant(newTenant, cancellationToken).ConfigureAwait(false);
|
||||||
@@ -103,7 +104,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
[Consumes(MimeTypes.ApplicationJson)]
|
[Consumes(MimeTypes.ApplicationJson)]
|
||||||
[Produces(MimeTypes.ApplicationJson)]
|
[Produces(MimeTypes.ApplicationJson)]
|
||||||
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status200OK)]
|
||||||
// [Permission("TenantManagement.Write")]
|
[Permission("TenantManagement.Write")]
|
||||||
public async Task<IActionResult> UpdateTenantAsync([FromRoute] string _id, [FromBody] TenantAdapter entity, CancellationToken cancellationToken)
|
public async Task<IActionResult> UpdateTenantAsync([FromRoute] string _id, [FromBody] TenantAdapter entity, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (_id != entity._Id)
|
if (_id != entity._Id)
|
||||||
@@ -112,7 +113,9 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
var result = await service.UpdateTenant(entity, cancellationToken).ConfigureAwait(false);
|
var result = await service.UpdateTenant(entity, cancellationToken).ConfigureAwait(false);
|
||||||
return Ok(result);
|
|
||||||
|
if (result is not null) return Ok(result);
|
||||||
|
else return NotFound("Tenant not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -129,10 +132,14 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
[Consumes(MimeTypes.ApplicationJson)]
|
[Consumes(MimeTypes.ApplicationJson)]
|
||||||
[Produces(MimeTypes.ApplicationJson)]
|
[Produces(MimeTypes.ApplicationJson)]
|
||||||
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status200OK)]
|
||||||
// [Permission("TenantManagement.Write")]
|
[Permission("TenantManagement.Write")]
|
||||||
public async Task<IActionResult> ChangeTenantStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
public async Task<IActionResult> ChangeTenantStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = await service.ChangeTenantStatus(_id, newStatus, cancellationToken).ConfigureAwait(false);
|
var result = await service.ChangeTenantStatus(_id, newStatus, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
return NotFound("Tenant not found");
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +155,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
[HttpDelete]
|
[HttpDelete]
|
||||||
[Route(Routes.Id)]
|
[Route(Routes.Id)]
|
||||||
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status200OK)]
|
||||||
// [Permission("TenantManagement.Write")]
|
[Permission("TenantManagement.Write")]
|
||||||
public async Task<IActionResult> DeleteTenantAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
public async Task<IActionResult> DeleteTenantAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = await service.DeleteTenant(_id, cancellationToken).ConfigureAwait(false);
|
var result = await service.DeleteTenant(_id, cancellationToken).ConfigureAwait(false);
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ using Core.Thalos.BuildingBlocks;
|
|||||||
using Core.Thalos.Provider.Contracts;
|
using Core.Thalos.Provider.Contracts;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Graph;
|
|
||||||
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
|
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
|
||||||
using UserRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.UserRequest;
|
using UserRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.UserRequest;
|
||||||
|
|
||||||
@@ -26,7 +25,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
public class UserController(IUserProvider service) : ControllerBase
|
public class UserController(IUserProvider service) : ControllerBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// mongo identifier all the users.
|
/// Gets all users.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
||||||
/// <returns>The <see cref="IEnumerable{UserAdapter}"/> found entity.</returns>
|
/// <returns>The <see cref="IEnumerable{UserAdapter}"/> found entity.</returns>
|
||||||
@@ -41,7 +40,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// mongo identifier the user by identifier.
|
/// Gets the user by mongo identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="_id">The user Mongo identifier.</param>
|
/// <param name="_id">The user Mongo identifier.</param>
|
||||||
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
||||||
@@ -54,11 +53,11 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
public async Task<IActionResult> GetUserById([FromRoute] string _id, CancellationToken cancellationToken)
|
public async Task<IActionResult> GetUserById([FromRoute] string _id, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = await service.GetUserById(_id, cancellationToken).ConfigureAwait(false);
|
var result = await service.GetUserById(_id, cancellationToken).ConfigureAwait(false);
|
||||||
return result == null ? NotFound("Entity not found") : Ok(result);
|
return result == null ? NotFound("User not found") : Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// mongo identifier the user by email.
|
/// Gets the user by email.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="email">The user's email.</param>
|
/// <param name="email">The user's email.</param>
|
||||||
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
||||||
@@ -106,7 +105,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates a full user by identifier.
|
/// Updates a full user by mongo identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="_id">The user Mongo identifier.</param>
|
/// <param name="_id">The user Mongo identifier.</param>
|
||||||
/// <param name="entity">The user to update.</param>
|
/// <param name="entity">The user to update.</param>
|
||||||
@@ -171,11 +170,15 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
public async Task<IActionResult> ChangeUserStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
public async Task<IActionResult> ChangeUserStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var result = await service.ChangeUserStatus(_id, newStatus, cancellationToken).ConfigureAwait(false);
|
var result = await service.ChangeUserStatus(_id, newStatus, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
return NotFound("User not found");
|
||||||
|
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// mongo identifier a token for the user, including roles, permissions, and modules.
|
/// Gets a token for the user, including roles, permissions, and modules.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="email">The user's email.</param>
|
/// <param name="email">The user's email.</param>
|
||||||
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
||||||
@@ -191,7 +194,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes a user by identifier.
|
/// Deletes a user by mongo identifier.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="_id">The user Mongo identifier.</param>
|
/// <param name="_id">The user Mongo identifier.</param>
|
||||||
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
/// <param name="cancellationToken">A token to cancel the asynchronous operation.</param>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Core.Blueprint.KeyVault" Version="1.0.3" />
|
<PackageReference Include="Core.Blueprint.KeyVault" Version="1.0.3" />
|
||||||
<PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.1.1" />
|
<PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.1.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace Core.Thalos.Provider.Contracts
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{ModuleAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{ModuleAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
ValueTask<ModuleAdapter> ChangeModuleStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
|
ValueTask<ModuleAdapter?> ChangeModuleStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates a Module by its identifier.
|
/// Updates a Module by its identifier.
|
||||||
@@ -72,7 +72,7 @@ namespace Core.Thalos.Provider.Contracts
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{ModuleAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{ModuleAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
ValueTask<ModuleAdapter> UpdateModule(ModuleAdapter entity, CancellationToken cancellationToken);
|
ValueTask<ModuleAdapter?> UpdateModule(ModuleAdapter entity, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes a Module by its identifier.
|
/// Deletes a Module by its identifier.
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace Core.Thalos.Provider.Contracts
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{PermissionAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{PermissionAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
ValueTask<PermissionAdapter> ChangePermissionStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
|
ValueTask<PermissionAdapter?> ChangePermissionStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates a Permission.
|
/// Updates a Permission.
|
||||||
@@ -72,7 +72,7 @@ namespace Core.Thalos.Provider.Contracts
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{PermissionAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{PermissionAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
ValueTask<PermissionAdapter> UpdatePermission(PermissionAdapter entity, CancellationToken cancellationToken);
|
ValueTask<PermissionAdapter?> UpdatePermission(PermissionAdapter entity, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes a Permission by its identifier.
|
/// Deletes a Permission by its identifier.
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Core.Thalos.Provider.Contracts
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
ValueTask<RoleAdapter> ChangeRoleStatus(string _id, Core.Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
|
ValueTask<RoleAdapter?> ChangeRoleStatus(string _id, Core.Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates a Role.
|
/// Updates a Role.
|
||||||
@@ -62,7 +62,7 @@ namespace Core.Thalos.Provider.Contracts
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
ValueTask<RoleAdapter> UpdateRole(RoleAdapter entity, CancellationToken cancellationToken);
|
ValueTask<RoleAdapter?> UpdateRole(RoleAdapter entity, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds an application to the Role's list of applications.
|
/// Adds an application to the Role's list of applications.
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Core.Thalos.Provider.Contracts
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{TenantAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{TenantAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
ValueTask<TenantAdapter> ChangeTenantStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
|
ValueTask<TenantAdapter?> ChangeTenantStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates a Tenant.
|
/// Updates a Tenant.
|
||||||
@@ -62,7 +62,7 @@ namespace Core.Thalos.Provider.Contracts
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{TenantAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{TenantAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
ValueTask<TenantAdapter> UpdateTenant(TenantAdapter entity, CancellationToken cancellationToken);
|
ValueTask<TenantAdapter?> UpdateTenant(TenantAdapter entity, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes a Tenant by its identifier.
|
/// Deletes a Tenant by its identifier.
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ namespace Core.Thalos.Provider.Contracts
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{UserAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{UserAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
ValueTask<UserAdapter> ChangeUserStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
|
ValueTask<UserAdapter?> ChangeUserStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates a User.
|
/// Updates a User.
|
||||||
@@ -82,7 +82,7 @@ namespace Core.Thalos.Provider.Contracts
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{UserAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{UserAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
ValueTask<UserAdapter> UpdateUser(UserAdapter entity, CancellationToken cancellationToken);
|
ValueTask<UserAdapter?> UpdateUser(UserAdapter entity, CancellationToken cancellationToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logs in the User.
|
/// Logs in the User.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Core.Blueprint.Mongo" Version="1.0.0" />
|
<PackageReference Include="Core.Blueprint.Mongo" Version="1.0.1" />
|
||||||
<PackageReference Include="Core.Blueprint.Redis" Version="1.0.2" />
|
<PackageReference Include="Core.Blueprint.Redis" Version="1.0.2" />
|
||||||
<PackageReference Include="Mapster" Version="7.4.2-pre02" />
|
<PackageReference Include="Mapster" Version="7.4.2-pre02" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -131,12 +131,17 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{ModuleAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{ModuleAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async ValueTask<ModuleAdapter> ChangeModuleStatus(string _id, StatusEnum newStatus, CancellationToken cancellationToken)
|
public async ValueTask<ModuleAdapter?> ChangeModuleStatus(string _id, StatusEnum newStatus, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var entity = await repository.FindByIdAsync(_id);
|
var entity = await repository.FindByIdAsync(_id);
|
||||||
entity.Status = newStatus;
|
|
||||||
await repository.ReplaceOneAsync(entity);
|
if (entity is not null)
|
||||||
return entity;
|
{
|
||||||
|
entity.Status = newStatus;
|
||||||
|
|
||||||
|
return repository.ReplaceOneAsync(entity).Result;
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -147,10 +152,10 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{ModuleAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{ModuleAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async ValueTask<ModuleAdapter> UpdateModule(ModuleAdapter entity, CancellationToken cancellationToken)
|
public async ValueTask<ModuleAdapter?> UpdateModule(ModuleAdapter entity, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await repository.ReplaceOneAsync(entity);
|
var updatedEntity = await repository.ReplaceOneAsync(entity);
|
||||||
return entity;
|
return updatedEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -130,12 +130,17 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{PermissionAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{PermissionAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async ValueTask<PermissionAdapter> ChangePermissionStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken)
|
public async ValueTask<PermissionAdapter?> ChangePermissionStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var entity = await repository.FindByIdAsync(_id);
|
var entity = await repository.FindByIdAsync(_id);
|
||||||
entity.Status = newStatus;
|
|
||||||
await repository.ReplaceOneAsync(entity);
|
if (entity is not null)
|
||||||
return entity;
|
{
|
||||||
|
entity.Status = newStatus;
|
||||||
|
|
||||||
|
return repository.ReplaceOneAsync(entity).Result;
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -146,10 +151,10 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{PermissionAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{PermissionAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async ValueTask<PermissionAdapter> UpdatePermission(PermissionAdapter entity, CancellationToken cancellationToken)
|
public async ValueTask<PermissionAdapter?> UpdatePermission(PermissionAdapter entity, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await repository.ReplaceOneAsync(entity);
|
var updatedEntity = await repository.ReplaceOneAsync(entity);
|
||||||
return entity;
|
return updatedEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -100,13 +100,17 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async ValueTask<RoleAdapter> ChangeRoleStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken)
|
public async ValueTask<RoleAdapter?> ChangeRoleStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var entity = await repository.FindByIdAsync(_id);
|
var entity = await repository.FindByIdAsync(_id);
|
||||||
entity.Status = newStatus;
|
|
||||||
|
|
||||||
await repository.ReplaceOneAsync(entity);
|
if (entity is not null)
|
||||||
return entity;
|
{
|
||||||
|
entity.Status = newStatus;
|
||||||
|
|
||||||
|
return repository.ReplaceOneAsync(entity).Result;
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -117,10 +121,10 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async ValueTask<RoleAdapter> UpdateRole(RoleAdapter entity, CancellationToken cancellationToken)
|
public async ValueTask<RoleAdapter?> UpdateRole(RoleAdapter entity, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await repository.ReplaceOneAsync(entity);
|
var updatedEntity = await repository.ReplaceOneAsync(entity);
|
||||||
return entity;
|
return updatedEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -99,13 +99,17 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{TenantAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{TenantAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async ValueTask<TenantAdapter> ChangeTenantStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken)
|
public async ValueTask<TenantAdapter?> ChangeTenantStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var entity = await repository.FindByIdAsync(_id);
|
var entity = await repository.FindByIdAsync(_id);
|
||||||
entity.Status = newStatus;
|
|
||||||
|
|
||||||
await repository.ReplaceOneAsync(entity);
|
if (entity is not null)
|
||||||
return entity;
|
{
|
||||||
|
entity.Status = newStatus;
|
||||||
|
|
||||||
|
return repository.ReplaceOneAsync(entity).Result;
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -116,10 +120,10 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// A <see cref="ValueTask{TenantAdapter}"/> representing the asynchronous execution of the service.
|
/// A <see cref="ValueTask{TenantAdapter}"/> representing the asynchronous execution of the service.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public async ValueTask<TenantAdapter> UpdateTenant(TenantAdapter entity, CancellationToken cancellationToken)
|
public async ValueTask<TenantAdapter?> UpdateTenant(TenantAdapter entity, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await repository.ReplaceOneAsync(entity);
|
var updatedEntity = await repository.ReplaceOneAsync(entity);
|
||||||
return entity;
|
return updatedEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -146,14 +146,17 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
|||||||
/// <param name="newStatus">The new status of the user.</param>
|
/// <param name="newStatus">The new status of the user.</param>
|
||||||
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
|
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
|
||||||
/// the asynchronous execution of the service.</returns>
|
/// the asynchronous execution of the service.</returns>
|
||||||
public async ValueTask<UserAdapter> ChangeUserStatus(string _id, Core.Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken)
|
public async ValueTask<UserAdapter?> ChangeUserStatus(string _id, Core.Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var entity = await repository.FindByIdAsync(_id);
|
var entity = await repository.FindByIdAsync(_id);
|
||||||
entity.Status = newStatus;
|
|
||||||
|
|
||||||
await repository.ReplaceOneAsync(entity);
|
if (entity is not null)
|
||||||
|
{
|
||||||
|
entity.Status = newStatus;
|
||||||
|
|
||||||
return entity;
|
return repository.ReplaceOneAsync(entity).Result;
|
||||||
|
}
|
||||||
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -163,11 +166,10 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
|||||||
/// <param name="_id">The User mongo identifier.</param>
|
/// <param name="_id">The User mongo identifier.</param>
|
||||||
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
|
/// <returns>A <see cref="{Task{UserAdapter}}"/> representing
|
||||||
/// the asynchronous execution of the service.</returns>
|
/// the asynchronous execution of the service.</returns>
|
||||||
public async ValueTask<UserAdapter> UpdateUser(UserAdapter entity, CancellationToken cancellationToken)
|
public async ValueTask<UserAdapter?> UpdateUser(UserAdapter entity, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await repository.ReplaceOneAsync(entity);
|
var updatedEntity = await repository.ReplaceOneAsync(entity);
|
||||||
|
return updatedEntity;
|
||||||
return entity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user