Skip to content

Commit ee07899

Browse files
committed
ECER-4383: API endpoint Layer of Static Contents added to Metadata infrastructure
1 parent c9da128 commit ee07899

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ public void Register(IEndpointRouteBuilder endpointRouteBuilder)
2828
.WithOpenApi("Handles province queries", string.Empty, "province_get")
2929
.CacheOutput(p => p.Expire(TimeSpan.FromMinutes(5)));
3030

31+
32+
endpointRouteBuilder.MapGet("/api/defaultContents", async (HttpContext ctx, IMediator messageBus, IMapper mapper, CancellationToken ct) =>
33+
{
34+
var results = await messageBus.Send(new DefaultContentsQuery(), ct);
35+
return TypedResults.Ok(mapper.Map<IEnumerable<DefaultContent>>(results.Items));
36+
})
37+
.WithOpenApi("Handles default contents", string.Empty, "defaultContent_get")
38+
.CacheOutput(p => p.Expire(TimeSpan.FromMinutes(5)));
39+
3140
endpointRouteBuilder.MapGet("/api/countrylist", async (HttpContext ctx, IMediator messageBus, IMapper mapper, CancellationToken ct) =>
3241
{
3342
var results = await messageBus.Send(new CountriesQuery(), ct);
@@ -134,3 +143,9 @@ public record ComparisonRecord()
134143
public OutOfProvinceCertificationType? TransferringCertificate { get; set; }
135144
public IEnumerable<CertificationComparison> Options { get; set; } = Array.Empty<CertificationComparison>();
136145
}
146+
public record DefaultContent
147+
{
148+
public string? Name { get; set; }
149+
public string? SingleText { get; set; }
150+
public string? MultiText { get; set; }
151+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ public ConfigurationMapper()
1414
CreateMap<Managers.Admin.Contract.Metadatas.OutOfProvinceCertificationType, OutOfProvinceCertificationType>().ReverseMap();
1515
CreateMap<Managers.Admin.Contract.Metadatas.CertificationComparison, CertificationComparison>().ReverseMap();
1616
CreateMap<Managers.Admin.Contract.Metadatas.ComparisonRecord, ComparisonRecord>().ReverseMap();
17+
CreateMap<Managers.Admin.Contract.Metadatas.DefaultContent, DefaultContent>().ReverseMap();
1718
}
1819
}

0 commit comments

Comments
 (0)