11using AutoMapper ;
2- using ECER . Clients . RegistryPortal . Server . Applications ;
32using ECER . Clients . RegistryPortal . Server . Shared ;
43using ECER . Managers . Admin . Contract . Metadatas ;
54using ECER . Utilities . Hosting ;
@@ -12,13 +11,20 @@ public class ConfigurationEndpoints : IRegisterEndpoints
1211{
1312 public void Register ( IEndpointRouteBuilder endpointRouteBuilder )
1413 {
15- endpointRouteBuilder . MapGet ( "/api/configuration" , async ( HttpContext ctx ) =>
14+ endpointRouteBuilder . MapGet ( "/api/configuration" , async ( HttpContext ctx , IMediator messageBus , CancellationToken ct ) =>
1615 {
1716 await Task . CompletedTask ;
1817 var configuration = ctx . RequestServices . GetRequiredService < IConfiguration > ( ) ;
18+
19+ var dynamicsConfig = await messageBus . Send ( new DynamicsConfigQuery ( ) , ct ) ;
1920 var appConfig = configuration . Get < ApplicationConfiguration > ( ) ! ;
21+
22+
23+ appConfig . ICRAFeatureEnabled = dynamicsConfig . config . ICRAFeatureEnabled ;
24+
2025 return TypedResults . Ok ( appConfig ) ;
21- } ) . WithOpenApi ( "Returns the UI initial configuration" , string . Empty , "configuration_get" ) ;
26+ } ) . WithOpenApi ( "Returns the UI initial configuration" , string . Empty , "configuration_get" )
27+ . CacheOutput ( p => p . Expire ( TimeSpan . FromMinutes ( 5 ) ) ) ;
2228
2329 endpointRouteBuilder . MapGet ( "/api/provincelist" , async ( HttpContext ctx , IMediator messageBus , IMapper mapper , CancellationToken ct ) =>
2430 {
@@ -28,7 +34,6 @@ public void Register(IEndpointRouteBuilder endpointRouteBuilder)
2834 . WithOpenApi ( "Handles province queries" , string . Empty , "province_get" )
2935 . CacheOutput ( p => p . Expire ( TimeSpan . FromMinutes ( 5 ) ) ) ;
3036
31-
3237 endpointRouteBuilder . MapGet ( "/api/defaultContents" , async ( HttpContext ctx , IMediator messageBus , IMapper mapper , CancellationToken ct ) =>
3338 {
3439 var results = await messageBus . Send ( new DefaultContentsQuery ( ) , ct ) ;
@@ -93,6 +98,7 @@ public void Register(IEndpointRouteBuilder endpointRouteBuilder)
9398public record ApplicationConfiguration
9499{
95100 public Dictionary < string , OidcAuthenticationSettings > ClientAuthenticationMethods { get ; set ; } = [ ] ;
101+ public bool ICRAFeatureEnabled { get ; set ; }
96102}
97103
98104#pragma warning restore CA2227 // Collection properties should be read only
@@ -128,21 +134,21 @@ public record IdentificationTypesQuery
128134 public bool ? ForPrimary { get ; set ; }
129135 public bool ? ForSecondary { get ; set ; }
130136}
131- public record OutOfProvinceCertificationType ( string Id )
132- {
133- public string ? CertificationType { get ; set ; }
134- }
137+ public record OutOfProvinceCertificationType ( string Id )
138+ {
139+ public string ? CertificationType { get ; set ; }
140+ }
135141
136- public record CertificationComparison ( string Id )
137- {
138- public string ? BcCertificate { get ; set ; }
139- }
142+ public record CertificationComparison ( string Id )
143+ {
144+ public string ? BcCertificate { get ; set ; }
145+ }
140146
141- public record ComparisonRecord ( )
142- {
143- public OutOfProvinceCertificationType ? TransferringCertificate { get ; set ; }
144- public IEnumerable < CertificationComparison > Options { get ; set ; } = Array . Empty < CertificationComparison > ( ) ;
145- }
147+ public record ComparisonRecord ( )
148+ {
149+ public OutOfProvinceCertificationType ? TransferringCertificate { get ; set ; }
150+ public IEnumerable < CertificationComparison > Options { get ; set ; } = Array . Empty < CertificationComparison > ( ) ;
151+ }
146152public record DefaultContent
147153{
148154 public string ? Name { get ; set ; }
0 commit comments