Skip to content

Commit

Permalink
CRC updates (#1419)
Browse files Browse the repository at this point in the history
# Description

This PR includes the following proposed change(s):

- renamed 'HasPreviousNames' to 'HasPreviousName' to match swl/permit
- CRC updates
  • Loading branch information
carolcarpenter authored Sep 19, 2024
1 parent a626395 commit 42c88ae
Show file tree
Hide file tree
Showing 24 changed files with 569 additions and 368 deletions.
2 changes: 1 addition & 1 deletion src/Spd.Manager.Licence/ControllingMemberCrcAppContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public record ControllingMemberCrcAppBase
public GenderCode? GenderCode { get; set; }
public string? PhoneNumber { get; set; }
public string? EmailAddress { get; set; }
public bool? HasPreviousNames { get; set; }
public bool? HasPreviousName { get; set; }
public IEnumerable<Alias> Aliases { get; set; } = Array.Empty<Alias>();
public bool? HasBcDriversLicence { get; set; }
public string? BcDriversLicenceNumber { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Spd.Manager.Licence/ControllingMemberCrcAppManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public async Task<ControllingMemberCrcAppResponse> Handle(GetControllingMemberCr
ControllingMemberCrcAppResponse result = _mapper.Map<ControllingMemberCrcAppResponse>(response);
var existingDocs = await _documentRepository.QueryAsync(new DocumentQry(query.ControllingMemberApplicationId), ct);
result.DocumentInfos = _mapper.Map<Document[]>(existingDocs.Items).Where(d => d.LicenceDocumentTypeCode != null).ToList(); // Exclude licence document type code that are not defined in the related dictionary
result.HasPreviousNames = result.Aliases.Any();
result.HasPreviousName = result.Aliases.Any();
return result;
}
public async Task<ControllingMemberCrcAppCommandResponse> Handle(ControllingMemberCrcAppUpdateCommand cmd, CancellationToken ct)
Expand Down
8 changes: 4 additions & 4 deletions src/Spd.Manager.Licence/ControllingMemberCrcAppValidation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public ControllingMemberCrcAppAnonymousSubmitRequestValidator()
.NotNull()
.NotEmpty()
.Must(r => r.Count() <= 3)
.When(r => r.HasPreviousNames == true)
.When(r => r.HasPreviousName == true)
.WithMessage("No more than 3 user entered aliases are allowed");

RuleForEach(r => r.Aliases)
Expand All @@ -107,7 +107,7 @@ public ControllingMemberCrcAppAnonymousSubmitRequestValidator()
aliases.RuleFor(r => r.MiddleName2)
.MaximumLength(40);
})
.When(r => r.Aliases != null && r.HasPreviousNames == true);
.When(r => r.Aliases != null && r.HasPreviousName == true);

RuleFor(r => r.IsTreatedForMHC).NotNull();
RuleFor(r => r.IsCanadianCitizen).NotNull();
Expand Down Expand Up @@ -202,7 +202,7 @@ public ControllingMemberCrcAppSubmitRequestValidator()
.NotNull()
.NotEmpty()
.Must(r => r.Count() <= 3)
.When(r => r.HasPreviousNames == true)
.When(r => r.HasPreviousName == true)
.WithMessage("No more than 3 user entered aliases are allowed");

RuleForEach(r => r.Aliases)
Expand All @@ -220,7 +220,7 @@ public ControllingMemberCrcAppSubmitRequestValidator()
aliases.RuleFor(r => r.MiddleName2)
.MaximumLength(40);
})
.When(r => r.Aliases != null && r.HasPreviousNames == true);
.When(r => r.Aliases != null && r.HasPreviousName == true);

RuleFor(r => r.IsTreatedForMHC).NotNull();
RuleFor(r => r.IsCanadianCitizen).NotNull();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* tslint:disable */
/* eslint-disable */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';

import { ApplicantProfileResponse } from '../../models/applicant-profile-response';

export interface ApiApplicantGet$Params {
}

