diff --git a/services/directory/src/FilterLists.Directory.Application/Queries/GetLists.cs b/services/directory/src/FilterLists.Directory.Application/Queries/GetLists.cs index 3869dac61..f0cb6d258 100644 --- a/services/directory/src/FilterLists.Directory.Application/Queries/GetLists.cs +++ b/services/directory/src/FilterLists.Directory.Application/Queries/GetLists.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; using AutoMapper; @@ -33,6 +34,7 @@ public async Task> Handle( CancellationToken cancellationToken) { return await _context.FilterLists + .OrderBy(fl => fl.Id) .ProjectTo(_mapper.ConfigurationProvider) .ToListAsync(cancellationToken); } @@ -42,7 +44,37 @@ public class ListViewModelProfile : Profile { public ListViewModelProfile() { - CreateMap(); + CreateMap() + .ForMember(fl => fl.SyntaxIds, + o => o.MapFrom(fl => + fl.FilterListSyntaxes.Select(fls => fls.SyntaxId).OrderBy(sid => sid))) + .ForMember(fl => fl.LanguageIso6391s, + o => o.MapFrom(fl => + fl.FilterListLanguages.Select(fls => fls.Iso6391).OrderBy(i => i))) + .ForMember(fl => fl.TagIds, + o => o.MapFrom(fl => + fl.FilterListTags.Select(flt => flt.TagId).OrderBy(tid => tid))) + .ForMember(fl => fl.MaintainerIds, + o => o.MapFrom(fl => + fl.FilterListMaintainers.Select(flm => flm.MaintainerId).OrderBy(mid => mid))) + .ForMember(fl => fl.UpstreamFilterListIds, + o => o.MapFrom(fl => + fl.UpstreamFilterLists.Select(ufl => ufl.UpstreamFilterListId).OrderBy(flid => flid))) + .ForMember(fl => fl.ForkFilterListIds, + o => o.MapFrom(fl => + fl.ForkFilterLists.Select(ffl => ffl.ForkFilterListId).OrderBy(flid => flid))) + .ForMember(fl => fl.IncludedInFilterListIds, + o => o.MapFrom(fl => + fl.IncludedInFilterLists.Select(iifl => iifl.IncludedInFilterListId).OrderBy(flid => flid))) + .ForMember(fl => fl.IncludesFilterListIds, + o => o.MapFrom(fl => + fl.IncludesFilterLists.Select(ifl => ifl.IncludesFilterListId).OrderBy(flid => flid))) + .ForMember(fl => fl.DependencyFilterListIds, + o => o.MapFrom(fl => + fl.DependencyFilterLists.Select(dfl => dfl.DependencyFilterListId).OrderBy(flid => flid))) + .ForMember(fl => fl.DependentFilterListIds, + o => o.MapFrom(fl => + fl.DependentFilterLists.Select(dfl => dfl.DependentFilterListId).OrderBy(flid => flid))); } } @@ -55,7 +87,7 @@ public class ListViewModel public IEnumerable? SyntaxIds { get; private set; } public IEnumerable? LanguageIso6391s { get; private set; } public IEnumerable? TagIds { get; private set; } - //public IEnumerable? SegmentViewUrls { get; private set; } + //public IEnumerable? SegmentViewUrls { get; private set; } public Uri? HomeUrl { get; private set; } public Uri? OnionUrl { get; private set; } public Uri? PolicyUrl { get; private set; }