feat(directory): flesh out GetTags query

This commit is contained in:
Collin M. Barrett 2020-08-28 15:17:33 -05:00
parent c2b348dfb9
commit f57d435b7a

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AutoMapper;
@ -32,6 +33,7 @@ public async Task<IEnumerable<TagViewModel>> Handle(
CancellationToken cancellationToken)
{
return await _context.Tags
.OrderBy(t => t.Id)
.ProjectTo<TagViewModel>(_mapper.ConfigurationProvider)
.ToListAsync(cancellationToken);
}
@ -41,7 +43,10 @@ public class TagViewModelProfile : Profile
{
public TagViewModelProfile()
{
CreateMap<Tag, TagViewModel>();
CreateMap<Tag, TagViewModel>()
.ForMember(t => t.FilterListIds,
o => o.MapFrom(t =>
t.FilterListTags.Select(flt => flt.FilterListId).OrderBy(flid => flid)));
}
}