diff options
| author | transtrike <transtrike@gmail.com> | 2021-03-15 09:27:12 +0200 |
|---|---|---|
| committer | transtrike <transtrike@gmail.com> | 2021-03-15 09:27:12 +0200 |
| commit | 0161be09312fde634865f110504884119a617d5c (patch) | |
| tree | 0fa68366edcb024c054f370ecf90f5b66282aae5 /src/Web/DevHive.Web/Controllers/RoleController.cs | |
| parent | e3b5757b5a5db2f7874b0924cdd4a22b1a9e1ee2 (diff) | |
| parent | ac82c773a5ec43c6a59d3d0b7665b67ac9e6bdde (diff) | |
| download | DevHive-0161be09312fde634865f110504884119a617d5c.tar DevHive-0161be09312fde634865f110504884119a617d5c.tar.gz DevHive-0161be09312fde634865f110504884119a617d5c.zip | |
Fixed to new() where possible and readable
Diffstat (limited to 'src/Web/DevHive.Web/Controllers/RoleController.cs')
| -rw-r--r-- | src/Web/DevHive.Web/Controllers/RoleController.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Web/DevHive.Web/Controllers/RoleController.cs b/src/Web/DevHive.Web/Controllers/RoleController.cs index 1465795..ebb305e 100644 --- a/src/Web/DevHive.Web/Controllers/RoleController.cs +++ b/src/Web/DevHive.Web/Controllers/RoleController.cs @@ -9,6 +9,9 @@ using Microsoft.AspNetCore.Authorization; namespace DevHive.Web.Controllers { + /// <summary> + /// All endpoints for interacting with the roles layer + /// </summary> [ApiController] [Route("/api/[controller]")] public class RoleController @@ -22,6 +25,11 @@ namespace DevHive.Web.Controllers this._roleMapper = mapper; } + /// <summary> + /// Create a new role for the roles hierarchy. Admin only! + /// </summary> + /// <param name="createRoleWebModel">The new role's parametars</param> + /// <returns>The new role's Id</returns> [HttpPost] [Authorize(Roles = "Admin")] public async Task<IActionResult> Create([FromBody] CreateRoleWebModel createRoleWebModel) @@ -36,6 +44,11 @@ namespace DevHive.Web.Controllers new OkObjectResult(new { Id = id }); } + /// <summary> + /// Get a role's full data, querying it by it's Id + /// </summary> + /// <param name="id">The role's Id</param> + /// <returns>Full info of the role</returns> [HttpGet] [Authorize(Roles = "User,Admin")] public async Task<IActionResult> GetById(Guid id) @@ -46,6 +59,12 @@ namespace DevHive.Web.Controllers return new OkObjectResult(roleWebModel); } + /// <summary> + /// Update a role's parametars. Admin only! + /// </summary> + /// <param name="id">The role's Id</param> + /// <param name="updateRoleWebModel">The new parametrats for that role</param> + /// <returns>Ok result</returns> [HttpPut] [Authorize(Roles = "Admin")] public async Task<IActionResult> Update(Guid id, [FromBody] UpdateRoleWebModel updateRoleWebModel) @@ -62,6 +81,11 @@ namespace DevHive.Web.Controllers return new OkResult(); } + /// <summary> + /// Delete a role. Admin only! + /// </summary> + /// <param name="id">The role's Id</param> + /// <returns>Ok result</returns> [HttpDelete] [Authorize(Roles = "Admin")] public async Task<IActionResult> Delete(Guid id) |
