temp api fix

This commit is contained in:
Collin M. Barrett 2018-08-23 15:02:56 -05:00
parent 1f121c31a1
commit f2f91fd3ca
2 changed files with 4 additions and 15 deletions

View file

@ -8,24 +8,16 @@ namespace FilterLists.Services.FilterList.MappingProfiles
[UsedImplicitly]
public class ListDetailsDtoMappingProfile : Profile
{
//TODO: fix UpdatedDate to look at most recent snapshot with changes
//TODO: fix UpdatedDate and RuleCount
public ListDetailsDtoMappingProfile() =>
CreateMap<Data.Entities.FilterList, ListDetailsDto>()
.ForMember(d => d.Languages, c => c.MapFrom(l => l.FilterListLanguages.Select(la => la.Language.Name)))
.ForMember(d => d.Maintainers, c => c.MapFrom(l => l.FilterListMaintainers.Select(m => m.Maintainer)))
.ForMember(d => d.Tags, c => c.MapFrom(l => l.FilterListTags.Select(m => m.Tag)))
.ForMember(d => d.RuleCount,
c => c.MapFrom(l =>
l.Snapshots.Where(s => s.WasSuccessful)
.OrderByDescending(s => s.CreatedDateUtc)
.FirstOrDefault()
.SnapshotRules
.Count))
c => c.MapFrom(l => 0))
.ForMember(d => d.UpdatedDate,
c => c.MapFrom(l =>
l.Snapshots.Where(s => s.WasSuccessful)
.OrderByDescending(s => s.CreatedDateUtc)
.FirstOrDefault()
.CreatedDateUtc));
l.ModifiedDateUtc));
}
}

View file

@ -15,9 +15,6 @@ public ListSummaryDtoMappingProfile() =>
.ForMember(d => d.Tags, c => c.MapFrom(l => l.FilterListTags.Select(m => m.Tag)))
.ForMember(d => d.UpdatedDate,
c => c.MapFrom(l =>
l.Snapshots.Where(s => s.WasSuccessful)
.OrderByDescending(s => s.CreatedDateUtc)
.FirstOrDefault()
.CreatedDateUtc));
l.ModifiedDateUtc));
}
}