diff --git a/services/Directory/FilterLists.Directory.Api.Contracts/Models/ListVm.cs b/services/Directory/FilterLists.Directory.Api.Contracts/Models/ListVm.cs index 7a1611e17..6c8087fd9 100644 --- a/services/Directory/FilterLists.Directory.Api.Contracts/Models/ListVm.cs +++ b/services/Directory/FilterLists.Directory.Api.Contracts/Models/ListVm.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; namespace FilterLists.Directory.Api.Contracts.Models { @@ -11,6 +12,7 @@ public class ListVm public IEnumerable? SyntaxIds { get; init; } public IEnumerable? Iso6391s { get; init; } public IEnumerable? TagIds { get; init; } + public Uri? PrimaryViewUrl { get; init; } public IEnumerable? MaintainerIds { get; init; } } } diff --git a/services/Directory/FilterLists.Directory.Application/Queries/GetLists.cs b/services/Directory/FilterLists.Directory.Application/Queries/GetLists.cs index f0adc8aac..2d86e749c 100644 --- a/services/Directory/FilterLists.Directory.Application/Queries/GetLists.cs +++ b/services/Directory/FilterLists.Directory.Application/Queries/GetLists.cs @@ -54,6 +54,10 @@ public ListVmProfile() .ForMember(fl => fl.TagIds, o => o.MapFrom(fl => fl.FilterListTags.Select(flt => flt.TagId).OrderBy(tid => tid).AsEnumerable())) + .ForMember(fl => fl.PrimaryViewUrl, + o => o.MapFrom(fl => + fl.ViewUrls.OrderBy(u => u.SegmentNumber).ThenBy(u => u.Primariness).Select(u => u.Url) + .FirstOrDefault())) .ForMember(fl => fl.MaintainerIds, o => o.MapFrom(fl => fl.FilterListMaintainers.Select(flm => flm.MaintainerId).OrderBy(mid => mid)