mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
add Languages to List summary API endpoint
This commit is contained in:
parent
15a39e31d2
commit
f05ad24d33
2 changed files with 13 additions and 3 deletions
|
|
@ -1,8 +1,11 @@
|
|||
namespace FilterLists.Services.FilterListService
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FilterLists.Services.FilterListService
|
||||
{
|
||||
public class FilterListSummaryDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public IEnumerable<string> Languages { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ViewUrl { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,15 @@ public class MappingProfiles : Profile
|
|||
public MappingProfiles()
|
||||
{
|
||||
CreateMap<FilterList, FilterListDetailsDto>()
|
||||
.ForMember(d => d.Languages,
|
||||
opt => opt.MapFrom(c => c.FilterListLanguages.Select(x => x.Language.Name)));
|
||||
.ForMember(dto => dto.Languages,
|
||||
conf => conf.MapFrom(list =>
|
||||
list.FilterListLanguages.Select(listLangs => listLangs.Language.Name)));
|
||||
|
||||
//TODO: improve performance (https://stackoverflow.com/q/48897083/2343739)
|
||||
CreateMap<FilterList, FilterListSummaryDto>()
|
||||
.ForMember(dto => dto.Languages,
|
||||
conf => conf.MapFrom(list =>
|
||||
list.FilterListLanguages.Select(listLangs => listLangs.Language.Name)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue