37 lines
1.5 KiB
C#
37 lines
1.5 KiB
C#
using BackOffice.BFF.Application.ConfigurationCQ.Queries.GetAllConfigurations;
|
|
using Foursat.BackOffice.BFF.Configuration.Protos;
|
|
using Google.Protobuf.WellKnownTypes;
|
|
using BackOffice.BFF.Protobuf.Common;
|
|
|
|
namespace BackOffice.BFF.WebApi.Common.Mappings;
|
|
|
|
public class ConfigurationProfile : IRegister
|
|
{
|
|
void IRegister.Register(TypeAdapterConfig config)
|
|
{
|
|
// GetAllConfigurationsResponseDto -> GetAllConfigurationsResponse
|
|
config.NewConfig<GetAllConfigurationsResponseDto, GetAllConfigurationsResponse>()
|
|
.MapWith(src => new GetAllConfigurationsResponse
|
|
{
|
|
MetaData = new BackOffice.BFF.Protobuf.Common.MetaData
|
|
{
|
|
CurrentPage = src.MetaData.CurrentPage,
|
|
PageSize = src.MetaData.PageSize,
|
|
TotalCount = src.MetaData.TotalCount,
|
|
TotalPage = src.MetaData.TotalPages
|
|
},
|
|
Models = { src.Models.Select(m => new ConfigurationModel
|
|
{
|
|
Id = m.Id,
|
|
Key = m.Key ?? string.Empty,
|
|
Value = m.Value ?? string.Empty,
|
|
Description = m.Description ?? string.Empty,
|
|
Scope = m.Scope,
|
|
// ScopeDisplay = m.ScopeDisplay ?? string.Empty,
|
|
IsActive = m.IsActive,
|
|
Created = Timestamp.FromDateTime(DateTime.SpecifyKind(m.Created, DateTimeKind.Utc))
|
|
}) }
|
|
});
|
|
}
|
|
}
|