Skip to content

Commit 436ab35

Browse files
committed
ECER-5270: Countries Is ICRA flag handled in Queries and flag added to country endpoint. ECER-5270: Country Relationships Added to International Certification
1 parent 481fb36 commit 436ab35

File tree

7 files changed

+18
-4
lines changed

7 files changed

+18
-4
lines changed

src/ECER.Clients.RegistryPortal/ECER.Clients.RegistryPortal.Server/ConfigurationEndpoints.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public record OidcAuthenticationSettings
113113
public record IdentificationType(string Id, string Name, bool ForPrimary, bool ForSecondary);
114114
public record Province(string ProvinceId, string ProvinceName, string ProvinceCode);
115115
public record PostSecondaryInstitution(string Id, string Name, string ProvinceId);
116-
public record Country(string CountryId, string CountryName, string CountryCode);
116+
public record Country(string CountryId, string CountryName, string CountryCode, bool IsICRA);
117117
public record SystemMessage(string Name, string Subject, string Message)
118118
{
119119
public DateTime StartDate { get; set; }

src/ECER.Managers.Admin.Contract/Metadatas/Contract.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public record CountriesQuery : IRequest<CountriesQueryResults>
2626
public string? ById { get; set; }
2727
public string? ByCode { get; set; }
2828
public string? ByName { get; set; }
29+
public bool? ByICRA { get; set; }
30+
2931
}
3032

3133
public record PostSecondaryInstitutionsQuery : IRequest<PostSecondaryInstitutionsQueryResults>
@@ -57,7 +59,7 @@ public record CountriesQueryResults(IEnumerable<Country> Items);
5759
public record PostSecondaryInstitutionsQueryResults(IEnumerable<PostSecondaryInstitution> Items);
5860
public record DynamicsConfigQueryResults(DynamicsConfig config);
5961
public record Province(string ProvinceId, string ProvinceName, string ProvinceCode);
60-
public record Country(string CountryId, string CountryName, string CountryCode);
62+
public record Country(string CountryId, string CountryName, string CountryCode, bool IsICRA);
6163
public record PostSecondaryInstitution(string Id, string Name, string ProvinceId);
6264
public record IdentificationType(string Id, string Name, bool ForPrimary, bool ForSecondary);
6365
public record DynamicsConfig(bool ICRAFeatureEnabled);

src/ECER.Resources.Documents/Applications/ApplicationRepositoryMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public ApplicationRepositoryMapper()
180180
.ForMember(d => d.StudentMiddleName, opts => opts.MapFrom(s => s.ecer_StudentMiddleName))
181181
.ForMember(d => d.Country, opts => opts.MapFrom(src =>
182182
src.ecer_InstituteCountryId != null
183-
? new Country(src.ecer_InstituteCountryId.Id.ToString(), src.ecer_InstituteCountryIdName, string.Empty)
183+
? new Country(src.ecer_InstituteCountryId.Id.ToString(), src.ecer_InstituteCountryIdName, string.Empty,false)
184184
: null))
185185
.ForMember(d => d.Province, opts => opts.MapFrom(src =>
186186
src.ecer_ProvinceId != null

src/ECER.Resources.Documents/ICRA/ICRAChildren/InternationalCertifications.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ private async Task UpdateInternationalCertifications(ecer_ICRAEligibilityAssessm
4747
ecerInternationalCertification.ecer_InternationalCertificationId = newId;
4848
context.AddObject(ecerInternationalCertification);
4949
context.AddLink(icraEligibility, ecer_ICRAEligibilityAssessment.Fields.ecer_internationalcertification_EligibilityAssessment_ecer_icraeligibilityassessment, ecerInternationalCertification);
50+
if (InternationalCertification.CountryId != null)
51+
{
52+
var ecer_country = context.ecer_CountrySet.SingleOrDefault(c => c.ecer_CountryId == Guid.Parse(InternationalCertification.CountryId));
53+
if (ecer_country != null)
54+
{
55+
context.AddLink(ecer_country, ecer_ICRAEligibilityAssessment.Fields.ecer_icraeligibilityassessment_CountryId, ecerInternationalCertification);
56+
}
57+
}
5058
await HandleInternationalCertificationFiles(ecerInternationalCertification, Guid.Parse(ApplicantId), InternationalCertification.NewFiles, InternationalCertification.DeletedFiles, ct);
5159
}
5260
}

src/ECER.Resources.Documents/MetadataResources/IMetadataResourceRepository.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public interface IMetadataResourceRepository
2222
}
2323

2424
public record Province(string ProvinceId, string ProvinceName, string ProvinceCode);
25-
public record Country(string CountryId, string CountryName, string CountryCode);
25+
public record Country(string CountryId, string CountryName, string CountryCode, bool IsICRA);
2626
public record IdentificationType(string Id, string Name, bool ForPrimary, bool ForSecondary);
2727
public record PostSecondaryInstitution(string Id, string Name, string ProvinceId);
2828
public record SystemMessage(string Name, string Subject, string Message)
@@ -69,6 +69,7 @@ public record CountriesQuery
6969
public string? ById { get; set; }
7070
public string? ByCode { get; set; }
7171
public string? ByName { get; set; }
72+
public bool? ByICRA { get; set; }
7273
}
7374

7475
public record PostSecondaryInstitutionsQuery

src/ECER.Resources.Documents/MetadataResources/MetadataResourceRepository.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public async Task<IEnumerable<Country>> QueryCountries(CountriesQuery query, Can
2222
if (query.ById != null) countries = countries.Where(r => r.ecer_CountryId == Guid.Parse(query.ById));
2323
if (query.ByCode != null) countries = countries.Where(r => r.ecer_ShortName == query.ByCode);
2424
if (query.ByName != null) countries = countries.Where(r => r.ecer_Name == query.ByName);
25+
if (query.ByICRA != null) countries = countries.Where(r => r.ecer_EligibleforICRA == query.ByICRA);
2526

2627
return mapper.Map<IEnumerable<Country>>(countries)!.ToList();
2728
}

src/ECER.Resources.Documents/MetadataResources/MetadataResourceRepositoryMapper.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ public MetadataResourceRepositoryMapper()
3131
.ForCtorParam(nameof(Country.CountryId), opt => opt.MapFrom(src => src.ecer_CountryId))
3232
.ForCtorParam(nameof(Country.CountryName), opt => opt.MapFrom(src => src.ecer_Name))
3333
.ForCtorParam(nameof(Country.CountryCode), opt => opt.MapFrom(src => src.ecer_ShortName))
34+
.ForCtorParam(nameof(Country.IsICRA), opt => opt.MapFrom(src => src.ecer_EligibleforICRA))
3435
.ValidateMemberList(MemberList.Destination)
3536
.ReverseMap()
3637
.ForMember(dest => dest.ecer_CountryId, opt => opt.MapFrom(src => src.CountryId))
3738
.ForMember(dest => dest.ecer_Name, opt => opt.MapFrom(src => src.CountryName))
39+
.ForMember(dest => dest.ecer_EligibleforICRA, opt => opt.MapFrom(src => src.IsICRA))
3840
.ForMember(dest => dest.ecer_ShortName, opt => opt.MapFrom(src => src.CountryCode));
3941

4042
CreateMap<ecer_PostSecondaryInstitute, PostSecondaryInstitution>(MemberList.Source)

0 commit comments

Comments
 (0)