From c2bf8fd69a4886997188b05726838ac3c1632d2d Mon Sep 17 00:00:00 2001 From: Parsa Gachkar Date: Tue, 21 Nov 2023 19:27:43 +0330 Subject: [PATCH] update mapping profile --- src/FluentCMS.Api/MappingProfiles.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/FluentCMS.Api/MappingProfiles.cs b/src/FluentCMS.Api/MappingProfiles.cs index e6f36f1c2..5c41fd945 100644 --- a/src/FluentCMS.Api/MappingProfiles.cs +++ b/src/FluentCMS.Api/MappingProfiles.cs @@ -20,15 +20,17 @@ public MappingProfiles() // Page CreateMap(); - CreateMap, List>().ConstructUsing((x, ctx) => + CreateMap, List>() + .ForMember("Item", opt => opt.Ignore()) + .ConstructUsing((x, ctx) => { - return MapPagesWithParentId(x, ctx, null,""); + return MapPagesWithParentId(x, ctx, null, ""); static List MapPagesWithParentId(List x, ResolutionContext ctx, Guid? parentId, string pathPrefix) { var items = ctx.Mapper.Map>(x.Where(x => x.ParentId == parentId)); foreach (var item in items) { - item.Path = string.Join("/", pathPrefix , item.Path); + item.Path = string.Join("/", pathPrefix, item.Path); item.Children = MapPagesWithParentId(x, ctx, item.Id, item.Path); } return items.ToList();