Skip to content

Commit

Permalink
adding missing role controller.
Browse files Browse the repository at this point in the history
  • Loading branch information
devinleighsmith committed Oct 31, 2023
1 parent 9bca62c commit 31a95e6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions source/backend/api/Areas/Admin/Controllers/RoleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ public IActionResult GetRoles(int page = 1, int quantity = 10, string name = nul
var result = _mapper.Map<Api.Models.PageModel<Model.RoleModel>>(paged);
return new JsonResult(result);
}

/// <summary>
/// GET - Returns a role for the specified 'key' from the datasource.
/// </summary>
/// <param name="key">The unique 'key' for the role to return.</param>
/// <returns>The role requested.</returns>
[HttpGet("{key}")]
[Produces("application/json")]
[ProducesResponseType(typeof(Model.RoleModel), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "admin-role" })]
public IActionResult GetRole(Guid key)
{
var entity = _roleRepository.GetByKey(key);
var role = _mapper.Map<Model.RoleModel>(entity);
return new JsonResult(role);
}
#endregion
}
}

0 comments on commit 31a95e6

Please sign in to comment.