Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
peggy-quartech committed Feb 7, 2024
1 parent fef3834 commit 3e045ed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
15 changes: 9 additions & 6 deletions src/Spd.Manager.Licence/SecurityWorkerAppContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ public interface ISecurityWorkerAppManager
public Task<WorkerLicenceCommandResponse> Handle(WorkerLicenceSubmitCommand command, CancellationToken ct);
public Task<WorkerLicenceResponse> Handle(GetWorkerLicenceQuery query, CancellationToken ct);
public Task<IEnumerable<WorkerLicenceAppListResponse>> Handle(GetWorkerLicenceAppListQuery query, CancellationToken ct);
public Task<WorkerLicenceAppUpsertResponse> Handle(AnonymousWorkerLicenceAppNewCommand command, CancellationToken ct);
public Task<WorkerLicenceAppUpsertResponse> Handle(AnonymousWorkerLicenceAppReplaceCommand command, CancellationToken ct);
public Task<WorkerLicenceAppUpsertResponse> Handle(AnonymousWorkerLicenceAppRenewCommand command, CancellationToken ct);
public Task<WorkerLicenceAppUpsertResponse> Handle(AnonymousWorkerLicenceAppUpdateCommand command, CancellationToken ct);
public Task<WorkerLicenceCommandResponse> Handle(AnonymousWorkerLicenceAppNewCommand command, CancellationToken ct);
public Task<WorkerLicenceCommandResponse> Handle(AnonymousWorkerLicenceAppReplaceCommand command, CancellationToken ct);
public Task<WorkerLicenceCommandResponse> Handle(AnonymousWorkerLicenceAppRenewCommand command, CancellationToken ct);
public Task<WorkerLicenceCommandResponse> Handle(AnonymousWorkerLicenceAppUpdateCommand command, CancellationToken ct);
}

public record WorkerLicenceUpsertCommand(WorkerLicenceAppUpsertRequest LicenceUpsertRequest, string? BcscGuid = null) : IRequest<WorkerLicenceCommandResponse>;
public record WorkerLicenceSubmitCommand(WorkerLicenceAppUpsertRequest LicenceUpsertRequest, string? BcscGuid = null)
: WorkerLicenceUpsertCommand(LicenceUpsertRequest, BcscGuid), IRequest<WorkerLicenceAppUpsertResponse>;
: WorkerLicenceUpsertCommand(LicenceUpsertRequest, BcscGuid), IRequest<WorkerLicenceCommandResponse>;

public record AnonymousWorkerLicenceAppNewCommand(
WorkerLicenceAppAnonymousSubmitRequestJson LicenceAnonymousRequest,
Expand Down Expand Up @@ -73,7 +73,10 @@ public record WorkerLicenceAppUpsertRequest : PersonalLicenceAppBase

public record WorkerLicenceAppSubmitRequest : WorkerLicenceAppUpsertRequest;

public record WorkerLicenceAppUpsertResponse : LicenceAppUpsertResponse;
public record WorkerLicenceCommandResponse : LicenceAppUpsertResponse
{
public decimal? Cost { get; set;}
};


#endregion
Expand Down
18 changes: 9 additions & 9 deletions src/Spd.Manager.Licence/SecurityWorkerAppManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ internal partial class SecurityWorkerAppManager :
IRequestHandler<WorkerLicenceSubmitCommand, WorkerLicenceCommandResponse>,
IRequestHandler<GetWorkerLicenceQuery, WorkerLicenceResponse>,
IRequestHandler<GetWorkerLicenceAppListQuery, IEnumerable<WorkerLicenceAppListResponse>>,
IRequestHandler<AnonymousWorkerLicenceAppNewCommand, WorkerLicenceAppUpsertResponse>,
IRequestHandler<AnonymousWorkerLicenceAppReplaceCommand, WorkerLicenceAppUpsertResponse>,
IRequestHandler<AnonymousWorkerLicenceAppRenewCommand, WorkerLicenceAppUpsertResponse>,
IRequestHandler<AnonymousWorkerLicenceAppUpdateCommand, WorkerLicenceAppUpsertResponse>,
IRequestHandler<AnonymousWorkerLicenceAppNewCommand, WorkerLicenceCommandResponse>,
IRequestHandler<AnonymousWorkerLicenceAppReplaceCommand, WorkerLicenceCommandResponse>,
IRequestHandler<AnonymousWorkerLicenceAppRenewCommand, WorkerLicenceCommandResponse>,
IRequestHandler<AnonymousWorkerLicenceAppUpdateCommand, WorkerLicenceCommandResponse>,
ISecurityWorkerAppManager
{
private readonly ILicenceRepository _licenceRepository;
Expand Down Expand Up @@ -93,7 +93,7 @@ public async Task<WorkerLicenceCommandResponse> Handle(WorkerLicenceUpsertComman

//await UpdateDocumentsAsync(cmd.LicenceUpsertRequest, ct);
//await RemoveDeletedDocumentsAsync(cmd.LicenceUpsertRequest, ct);
return _mapper.Map<WorkerLicenceAppUpsertResponse>(response);
return _mapper.Map<WorkerLicenceCommandResponse>(response);
}

// authenticated submit
Expand Down Expand Up @@ -151,7 +151,7 @@ public async Task<IEnumerable<WorkerLicenceAppListResponse>> Handle(GetWorkerLic

#region anonymous

public async Task<WorkerLicenceAppUpsertResponse> Handle(AnonymousWorkerLicenceAppNewCommand cmd, CancellationToken ct)
public async Task<WorkerLicenceCommandResponse> Handle(AnonymousWorkerLicenceAppNewCommand cmd, CancellationToken ct)
{
WorkerLicenceAppAnonymousSubmitRequestJson request = cmd.LicenceAnonymousRequest;

Expand Down Expand Up @@ -309,7 +309,7 @@ public async Task<WorkerLicenceCommandResponse> Handle(AnonymousWorkerLicenceApp
LicenceApplicationCmdResp? createLicResponse = null;
if ((request.Reprint != null && request.Reprint.Value) || (changes.CategoriesChanged || changes.DogRestraintsChanged))
{
CreateLicenceApplicationCmd createApp = _mapper.Map<CreateLicenceApplicationCmd>(request);
CreateLicenceApplicationCmd? createApp = _mapper.Map<CreateLicenceApplicationCmd>(request);
createLicResponse = await _licenceAppRepository.CreateLicenceApplicationAsync(createApp, ct);
//add all new files user uploaded
if (request.DocumentKeyCodes != null && request.DocumentKeyCodes.Any())
Expand All @@ -318,8 +318,8 @@ public async Task<WorkerLicenceCommandResponse> Handle(AnonymousWorkerLicenceApp

foreach (LicAppFileInfo licAppFile in items)
{
SpdTempFile tempFile = _mapper.Map<SpdTempFile>(licAppFile);
CreateDocumentCmd fileCmd = _mapper.Map<CreateDocumentCmd>(licAppFile);
SpdTempFile? tempFile = _mapper.Map<SpdTempFile>(licAppFile);
CreateDocumentCmd? fileCmd = _mapper.Map<CreateDocumentCmd>(licAppFile);
fileCmd.ApplicantId = createLicResponse.ContactId;
if (licAppFile.LicenceDocumentTypeCode == LicenceDocumentTypeCode.PoliceBackgroundLetterOfNoConflict)
{
Expand Down

0 comments on commit 3e045ed

Please sign in to comment.