Skip to content

Commit

Permalink
Merge pull request #1633 from bcgov/test
Browse files Browse the repository at this point in the history
Test -> Master - IS29 UAT Release
  • Loading branch information
asanchezr authored Jun 22, 2022
2 parents 19260dd + 816d01e commit 999d938
Show file tree
Hide file tree
Showing 532 changed files with 89,168 additions and 9,691 deletions.
35 changes: 26 additions & 9 deletions backend/api/Areas/Admin/Controllers/AccessRequestController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
using Swashbuckle.AspNetCore.Annotations;
using EModel = Pims.Dal.Entities.Models;
using Entity = Pims.Dal.Entities;
using Model = Pims.Api.Areas.Admin.Models.AccessRequest;
using PModel = Pims.Api.Models;
using Pims.Api.Models;
using Pims.Api.Models.Concepts;

namespace Pims.Api.Areas.Admin.Controllers
{
Expand Down Expand Up @@ -55,10 +55,10 @@ public AccessRequestController(IPimsRepository pimsService, IMapper mapper)
/// <returns></returns>
[HttpGet]
[Produces("application/json")]
[ProducesResponseType(typeof(PModel.PageModel<Model.AccessRequestModel>), 200)]
[ProducesResponseType(typeof(PageModel<AccessRequestModel>), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "admin-access-requests" })]
public IActionResult GetPage(int page = 1, int quantity = 10, string searchText = null, string role = null, string organization = null, string status = null, string sort = null)
public IActionResult GetPage(int page = 1, int quantity = 10, string searchText = null, string sort = null)
{
if (page < 1)
{
Expand All @@ -75,25 +75,42 @@ public IActionResult GetPage(int page = 1, int quantity = 10, string searchText
quantity = 20;
}

var filter = new EModel.AccessRequestFilter(page, quantity, searchText, role, organization, status, new[] { sort });
var filter = new EModel.AccessRequestFilter(page, quantity, searchText, new[] { sort });
filter.StatusType = new Entity.PimsAccessRequestStatusType() { Id = "Received" };

var result = _pimsService.AccessRequest.Get(filter);
var models = _mapper.Map<Model.AccessRequestModel[]>(result.Items);
var paged = new PModel.PageModel<Model.AccessRequestModel>(models, page, quantity, result.Total);
var models = _mapper.Map<AccessRequestModel[]>(result.Items);
var paged = new PageModel<AccessRequestModel>(models, page, quantity, result.Total);
return new JsonResult(paged);
}

/// <summary>
/// Get the most recent access request for the current user.
/// </summary>
/// <returns></returns>
[HttpGet("{id}")]
[Produces("application/json")]
[ProducesResponseType(typeof(AccessRequestModel), 200)]
[ProducesResponseType(typeof(ErrorResponseModel), 400)]
[ProducesResponseType(typeof(ErrorResponseModel), 403)]
[SwaggerOperation(Tags = new[] { "user" })]
public IActionResult GetAccessRequest(long id)
{
var accessRequest = _pimsService.AccessRequest.Get(id);
return new JsonResult(_mapper.Map<AccessRequestModel>(accessRequest));
}

/// <summary>
/// Delete an access requests
/// </summary>
/// <param name="id"></param>
/// <param name="model"></param>
[HttpDelete("{id}")]
[Produces("application/json")]
[ProducesResponseType(typeof(Model.AccessRequestModel), 200)]
[ProducesResponseType(typeof(AccessRequestModel), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "admin-access-requests" })]
public IActionResult Delete(long id, [FromBody] Model.AccessRequestModel model)
public IActionResult Delete(long id, [FromBody] AccessRequestModel model)
{
var entity = _mapper.Map<Entity.PimsAccessRequest>(model);
_pimsService.AccessRequest.Delete(entity);
Expand Down
2 changes: 1 addition & 1 deletion backend/api/Areas/Admin/Controllers/ClaimController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Swashbuckle.AspNetCore.Annotations;
using System;
using Entity = Pims.Dal.Entities;
using Model = Pims.Api.Areas.Admin.Models.Claim;
using Model = Pims.Api.Models.Concepts;

namespace Pims.Api.Areas.Admin.Controllers
{
Expand Down
176 changes: 0 additions & 176 deletions backend/api/Areas/Admin/Controllers/OrganizationController.cs

This file was deleted.

2 changes: 1 addition & 1 deletion backend/api/Areas/Admin/Controllers/RoleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;
using Entity = Pims.Dal.Entities;
using Model = Pims.Api.Areas.Admin.Models.Role;
using Model = Pims.Api.Models.Concepts;

namespace Pims.Api.Areas.Admin.Controllers
{
Expand Down
19 changes: 2 additions & 17 deletions backend/api/Areas/Admin/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System;
using EModel = Pims.Dal.Entities.Models;
using Entity = Pims.Dal.Entities;
using Model = Pims.Api.Areas.Admin.Models.User;
using Model = Pims.Api.Models.Concepts;

namespace Pims.Api.Areas.Admin.Controllers
{
Expand Down Expand Up @@ -75,21 +75,6 @@ public IActionResult GetUsers(EModel.UserFilter filter)
return new JsonResult(result);
}

/// <summary>
/// GET - Returns a paged array of users from the datasource that belong to the same organization (or sub-organization) as the current user.
/// </summary>
/// <param name="filter"></param>
/// <returns>Paged object with an array of users.</returns>
[HttpPost("my/organization")]
[Produces("application/json")]
[ProducesResponseType(typeof(Api.Models.PageModel<Model.UserModel>), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "admin-user" })]
public IActionResult GetMyUsers(EModel.UserFilter filter)
{
return GetUsers(filter);
}

/// <summary>
/// GET - Returns a user for the specified 'id' from the datasource.
/// </summary>
Expand Down Expand Up @@ -141,7 +126,7 @@ public IActionResult AddUser([FromBody] Model.UserModel model)

var user = _mapper.Map<Model.UserModel>(entity);

return CreatedAtAction(nameof(GetUser), new { key = user.KeycloakUserId }, user);
return CreatedAtAction(nameof(GetUser), new { key = user.GuidIdentifierValue }, user);
}

/// <summary>
Expand Down
28 changes: 0 additions & 28 deletions backend/api/Areas/Admin/Mapping/AccessRequest/AccessRequestMap.cs

This file was deleted.

21 changes: 0 additions & 21 deletions backend/api/Areas/Admin/Mapping/AccessRequest/OrganizationMap.cs

This file was deleted.

21 changes: 0 additions & 21 deletions backend/api/Areas/Admin/Mapping/AccessRequest/RoleMap.cs

This file was deleted.

Loading

0 comments on commit 999d938

Please sign in to comment.