From 956fe2070153b5893a644c62a36209d243f26338 Mon Sep 17 00:00:00 2001 From: Peggy Date: Mon, 6 Jan 2025 14:18:22 -0800 Subject: [PATCH 1/4] add another save changes to ensure the app got updated. (#2059) # Description This PR includes the following proposed change(s): -to update object and save changes. it is very strange that it is not saved before. --- .../BizLicApplication/BizLicApplicationRepository.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Spd.Resource.Repository/BizLicApplication/BizLicApplicationRepository.cs b/src/Spd.Resource.Repository/BizLicApplication/BizLicApplicationRepository.cs index 37c81c840..1b511fd43 100644 --- a/src/Spd.Resource.Repository/BizLicApplication/BizLicApplicationRepository.cs +++ b/src/Spd.Resource.Repository/BizLicApplication/BizLicApplicationRepository.cs @@ -388,6 +388,7 @@ private async Task SetInfoFromBiz(account biz, spd_application app, bool applica _context.SetLink(app, nameof(spd_application.spd_ApplicantId_account), biz); _context.SetLink(app, nameof(spd_application.spd_OrganizationId), biz); + await _context.SaveChangesAsync(ct); } private async Task SetOwner(spd_application app, Guid ownerId, CancellationToken ct) From d01b3dcd2e4866096a554dd1bcb13424650d726b Mon Sep 17 00:00:00 2001 From: Peggy Date: Mon, 6 Jan 2025 15:08:17 -0800 Subject: [PATCH 2/4] fix reading pi (#2060) # Description This PR includes the following proposed change(s): - fix reading pi for biz licence --- .../BizLicApplication/BizLicApplicationRepository.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Spd.Resource.Repository/BizLicApplication/BizLicApplicationRepository.cs b/src/Spd.Resource.Repository/BizLicApplication/BizLicApplicationRepository.cs index 1b511fd43..970c73348 100644 --- a/src/Spd.Resource.Repository/BizLicApplication/BizLicApplicationRepository.cs +++ b/src/Spd.Resource.Repository/BizLicApplication/BizLicApplicationRepository.cs @@ -187,6 +187,7 @@ public async Task GetBizLicApplicationAsync(Guid licenceA .Expand(b => b.spd_ContactId) .Where(b => b.spd_position_spd_businesscontact.Any(p => p.spd_positionid == position.spd_positionid)) .Where(b => b.spd_businesscontact_spd_application.Any(b => b.spd_applicationid == app.spd_applicationid)) + .Where(b => b.statecode != DynamicsConstants.StateCode_Inactive) .FirstOrDefault(); PrivateInvestigatorSwlContactInfo privateInvestigatorInfo = new() From 1738a99048f1eb202589313da23201e8fcd006eb Mon Sep 17 00:00:00 2001 From: Peggy Date: Mon, 6 Jan 2025 16:11:00 -0800 Subject: [PATCH 3/4] [SPDBT-3304] complete ZAP scan (#2061) # Description This PR includes the following proposed change(s): - [SPDBT-3304] complete ZAP scan --- .github/workflows/zap-scans.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/zap-scans.yml b/.github/workflows/zap-scans.yml index 2975b2981..4e77cd1d3 100644 --- a/.github/workflows/zap-scans.yml +++ b/.github/workflows/zap-scans.yml @@ -47,6 +47,6 @@ jobs: uses: zaproxy/action-api-scan@v0.9.0 with: token: ${{ secrets.GITHUB_TOKEN }} - target: "https://justice.gov.bc.ca/train-security/swagger/v1/swagger.json" + target: "https://justice.gov.bc.ca/licensing/swagger/v1/swagger.json" artifact_name: "licensing_portal_api_zap_scan" issue_title: "licensing_portal_api_zap_scan" From b8816c3a5714df9538b0bab0d31f27a0ec5fd4b2 Mon Sep 17 00:00:00 2001 From: Peggy Date: Mon, 6 Jan 2025 19:06:11 -0800 Subject: [PATCH 4/4] [SPDBT-3470] Applicant SWL Number not set (#2062) # Description This PR includes the following proposed change(s): - [SPDBT-3470] Applicant SWL Number not set --- .../BizLicApplicationRepository.cs | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Spd.Resource.Repository/BizLicApplication/BizLicApplicationRepository.cs b/src/Spd.Resource.Repository/BizLicApplication/BizLicApplicationRepository.cs index 970c73348..1dbb6039a 100644 --- a/src/Spd.Resource.Repository/BizLicApplication/BizLicApplicationRepository.cs +++ b/src/Spd.Resource.Repository/BizLicApplication/BizLicApplicationRepository.cs @@ -62,6 +62,7 @@ public async Task CreateBizLicApplicationAsync(CreateB await SetInfoFromBiz(biz, app, cmd.ApplicantIsBizManager ?? false, ct); await SetOwner(app, Guid.Parse(DynamicsConstants.Licensing_Client_Service_Team_Guid), ct); + await SetApplicantSwlLicenceId(app, cmd.ApplicantSwlLicenceId, ct); SharedRepositoryFuncs.LinkServiceType(_context, cmd.ServiceTypeCode, app); SharedRepositoryFuncs.LinkSubmittedByPortalUser(_context, cmd.SubmittedByPortalUserId, app); @@ -114,16 +115,7 @@ public async Task SaveBizLicApplicationAsync(SaveBizLi else _context.SetLink(app, nameof(app.spd_CurrentExpiredLicenceId), null); - if (cmd.ApplicantSwlLicenceId != null) - { - var licence = _context.spd_licences.Where(l => l.spd_licenceid == cmd.ApplicantSwlLicenceId).FirstOrDefault(); - if (licence != null) - { - _context.SetLink(app, nameof(spd_application.spd_ApplicantSWLNumberId), licence); - } - } - else - _context.SetLink(app, nameof(app.spd_ApplicantSWLNumberId), null); + await SetApplicantSwlLicenceId(app, cmd.ApplicantSwlLicenceId, ct); SharedRepositoryFuncs.LinkSubmittedByPortalUser(_context, cmd.SubmittedByPortalUserId, app); @@ -287,6 +279,20 @@ private async Task UpsertPrivateInvestigator(PrivateInvesti return bizContact; } + private async Task SetApplicantSwlLicenceId(spd_application app, Guid? applicantSwlLicenceId, CancellationToken ct) + { + if (applicantSwlLicenceId != null) + { + var licence = await _context.spd_licences.Where(l => l.spd_licenceid == applicantSwlLicenceId).FirstOrDefaultAsync(ct); + if (licence != null) + { + _context.SetLink(app, nameof(spd_application.spd_ApplicantSWLNumberId), licence); + } + } + else + _context.SetLink(app, nameof(app.spd_ApplicantSWLNumberId), null); + } + private void AddPrivateInvestigatorLink(spd_businesscontact bizContact, spd_application app) { _context.AddLink(bizContact, nameof(spd_application.spd_businesscontact_spd_application), app);