-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description This PR includes the following proposed change(s): - re-org code for permit
- Loading branch information
1 parent
f996dfe
commit 2695d51
Showing
14 changed files
with
880 additions
and
392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using Spd.Manager.Shared; | ||
using GenderCode = Spd.Manager.Shared.GenderCode; | ||
|
||
namespace Spd.Manager.Licence; | ||
public abstract record PersonalLicenceAppBase | ||
{ | ||
public WorkerLicenceTypeCode? WorkerLicenceTypeCode { get; set; } | ||
public ApplicationTypeCode? ApplicationTypeCode { get; set; } | ||
public BusinessTypeCode? BusinessTypeCode { get; set; } | ||
public string? GivenName { get; set; } | ||
public string? MiddleName1 { get; set; } | ||
public string? MiddleName2 { get; set; } | ||
public string? Surname { get; set; } | ||
public DateOnly? DateOfBirth { get; set; } | ||
public GenderCode? GenderCode { get; set; } | ||
public bool? OneLegalName { get; set; } | ||
public string? ExpiredLicenceNumber { get; set; } | ||
public Guid? ExpiredLicenceId { get; set; } //for new application type, for renew, replace, update, it should be null. | ||
public bool? HasExpiredLicence { get; set; } //for new application type | ||
public LicenceTermCode? LicenceTermCode { get; set; } | ||
public bool? HasCriminalHistory { get; set; } | ||
public bool? HasPreviousName { get; set; } | ||
public IEnumerable<Alias>? Aliases { get; set; } | ||
public bool? HasBcDriversLicence { get; set; } | ||
public string? BcDriversLicenceNumber { get; set; } | ||
public HairColourCode? HairColourCode { get; set; } | ||
public EyeColourCode? EyeColourCode { get; set; } | ||
public int? Height { get; set; } | ||
public HeightUnitCode? HeightUnitCode { get; set; } | ||
public int? Weight { get; set; } | ||
public WeightUnitCode? WeightUnitCode { get; set; } | ||
public string? ContactEmailAddress { get; set; } | ||
public string? ContactPhoneNumber { get; set; } | ||
public bool? IsMailingTheSameAsResidential { get; set; } | ||
public ResidentialAddress? ResidentialAddressData { get; set; } | ||
public MailingAddress? MailingAddressData { get; set; } | ||
public bool? IsPoliceOrPeaceOfficer { get; set; } | ||
public PoliceOfficerRoleCode? PoliceOfficerRoleCode { get; set; } | ||
public string? OtherOfficerRole { get; set; } | ||
public bool? IsTreatedForMHC { get; set; } | ||
public bool? UseBcServicesCardPhoto { get; set; } | ||
public bool? CarryAndUseRestraints { get; set; } | ||
public bool? UseDogs { get; set; } | ||
public bool? IsDogsPurposeProtection { get; set; } | ||
public bool? IsDogsPurposeDetectionDrugs { get; set; } | ||
public bool? IsDogsPurposeDetectionExplosives { get; set; } | ||
public bool? IsCanadianCitizen { get; set; } | ||
public bool? AgreeToCompleteAndAccurate { get; set; } | ||
public bool? LegalNameChanged { get; set; } | ||
public IEnumerable<DocumentExpiredInfo> DocumentExpiredInfos { get; set; } = Enumerable.Empty<DocumentExpiredInfo>(); | ||
} | ||
|
||
public record ResidentialAddress : Address; | ||
public record MailingAddress : Address; | ||
public record DocumentExpiredInfo | ||
{ | ||
public LicenceDocumentTypeCode LicenceDocumentTypeCode { get; set; } | ||
public DateOnly? ExpiryDate { get; set; } | ||
} | ||
public record LicenceAppUpsertResponse | ||
{ | ||
public Guid? LicenceAppId { get; set; } | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using MediatR; | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Spd.Manager.Licence; | ||
public interface ILicenceAppDocumentManager | ||
{ | ||
public Task<IEnumerable<LicAppFileInfo>> Handle(CreateDocumentInCacheCommand command, CancellationToken ct); | ||
public Task<IEnumerable<LicenceAppDocumentResponse>> Handle(CreateLicenceAppDocumentCommand command, CancellationToken ct); | ||
} | ||
|
||
|
||
#region file upload | ||
public record CreateLicenceAppDocumentCommand(LicenceAppDocumentUploadRequest Request, string? BcscId, Guid AppId) : IRequest<IEnumerable<LicenceAppDocumentResponse>>; | ||
public record CreateDocumentInCacheCommand(LicenceAppDocumentUploadRequest Request) : IRequest<IEnumerable<LicAppFileInfo>>; | ||
|
||
public record LicenceAppDocumentUploadRequest( | ||
IList<IFormFile> Documents, | ||
LicenceDocumentTypeCode LicenceDocumentTypeCode | ||
); | ||
public record LicenceAppDocumentResponse | ||
{ | ||
public Guid DocumentUrlId { get; set; } | ||
public DateTimeOffset UploadedDateTime { get; set; } | ||
public Guid? LicenceAppId { get; set; } | ||
public string? DocumentName { get; set; } | ||
public string? DocumentExtension { get; set; } | ||
}; | ||
public record LicenceAppDocumentsCache | ||
{ | ||
public IEnumerable<LicAppFileInfo> Items { get; set; } = Enumerable.Empty<LicAppFileInfo>(); | ||
} | ||
public record LicAppFileInfo | ||
{ | ||
public LicenceDocumentTypeCode LicenceDocumentTypeCode { get; set; } | ||
public string? TempFileKey { get; set; } = null!; | ||
public string ContentType { get; set; } = null!; | ||
public string FileName { get; set; } = null!; | ||
public long FileSize { get; set; } | ||
} | ||
#endregion | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using FluentValidation; | ||
|
||
namespace Spd.Manager.Licence; | ||
public class PersonalLicenceAppBaseValidator<T> : AbstractValidator<T> where T : PersonalLicenceAppBase | ||
{ | ||
public PersonalLicenceAppBaseValidator() | ||
{ | ||
RuleFor(r => r.WorkerLicenceTypeCode).NotEmpty(); | ||
RuleFor(r => r.ApplicationTypeCode).NotEmpty(); | ||
RuleFor(r => r.Surname).NotEmpty(); | ||
RuleFor(r => r.DateOfBirth).NotEmpty(); | ||
RuleFor(r => r.GenderCode).NotEmpty(); | ||
RuleFor(r => r.LicenceTermCode).NotEmpty(); | ||
RuleFor(r => r.HasExpiredLicence).NotEmpty(); | ||
RuleFor(r => r.ExpiredLicenceNumber).NotEmpty().When(r => r.HasExpiredLicence == true); | ||
RuleFor(r => r.HasCriminalHistory).NotEmpty(); | ||
RuleFor(r => r.HasBcDriversLicence).NotEmpty(); | ||
RuleFor(r => r.HairColourCode).NotEmpty(); | ||
RuleFor(r => r.EyeColourCode).NotEmpty(); | ||
RuleFor(r => r.Height).NotEmpty(); | ||
RuleFor(r => r.HeightUnitCode).NotEmpty(); | ||
RuleFor(r => r.Weight).NotEmpty(); | ||
RuleFor(r => r.WeightUnitCode).NotEmpty(); | ||
RuleFor(r => r.HasCriminalHistory).NotEmpty(); | ||
RuleFor(r => r.IsMailingTheSameAsResidential).NotEmpty(); | ||
RuleFor(r => r.ContactPhoneNumber).MaximumLength(15).NotEmpty(); | ||
RuleFor(r => r.ContactEmailAddress).MaximumLength(75).When(r => r.ContactEmailAddress != null); | ||
RuleFor(r => r.IsPoliceOrPeaceOfficer).NotEmpty(); | ||
RuleFor(r => r.PoliceOfficerRoleCode).NotEmpty().When(r => r.IsPoliceOrPeaceOfficer == true); | ||
RuleFor(r => r.OtherOfficerRole).NotEmpty() | ||
.When(r => r.IsPoliceOrPeaceOfficer != null && r.IsPoliceOrPeaceOfficer == true && r.PoliceOfficerRoleCode != null && r.PoliceOfficerRoleCode == PoliceOfficerRoleCode.Other); | ||
RuleFor(r => r.IsTreatedForMHC).NotEmpty(); | ||
RuleFor(r => r.UseBcServicesCardPhoto).NotEmpty(); | ||
RuleFor(r => r.IsCanadianCitizen).NotEmpty(); | ||
//residential address | ||
RuleFor(r => r.ResidentialAddressData).NotEmpty().WithMessage("ResidentialAddress cannot be empty"); | ||
RuleFor(r => r.ResidentialAddressData.Province).NotEmpty().When(r => r.ResidentialAddressData != null); | ||
RuleFor(r => r.ResidentialAddressData.City).NotEmpty().MaximumLength(100).When(r => r.ResidentialAddressData != null); | ||
RuleFor(r => r.ResidentialAddressData.AddressLine1).NotEmpty().MaximumLength(100).When(r => r.ResidentialAddressData != null); | ||
RuleFor(r => r.ResidentialAddressData.Country).NotEmpty().MaximumLength(100).When(r => r.ResidentialAddressData != null); | ||
RuleFor(r => r.ResidentialAddressData.PostalCode).NotEmpty().MaximumLength(20).When(r => r.ResidentialAddressData != null); | ||
|
||
} | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using MediatR; | ||
|
||
namespace Spd.Manager.Licence; | ||
public interface IPermitAppManager | ||
{ | ||
public Task<PermitAppCommandResponse> Handle(AnonymousPermitAppNewCommand command, CancellationToken ct); | ||
public Task<PermitAppCommandResponse> Handle(AnonymousPermitAppReplaceCommand command, CancellationToken ct); | ||
public Task<PermitAppCommandResponse> Handle(AnonymousPermitAppRenewCommand command, CancellationToken ct); | ||
public Task<PermitAppCommandResponse> Handle(AnonymousPermitAppUpdateCommand command, CancellationToken ct); | ||
} | ||
|
||
#region anonymous user | ||
public record AnonymousPermitAppNewCommand( | ||
PermitAppAnonymousSubmitRequest LicenceAnonymousRequest, | ||
Guid KeyCode) | ||
: IRequest<PermitAppCommandResponse>; | ||
|
||
public record AnonymousPermitAppReplaceCommand( | ||
PermitAppAnonymousSubmitRequest LicenceAnonymousRequest, | ||
Guid KeyCode) | ||
: IRequest<PermitAppCommandResponse>; | ||
|
||
public record AnonymousPermitAppRenewCommand( | ||
PermitAppAnonymousSubmitRequest LicenceAnonymousRequest, | ||
Guid KeyCode) | ||
: IRequest<PermitAppCommandResponse>; | ||
|
||
public record AnonymousPermitAppUpdateCommand( | ||
PermitAppAnonymousSubmitRequest LicenceAnonymousRequest, | ||
Guid KeyCode) | ||
: IRequest<PermitAppCommandResponse>; | ||
|
||
public record PermitAppAnonymousSubmitRequest : PersonalLicenceAppBase | ||
{ | ||
public IEnumerable<Guid>? DocumentKeyCodes { get; set; } | ||
public IEnumerable<Guid>? PreviousDocumentIds { get; set; } //documentUrlId, used for renew | ||
public Guid? OriginalApplicationId { get; set; } //for new, it should be null. for renew, replace, update, it should be original application id. | ||
public Guid? OriginalLicenceId { get; set; } //for new, it should be null. for renew, replace, update, it should be original licence id. | ||
public bool? Reprint { get; set; } | ||
public string? PermitOtherRequiredReason { get; set; } | ||
public string? EmployerName { get; set; } | ||
public string? SupervisorName { get; set; } | ||
public string? SupervisorEmailAddress { get; set; } | ||
public string? SupervisorPhoneNumber { get; set; } | ||
public EmployerPrimaryAddress? EmployerPrimaryAddress { get; set; } | ||
public string? Rationale { get; set; } | ||
public bool? IsCanadianResident { get; set; } | ||
public IEnumerable<RequirePermitReasonCode>? RequirePermitReasonCode { get; set; } | ||
} | ||
|
||
public record PermitAppCommandResponse : LicenceAppUpsertResponse; | ||
|
||
public enum RequirePermitReasonCode | ||
{ | ||
PersonalProtection, | ||
MyEmployment, | ||
OutdoorRecreation, | ||
TravelInResponseToInternationalConflict, | ||
Other | ||
} | ||
public record EmployerPrimaryAddress : Address; | ||
#endregion | ||
|
||
|
||
|
||
|
Oops, something went wrong.