export function apiApplicantGet(http: HttpClient, rootUrl: string, params?: ApiApplicantGet$Params, context?: HttpContext): Observable<StrictHttpResponse<ApplicantProfileResponse>> {
const rb = new RequestBuilder(rootUrl, apiApplicantGet.PATH, 'get');
if (params) {
}

return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<ApplicantProfileResponse>;
})
);
}

apiApplicantGet.PATH = '/api/applicant';
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface ControllingMemberCrcAppResponse {
hasBankruptcyHistory?: boolean | null;
hasBcDriversLicence?: boolean | null;
hasCriminalHistory?: boolean | null;
hasPreviousNames?: boolean | null;
hasPreviousName?: boolean | null;
isCanadianCitizen?: boolean | null;
isPoliceOrPeaceOfficer?: boolean | null;
isTreatedForMHC?: boolean | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface ControllingMemberCrcAppSubmitRequest {
hasBankruptcyHistory?: boolean | null;
hasBcDriversLicence?: boolean | null;
hasCriminalHistory?: boolean | null;
hasPreviousNames?: boolean | null;
hasPreviousName?: boolean | null;
inviteId?: string;
isCanadianCitizen?: boolean | null;
isPoliceOrPeaceOfficer?: boolean | null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,25 @@
/* tslint:disable */
/* eslint-disable */
import { Address } from '../models/address';
import { Alias } from '../models/alias';
import { ApplicationTypeCode } from '../models/application-type-code';
import { DocumentExpiredInfo } from '../models/document-expired-info';
import { GenderCode } from '../models/gender-code';
import { PoliceOfficerRoleCode } from '../models/police-officer-role-code';
import { WorkerLicenceTypeCode } from '../models/worker-licence-type-code';
export interface ControllingMemberCrcAppUpdateRequest {
agreeToCompleteAndAccurate?: boolean | null;
aliases?: Array<Alias> | null;
applicationTypeCode?: ApplicationTypeCode;
bankruptcyHistoryDetail?: string | null;
bcDriversLicenceNumber?: string | null;
applicantId?: string | null;
bizContactId?: string;
controllingMemberAppId?: string | null;
criminalHistoryDetail?: string | null;
dateOfBirth?: string;
documentExpiredInfos?: Array<DocumentExpiredInfo> | null;
documentKeyCodes?: Array<string> | null;
emailAddress?: string | null;
genderCode?: GenderCode;
givenName?: string | null;
hasBankruptcyHistory?: boolean | null;
hasBcDriversLicence?: boolean | null;
hasCriminalHistory?: boolean | null;
hasLegalNameChanged?: boolean | null;
hasNewCriminalRecordCharge?: boolean | null;
hasNewMentalHealthCondition?: boolean | null;
hasPreviousNames?: boolean | null;
inviteId?: string;
isCanadianCitizen?: boolean | null;
isPoliceOrPeaceOfficer?: boolean | null;
isTreatedForMHC?: boolean | null;
middleName1?: string | null;
Expand All @@ -42,5 +31,4 @@ export interface ControllingMemberCrcAppUpdateRequest {
previousDocumentIds?: Array<string> | null;
residentialAddress?: Address;
surname?: string | null;
workerLicenceTypeCode?: WorkerLicenceTypeCode;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Address } from '../models/address';
import { Alias } from '../models/alias';
import { ApplicationTypeCode } from '../models/application-type-code';
import { Document } from '../models/document';
import { DocumentExpiredInfo } from '../models/document-expired-info';
import { GenderCode } from '../models/gender-code';
import { PoliceOfficerRoleCode } from '../models/police-officer-role-code';
import { WorkerLicenceTypeCode } from '../models/worker-licence-type-code';
Expand All @@ -18,14 +19,15 @@ export interface ControllingMemberCrcAppUpsertRequest {
controllingMemberAppId?: string | null;
criminalHistoryDetail?: string | null;
dateOfBirth?: string;
documentExpiredInfos?: Array<DocumentExpiredInfo> | null;
documentInfos?: Array<Document> | null;
emailAddress?: string | null;
genderCode?: GenderCode;
givenName?: string | null;
hasBankruptcyHistory?: boolean | null;
hasBcDriversLicence?: boolean | null;
hasCriminalHistory?: boolean | null;
hasPreviousNames?: boolean | null;
hasPreviousName?: boolean | null;
inviteId?: string;
isCanadianCitizen?: boolean | null;
isPoliceOrPeaceOfficer?: boolean | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { apiApplicantApplicantIdPut } from '../fn/applicant-profile/api-applican
import { ApiApplicantApplicantIdPut$Params } from '../fn/applicant-profile/api-applicant-applicant-id-put';
import { apiApplicantFilesPost } from '../fn/applicant-profile/api-applicant-files-post';
import { ApiApplicantFilesPost$Params } from '../fn/applicant-profile/api-applicant-files-post';
import { apiApplicantGet } from '../fn/applicant-profile/api-applicant-get';
import { ApiApplicantGet$Params } from '../fn/applicant-profile/api-applicant-get';
import { apiApplicantIdGet } from '../fn/applicant-profile/api-applicant-id-get';
import { ApiApplicantIdGet$Params } from '../fn/applicant-profile/api-applicant-id-get';
import { apiApplicantMergeOldApplicantIdNewApplicantIdGet } from '../fn/applicant-profile/api-applicant-merge-old-applicant-id-new-applicant-id-get';
Expand Down Expand Up @@ -194,4 +196,39 @@ export class ApplicantProfileService extends BaseService {
);
}

/** Path part for operation `apiApplicantGet()` */
static readonly ApiApplicantGetPath = '/api/applicant';

/**
* Get applicant profile anonymously, the applicantId is retrieved from cookies.
* For controlling member, The cookie is set when the user click the update cm email link, verify the invitation.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `apiApplicantGet()` instead.
*
* This method doesn't expect any request body.
*/
apiApplicantGet$Response(params?: ApiApplicantGet$Params, context?: HttpContext): Observable<StrictHttpResponse<ApplicantProfileResponse>> {
return apiApplicantGet(this.http, this.rootUrl, params, context);
}

/**
* Get applicant profile anonymously, the applicantId is retrieved from cookies.
* For controlling member, The cookie is set when the user click the update cm email link, verify the invitation.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `apiApplicantGet$Response()` instead.
*
* This method doesn't expect any request body.
*/
apiApplicantGet(params?: ApiApplicantGet$Params, context?: HttpContext): Observable<ApplicantProfileResponse> {
return this.apiApplicantGet$Response(params, context).pipe(
map((r: StrictHttpResponse<ApplicantProfileResponse>): ApplicantProfileResponse => r.body)
);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,11 @@ export class BusinessApplicationService extends BusinessApplicationHelper {

isControllingMembersWithoutSwlExist = membersWithoutSwl?.length > 0;

const membersWithoutSwlAndWithEmail = membersWithoutSwl.filter((item: any) => !!item.emailAddress);

isControllingMembersWithoutSwlComplete =
membersWithoutSwlAndWithEmail?.length > 0
? membersWithoutSwlAndWithEmail.findIndex(
membersWithoutSwl?.length > 0
? membersWithoutSwl.findIndex(
(item: NonSwlContactInfo) =>
item.controllingMemberAppStatusCode != ApplicationPortalStatusCode.CompletedCleared
item.controllingMemberAppStatusCode != ApplicationPortalStatusCode.AwaitingPayment
) < 0
: true;
}
Expand Down Expand Up @@ -515,6 +513,8 @@ export class BusinessApplicationService extends BusinessApplicationHelper {
? ControllingMemberAppInviteTypeCode.Update
: ControllingMemberAppInviteTypeCode.New;

// TODO which statuses should be looked at?

return this.bizMembersService.apiBusinessLicenceApplicationControllingMemberInvitationBizContactIdGet({
bizContactId,
inviteType,
Expand Down
Loading

0 comments on commit 42c88ae

Please sign in to comment.