public async Task <PaginatedData <StickerPackOutput> > FindAllStickerPacksAsync( StickerPackSorting sorting, StickerPackNameFilter nameFilter, StickerPackClapsFilter clapsFilter, StickerPackTagsFilter tagsFilter, Pagination pagination ) { var stickerPacks = _stickerPackRepository.FindAll(); stickerPacks = ApplySorting(stickerPacks, sorting.SortBy, sorting.SortType); stickerPacks = ApplyNameFilter(stickerPacks, nameFilter); stickerPacks = ApplyClapsFilter(stickerPacks, clapsFilter); stickerPacks = await ApplyTagsFilterAsync(stickerPacks, tagsFilter); var paginatedStickers = await stickerPacks.PaginateAsync(pagination); var result = new PaginatedData <StickerPackOutput>(paginatedStickers.Total, new List <StickerPackOutput>()); foreach (var stickerPack in paginatedStickers.Data) { var stickers = await _tgBot.GetStickerFilesFromPackAsync(stickerPack.Name); var filePath = await _tgBot.GetFilePathAsync(stickerPack.Name, fileId : stickers.First()); result.Data = result.Data.Append(new StickerPackOutput(stickerPack, filePath, stickers.Count())); } return(result); }
public async Task <PaginatedData <StickerPackOutput> > GetAllStickerPacksAsync( [FromQuery] StickerPackSorting sorting, [FromQuery] StickerPackNameFilter nameFilter, [FromQuery] StickerPackClapsFilter clapsFilter, [FromQuery] StickerPackTagsFilter tagsFilter, [FromQuery] Pagination pagination ) { return(await _stickerPackService.FindAllStickerPacksAsync(sorting, nameFilter, clapsFilter, tagsFilter, pagination)); }