mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
feat(directory): ✨ flesh out GetLanguages query
This commit is contained in:
parent
734b7d4e5f
commit
d00e911794
1 changed files with 7 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
|
|
@ -32,6 +33,8 @@ public async Task<IEnumerable<LanguageViewModel>> Handle(
|
|||
CancellationToken cancellationToken)
|
||||
{
|
||||
return await _context.Languages
|
||||
.Where(l => l.FilterListLanguages.Any())
|
||||
.OrderBy(l => l.Iso6391)
|
||||
.ProjectTo<LanguageViewModel>(_mapper.ConfigurationProvider)
|
||||
.ToListAsync(cancellationToken);
|
||||
}
|
||||
|
|
@ -41,7 +44,10 @@ public class LicenseViewModelProfile : Profile
|
|||
{
|
||||
public LicenseViewModelProfile()
|
||||
{
|
||||
CreateMap<Language, LanguageViewModel>();
|
||||
CreateMap<Language, LanguageViewModel>()
|
||||
.ForMember(l => l.FilterListIds,
|
||||
o => o.MapFrom(l =>
|
||||
l.FilterListLanguages.Select(fll => fll.FilterListId).OrderBy(flid => flid)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue