Skip to content

Commit

Permalink
Merge branch 'develop' into carol/usability-1
Browse files Browse the repository at this point in the history
  • Loading branch information
carolcarpenter committed Jan 7, 2025
2 parents 5b8850b + b8816c3 commit 08706a2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/zap-scans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public async Task<BizLicApplicationCmdResp> 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);

Expand Down Expand Up @@ -114,16 +115,7 @@ public async Task<BizLicApplicationCmdResp> 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);

Expand Down Expand Up @@ -187,6 +179,7 @@ public async Task<BizLicApplicationResp> 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()
Expand Down Expand Up @@ -286,6 +279,20 @@ private async Task<spd_businesscontact> 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);
Expand Down Expand Up @@ -388,6 +395,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)
Expand Down

0 comments on commit 08706a2

Please sign in to comment.