Browse Source

Merge pull request #615 from colinin/fix-dto-mapping

fix: fixed dto mapping field.
pull/645/head
yx lin 4 years ago
committed by GitHub
parent
commit
61980c4705
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 35
      aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationMapperProfile.cs

35
aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationMapperProfile.cs

@ -1,4 +1,7 @@
using AutoMapper;
using System.Collections.Generic;
using System;
using Newtonsoft.Json;
namespace LINGYUN.Abp.WebhooksManagement;
@ -7,6 +10,36 @@ public class WebhooksManagementApplicationMapperProfile : Profile
public WebhooksManagementApplicationMapperProfile()
{
CreateMap<WebhookEventRecord, WebhookEventRecordDto>();
CreateMap<WebhookSendRecord, WebhookSendRecordDto>();
CreateMap<WebhookSendRecord, WebhookSendRecordDto>()
.ForMember(dto => dto.RequestHeaders, map => map.MapFrom((src, dto) =>
{
var result = new Dictionary<string, string>();
if (src.RequestHeaders.IsNullOrWhiteSpace())
{
try
{
result = JsonConvert.DeserializeObject< Dictionary<string, string>>(src.RequestHeaders);
}
catch { }
}
return result;
}))
.ForMember(dto => dto.ResponseHeaders, map => map.MapFrom((src, dto) =>
{
var result = new Dictionary<string, string>();
if (src.ResponseHeaders.IsNullOrWhiteSpace())
{
try
{
result = JsonConvert.DeserializeObject<Dictionary<string, string>>(src.ResponseHeaders);
}
catch { }
}
return result;
}));
}
}

Loading…
Cancel
Save