Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech debt 5.1 #3808

Merged
merged 20 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/app-react.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
- name: SonarQube Scan
id: scan
uses: sonarsource/sonarqube-scan-action@master
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'bcgov/PSP' }}
if: false
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_URL }}
Expand Down
8 changes: 4 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"request": "launch",
"console": "internalConsole",
"preLaunchTask": "build",
"program": "${workspaceRoot}/tools/keycloak/sync/bin/Debug/net6.0/Pims.Tools.Keycloak.Sync.dll",
"program": "${workspaceRoot}/tools/keycloak/sync/bin/Debug/net8.0/Pims.Tools.Keycloak.Sync.dll",
"cwd": "${workspaceRoot}/tools/keycloak/sync",
"stopAtEntry": false
},
{
"name": ".NET 6 Launch (api)",
"name": ".NET 8 Launch (api)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/source/backend/api/bin/Debug/net6.0/Pims.Api.dll",
"program": "${workspaceRoot}/source/backend/api/bin/Debug/net8.0/Pims.Api.dll",
"args": [],
"cwd": "${workspaceRoot}/source/backend/api",
"stopAtEntry": false,
Expand All @@ -32,7 +32,7 @@
}
},
{
"name": ".NET 6 Attach",
"name": ".NET 8 Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public AcquisitionFileController(IAcquisitionFileService acquisitionService, ICo
[Produces("application/json")]
[ProducesResponseType(typeof(AcquisitionFileModel), 200)]
[SwaggerOperation(Tags = new[] { "acquisitionfile" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetAcquisitionFile(long id)
{
// RECOMMENDED - Add valuable metadata to logs
Expand Down Expand Up @@ -109,6 +110,7 @@ public IActionResult GetLastUpdatedBy(long id)
[Produces("application/json")]
[ProducesResponseType(typeof(AcquisitionFileModel), 200)]
[SwaggerOperation(Tags = new[] { "acquisitionfile" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult AddAcquisitionFile([FromBody] AcquisitionFileModel model, [FromQuery] string[] userOverrideCodes)
{
_logger.LogInformation(
Expand Down Expand Up @@ -136,6 +138,7 @@ public IActionResult AddAcquisitionFile([FromBody] AcquisitionFileModel model, [
[ProducesResponseType(typeof(AcquisitionFileModel), 200)]
[ProducesResponseType(typeof(ErrorResponseModel), 409)]
[SwaggerOperation(Tags = new[] { "acquisitionfile" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult UpdateAcquisitionFile(long id, [FromBody] AcquisitionFileModel model, [FromQuery] string[] userOverrideCodes)
{
_logger.LogInformation(
Expand All @@ -161,6 +164,7 @@ public IActionResult UpdateAcquisitionFile(long id, [FromBody] AcquisitionFileMo
[Produces("application/json")]
[ProducesResponseType(typeof(AcquisitionFileModel), 200)]
[SwaggerOperation(Tags = new[] { "acquisitionfile" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult UpdateAcquisitionFileProperties([FromBody] AcquisitionFileModel acquisitionFileModel, [FromQuery] string[] userOverrideCodes)
{
var acquisitionFileEntity = _mapper.Map<Dal.Entities.PimsAcquisitionFile>(acquisitionFileModel);
Expand All @@ -177,6 +181,7 @@ public IActionResult UpdateAcquisitionFileProperties([FromBody] AcquisitionFileM
[Produces("application/json")]
[ProducesResponseType(typeof(IEnumerable<AcquisitionFilePropertyModel>), 200)]
[SwaggerOperation(Tags = new[] { "acquisitionfile" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetAcquisitionFileProperties(long id)
{
var acquisitionFileProperties = _acquisitionService.GetProperties(id);
Expand All @@ -193,6 +198,7 @@ public IActionResult GetAcquisitionFileProperties(long id)
[Produces("application/json")]
[ProducesResponseType(typeof(IEnumerable<AcquisitionFileOwnerModel>), 200)]
[SwaggerOperation(Tags = new[] { "acquisitionfile" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetAcquisitionFileOwners([FromRoute] long id)
{
var owners = _acquisitionService.GetOwners(id);
Expand All @@ -210,6 +216,7 @@ public IActionResult GetAcquisitionFileOwners([FromRoute] long id)
[Produces("application/json")]
[ProducesResponseType(typeof(IEnumerable<AcquisitionFileTeamModel>), 200)]
[SwaggerOperation(Tags = new[] { "acquisitionfile" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetAcquisitionTeamMembers()
{
var team = _acquisitionService.GetTeamMembers();
Expand Down Expand Up @@ -243,6 +250,7 @@ public IActionResult GetFileCompensations(long id)
[Produces("application/json")]
[ProducesResponseType(typeof(IEnumerable<CompensationFinancialModel>), 200)]
[SwaggerOperation(Tags = new[] { "comp-req-h120s" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetFileCompReqH120(long id, bool? finalOnly)
{
_logger.LogInformation(
Expand All @@ -269,6 +277,7 @@ public IActionResult GetFileCompReqH120(long id, bool? finalOnly)
[Produces("application/json")]
[ProducesResponseType(typeof(CompensationRequisitionModel), 201)]
[SwaggerOperation(Tags = new[] { "compensation-requisition" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult AddCompensationRequisition([FromRoute] long id, [FromBody] CompensationRequisitionModel compensationRequisition)
{
_logger.LogInformation(
Expand Down Expand Up @@ -323,6 +332,7 @@ public IActionResult GetAcquisitionFileExpropriationPayments([FromRoute] long id
[Produces("application/json")]
[ProducesResponseType(typeof(ExpropriationPaymentModel), 201)]
[SwaggerOperation(Tags = new[] { "expropriation-payments" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult AddExpropriationPayment([FromRoute] long id, [FromBody] ExpropriationPaymentModel expropriationPayment)
{
_logger.LogInformation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Pims.Api.Models.Concepts.AcquisitionFile;
using Pims.Api.Policies;
using Pims.Api.Services;
using Pims.Core.Json;
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;

Expand Down Expand Up @@ -67,6 +68,7 @@ public IActionResult GetAcquisitionFileAgreements([FromRoute] long id)
[Produces("application/json")]
[ProducesResponseType(typeof(AgreementModel), 200)]
[SwaggerOperation(Tags = new[] { "acquisitionfile" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult UpdateAcquisitionFileAgreements([FromRoute] long id, [FromBody] List<AgreementModel> agreements)
{
var agreementEntities = _mapper.Map<List<Dal.Entities.PimsAgreement>>(agreements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
using MapsterMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Pims.Api.Helpers.Exceptions;
using Pims.Api.Models.Concepts.AcquisitionFile;
using Pims.Api.Models.Concepts.File;
using Pims.Api.Policies;
using Pims.Api.Services;
using Pims.Core.Json;
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;

Expand Down Expand Up @@ -53,6 +55,7 @@ public ChecklistController(IAcquisitionFileService acquisitionService, IMapper m
[Produces("application/json")]
[ProducesResponseType(typeof(IEnumerable<FileChecklistItemModel>), 200)]
[SwaggerOperation(Tags = new[] { "acquisitionfile" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetAcquisitionFileChecklist([FromRoute] long id)
{
var checklist = _acquisitionService.GetChecklistItems(id);
Expand All @@ -63,15 +66,25 @@ public IActionResult GetAcquisitionFileChecklist([FromRoute] long id)
/// Update the acquisition file checklist.
/// </summary>
/// <returns>The updated checklist items.</returns>
[HttpPut("{id:long}/checklist")]
[HttpPut("{acquisitionFileId:long}/checklist")]
[HasPermission(Permissions.AcquisitionFileEdit)]
[Produces("application/json")]
[ProducesResponseType(typeof(AcquisitionFileModel), 200)]
[SwaggerOperation(Tags = new[] { "acquisitionfile" })]
public IActionResult UpdateAcquisitionFileChecklist([FromBody] AcquisitionFileModel acquisitionFileModel)
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult UpdateAcquisitionFileChecklist(long acquisitionFileId, [FromBody] IList<FileChecklistItemModel> checklistItems)
{
var acquisitionFileEntity = _mapper.Map<Dal.Entities.PimsAcquisitionFile>(acquisitionFileModel);
var acquisitionFile = _acquisitionService.UpdateChecklistItems(acquisitionFileEntity);

foreach (var item in checklistItems)
{
if (item.FileId != acquisitionFileId)
{
throw new BadRequestException("All checklist items file id must match the acquisition file id");
}
}

var checklistItemEntities = _mapper.Map<IList<Dal.Entities.PimsAcquisitionChecklistItem>>(checklistItems);
var acquisitionFile = _acquisitionService.UpdateChecklistItems(checklistItemEntities);
return new JsonResult(_mapper.Map<AcquisitionFileModel>(acquisitionFile));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Pims.Api.Areas.Acquisition.Controllers
using Pims.Api.Policies;
using Pims.Api.Services;
using Pims.Core.Extensions;
using Pims.Core.Json;
using Pims.Dal.Entities.Models;
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;
Expand Down Expand Up @@ -66,6 +67,7 @@ public SearchController(IAcquisitionFileService acquisitionService, IMapper mapp
[ProducesResponseType(typeof(IEnumerable<AcquisitionFileModel>), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "acquisitionfile" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetAcquisitionFiles()
{
var uri = new Uri(this.Request.GetDisplayUrl());
Expand All @@ -83,6 +85,7 @@ public IActionResult GetAcquisitionFiles()
[ProducesResponseType(typeof(IEnumerable<AcquisitionFileModel>), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "acquisitionfile" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetAcquisitionFiles([FromBody] AcquisitionFilterModel filter)
{
// RECOMMENDED - Add valuable metadata to logs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Pims.Api.Models.Base;
using Pims.Api.Models.Concepts.AccessRequest;
using Pims.Api.Policies;
using Pims.Core.Json;
using Pims.Dal.Repositories;
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;
Expand Down Expand Up @@ -57,6 +58,7 @@ public AccessRequestController(IAccessRequestRepository accessRequestRepository,
[ProducesResponseType(typeof(PageModel<AccessRequestModel>), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "admin-access-requests" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetPage(int page = 1, int quantity = 10, string searchText = null, string sort = null)
{
if (page < 1)
Expand Down Expand Up @@ -94,6 +96,7 @@ public IActionResult GetPage(int page = 1, int quantity = 10, string searchText
[ProducesResponseType(typeof(ErrorResponseModel), 400)]
[ProducesResponseType(typeof(ErrorResponseModel), 403)]
[SwaggerOperation(Tags = new[] { "user" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetAccessRequest(long id)
{
var accessRequest = _accessRequestRepository.GetById(id);
Expand All @@ -111,6 +114,7 @@ public IActionResult GetAccessRequest(long id)
[ProducesResponseType(typeof(AccessRequestModel), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "admin-access-requests" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult Delete(long id, [FromBody] AccessRequestModel model)
{
var entity = _mapper.Map<Entity.PimsAccessRequest>(model);
Expand Down
2 changes: 2 additions & 0 deletions source/backend/api/Areas/Admin/Controllers/ClaimController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Pims.Api.Models.Base;
using Pims.Api.Models.Concepts.Claim;
using Pims.Api.Policies;
using Pims.Core.Json;
using Pims.Dal.Repositories;
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;
Expand Down Expand Up @@ -55,6 +56,7 @@ public ClaimController(IClaimRepository claimRepository, IMapper mapper)
[ProducesResponseType(typeof(PageModel<ClaimModel>), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "admin-claim" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetClaims(int page = 1, int quantity = 10, string name = null)
{
if (page < 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Pims.Api.Policies;
using Pims.Api.Services;
using Pims.Core.Exceptions;
using Pims.Core.Json;
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;

Expand Down Expand Up @@ -49,6 +50,7 @@ public FinancialCodeController(IFinancialCodeService financialCodeService)
[ProducesResponseType(typeof(IEnumerable<FinancialCodeModel>), 200)]
[ProducesResponseType(typeof(Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "admin-financialcodes" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetFinancialCodes()
{
var allCodes = _financialCodeService.GetAllFinancialCodes();
Expand All @@ -67,6 +69,7 @@ public IActionResult GetFinancialCodes()
[ProducesResponseType(typeof(Models.ErrorResponseModel), 400)]
[ProducesResponseType(typeof(Models.ErrorResponseModel), 409)]
[SwaggerOperation(Tags = new[] { "admin-financialcodes" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetFinancialCode(FinancialCodeTypes type, long codeId)
{
return new JsonResult(_financialCodeService.GetById(type, codeId));
Expand All @@ -84,6 +87,7 @@ public IActionResult GetFinancialCode(FinancialCodeTypes type, long codeId)
[ProducesResponseType(typeof(Models.ErrorResponseModel), 400)]
[ProducesResponseType(typeof(Models.ErrorResponseModel), 409)]
[SwaggerOperation(Tags = new[] { "admin-financialcodes" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult AddFinancialCode(FinancialCodeTypes type, [FromBody] FinancialCodeModel codeModel)
{
try
Expand All @@ -110,6 +114,7 @@ public IActionResult AddFinancialCode(FinancialCodeTypes type, [FromBody] Financ
[ProducesResponseType(typeof(Models.ErrorResponseModel), 400)]
[ProducesResponseType(typeof(Models.ErrorResponseModel), 409)]
[SwaggerOperation(Tags = new[] { "admin-financialcodes" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult UpdateFinancialCode(FinancialCodeTypes type, long codeId, [FromBody] FinancialCodeModel codeModel)
{
try
Expand Down
3 changes: 3 additions & 0 deletions source/backend/api/Areas/Admin/Controllers/RoleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Pims.Api.Models.Base;
using Pims.Api.Models.Concepts.Role;
using Pims.Api.Policies;
using Pims.Core.Json;
using Pims.Dal.Repositories;
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;
Expand Down Expand Up @@ -55,6 +56,7 @@ public RoleController(IRoleRepository roleRepository, IMapper mapper)
[ProducesResponseType(typeof(PageModel<RoleModel>), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "admin-role" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetRoles(int page = 1, int quantity = 10, string name = null)
{
if (page < 1)
Expand Down Expand Up @@ -87,6 +89,7 @@ public IActionResult GetRoles(int page = 1, int quantity = 10, string name = nul
[ProducesResponseType(typeof(RoleModel), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "admin-role" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetRole(Guid key)
{
var entity = _roleRepository.GetByKey(key);
Expand Down
Loading
Loading