Skip to content

Commit

Permalink
fix update and add validation1 (#754)
Browse files Browse the repository at this point in the history
# Description

This PR includes the following proposed change(s):

- fix update and add validation1
  • Loading branch information
peggy-quartech authored Feb 8, 2024
1 parent 02be242 commit 247c0fe
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 107 deletions.
15 changes: 15 additions & 0 deletions src/Spd.Manager.Licence/ChangeSpec.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Spd.Manager.Licence;
internal partial class SecurityWorkerAppManager
{
private record ChangeSpec
{
public bool CategoriesChanged { get; set; } //full update
public bool DogRestraintsChanged { get; set; } //full update
public bool PeaceOfficerStatusChanged { get; set; } //task
public Guid? PeaceOfficerStatusChangeTaskId { get; set; }
public bool MentalHealthStatusChanged { get; set; } //task
public Guid? MentalHealthStatusChangeTaskId { get; set; }
public bool CriminalHistoryChanged { get; set; } //task
public Guid? CriminalHistoryStatusChangeTaskId { get; set; }
}
}
6 changes: 3 additions & 3 deletions src/Spd.Manager.Licence/Mappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ public Mappings()
{
CreateMap<WorkerLicenceAppUpsertRequest, SaveLicenceApplicationCmd>()
.ForMember(d => d.CategoryCodes, opt => opt.MapFrom(s => GetCategories(s.CategoryCodes)));
CreateMap<WorkerLicenceAppAnonymousSubmitRequestJson, CreateLicenceApplicationCmd>()
CreateMap<WorkerLicenceAppAnonymousSubmitRequest, CreateLicenceApplicationCmd>()
.ForMember(d => d.CategoryCodes, opt => opt.MapFrom(s => GetCategories(s.CategoryCodes)));
CreateMap<WorkerLicenceAppAnonymousSubmitRequestJson, UpdateContactCmd>()
CreateMap<WorkerLicenceAppAnonymousSubmitRequest, UpdateContactCmd>()
.ForMember(d => d.FirstName, opt => opt.MapFrom(s => s.GivenName))
.ForMember(d => d.LastName, opt => opt.MapFrom(s => s.Surname))
.ForMember(d => d.EmailAddress, opt => opt.MapFrom(s => s.ContactEmailAddress))
Expand Down Expand Up @@ -55,7 +55,7 @@ public Mappings()
CreateMap<Alias, Spd.Resource.Repository.Alias>()
.ReverseMap();
CreateMap<LicenceAppListResp, WorkerLicenceAppListResponse>();
CreateMap<WorkerLicenceAppAnonymousSubmitRequestJson, SaveLicenceApplicationCmd>()
CreateMap<WorkerLicenceAppAnonymousSubmitRequest, SaveLicenceApplicationCmd>()
.ForMember(d => d.CategoryCodes, opt => opt.MapFrom(s => GetCategories(s.CategoryCodes)));
CreateMap<UploadFileRequest, SpdTempFile>()
.ForMember(d => d.TempFilePath, opt => opt.MapFrom(s => s.FilePath));
Expand Down
14 changes: 9 additions & 5 deletions src/Spd.Manager.Licence/SecurityWorkerAppContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,26 @@ public record WorkerLicenceSubmitCommand(WorkerLicenceAppUpsertRequest LicenceUp
: WorkerLicenceUpsertCommand(LicenceUpsertRequest, BcscGuid), IRequest<WorkerLicenceCommandResponse>;

public record AnonymousWorkerLicenceAppNewCommand(
WorkerLicenceAppAnonymousSubmitRequestJson LicenceAnonymousRequest,
WorkerLicenceAppAnonymousSubmitRequest LicenceAnonymousRequest,
IEnumerable<LicAppFileInfo> LicAppFileInfos,
Guid KeyCode)
: IRequest<WorkerLicenceCommandResponse>;

public record AnonymousWorkerLicenceAppReplaceCommand(
WorkerLicenceAppAnonymousSubmitRequestJson LicenceAnonymousRequest,
WorkerLicenceAppAnonymousSubmitRequest LicenceAnonymousRequest,
IEnumerable<LicAppFileInfo> LicAppFileInfos,
Guid KeyCode)
: IRequest<WorkerLicenceCommandResponse>;

public record AnonymousWorkerLicenceAppRenewCommand(
WorkerLicenceAppAnonymousSubmitRequestJson LicenceAnonymousRequest,
WorkerLicenceAppAnonymousSubmitRequest LicenceAnonymousRequest,
IEnumerable<LicAppFileInfo> LicAppFileInfos,
Guid KeyCode)
: IRequest<WorkerLicenceCommandResponse>;

public record AnonymousWorkerLicenceAppUpdateCommand(
WorkerLicenceAppAnonymousSubmitRequestJson LicenceAnonymousRequest,
WorkerLicenceAppAnonymousSubmitRequest LicenceAnonymousRequest,
IEnumerable<LicAppFileInfo> LicAppFileInfos,
Guid KeyCode)
: IRequest<WorkerLicenceCommandResponse>;

Expand Down Expand Up @@ -84,7 +88,7 @@ public record WorkerLicenceCommandResponse : LicenceAppUpsertResponse

#region anonymous user

public record WorkerLicenceAppAnonymousSubmitRequestJson : PersonalLicenceAppBase //for anonymous user
public record WorkerLicenceAppAnonymousSubmitRequest : PersonalLicenceAppBase //for anonymous user
{
public IEnumerable<WorkerCategoryTypeCode> CategoryCodes { get; set; } = Array.Empty<WorkerCategoryTypeCode>();
public IEnumerable<Guid>? DocumentKeyCodes { get; set; }
Expand Down
Loading

0 comments on commit 247c0fe

Please sign in to comment.