Skip to content

Commit

Permalink
change
Browse files Browse the repository at this point in the history
  • Loading branch information
peggy-quartech committed Jan 8, 2025
1 parent 1eccf74 commit d411e04
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ protected override async Task<BizLicencePrintingJson> CreateDocument(BizLicenceP
mapper.Map(biz, bizLicJson);

//conditions
IncidentListResp resp = await incidentRepository.QueryAsync(
new IncidentQry() { ApplicationId = lic.LicenceAppId, IncludeInactive = true },
cancellationToken);
bizLicJson.Conditions = resp.Items.First().Conditions.Select(c => c.Name);
bizLicJson.Conditions = lic.Conditions.Select(c => c.Name);

return bizLicJson;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ protected override async Task<LicencePreviewJson> CreateDocument(PersonalLicence
preview.SPD_CARD.TemporaryLicence = lic.IsTemporary ?? false;

//conditions
IncidentListResp resp = await incidentRepository.QueryAsync(
new IncidentQry() { ApplicationId = lic.LicenceAppId, IncludeInactive = true },
cancellationToken);
preview.Conditions = resp.Items.First().Conditions.Select(c => c.Name);
preview.Conditions = lic.Conditions.Select(c => c.Name);

return preview;
}
Expand Down
8 changes: 8 additions & 0 deletions src/Spd.Resource.Repository/Licence/Contract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public record LicenceResp() : PermitLicence

//sole proprietor
public Guid? SoleProprietorOrgId { get; set; }

public IEnumerable<Condition> Conditions { get; set; } = Enumerable.Empty<Condition>();
}

public record Licence
Expand Down Expand Up @@ -88,6 +90,12 @@ public record PermitLicence : Licence
public IEnumerable<PermitPurposeEnum>? PermitPurposeEnums { get; set; }
}

public record Condition
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
}

public enum LicenceStatusEnum
{
Active,
Expand Down
2 changes: 2 additions & 0 deletions src/Spd.Resource.Repository/Licence/LicenceRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public LicenceRepository(IDynamicsContextFactory ctx,
licence = await _context.spd_licences
.Expand(i => i.spd_LicenceHolder_contact)
.Expand(i => i.spd_LicenceHolder_account)
.Expand(i => i.spd_spd_licence_spd_licencecondition)
.Expand(i => i.spd_CaseId)
.Expand(i => i.spd_SoleProprietorId)
.Expand(i => i.spd_spd_licence_spd_caselicencecategory_licenceid)
Expand All @@ -45,6 +46,7 @@ public async Task<LicenceListResp> QueryAsync(LicenceQry qry, CancellationToken
{
IQueryable<spd_licence> lics = _context.spd_licences
.Expand(i => i.spd_spd_licence_spd_caselicencecategory_licenceid)
.Expand(i => i.spd_spd_licence_spd_licencecondition)
.Expand(i => i.spd_LicenceHolder_contact)
.Expand(i => i.spd_LicenceHolder_account)
.Expand(i => i.spd_CaseId);
Expand Down
5 changes: 5 additions & 0 deletions src/Spd.Resource.Repository/Licence/Mappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ public Mappings()
.ForMember(d => d.IsDogsPurposeDetectionExplosives, opt => opt.MapFrom(s => SharedMappingFuncs.GetDogReasonFlag(s.spd_requestdogsreasons, RequestDogPurposeOptionSet.DetectionExplosives)))
.ForMember(d => d.CarryAndUseRestraints, opt => opt.MapFrom(s => SharedMappingFuncs.GetBool(s.spd_requestrestraints)))
.ForMember(d => d.UseDogs, opt => opt.MapFrom(s => SharedMappingFuncs.GetBool(s.spd_requestdogs)))
.ForMember(d => d.Conditions, opt => opt.MapFrom(s => s.spd_spd_licence_spd_licencecondition))
;

_ = CreateMap<spd_licencecondition, Condition>()
.ForMember(d => d.Id, opt => opt.MapFrom(s => s.spd_licenceconditionid))
.ForMember(d => d.Name, opt => opt.MapFrom(s => s.spd_conditionname));

_ = CreateMap<spd_licence, Addr>()
.ForMember(d => d.AddressLine1, opt => opt.MapFrom(s => s.spd_employeraddress1))
.ForMember(d => d.AddressLine2, opt => opt.MapFrom(s => s.spd_employeraddress2))
Expand Down

0 comments on commit d411e04

Please sign in to comment.