mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
* Implemented the ability to perform multi-selections on cards. Basic selection code is done, CSS needed and exposing actions. * Implemented a bulk selection bar. Added logic to the card on when to force show checkboxes. * Fixed some bad parsing groups and cases for Comic Chapters. * Hooked up some bulk actions on series detail page. Not hooked up to backend yet. * Fixes #593. URI Enocde library names as sometimes they can have & in them. * Implemented the ability to mark volume/chapters as read/unread. * Hooked up mark as unread with specials as well. * Add to reading list hooked up for Series Detail * Implemented ability to add multiple series to a reading list. * Implemented bulk selection for series cards * Added comments to the new code in ReaderService.cs * Implemented proper styling on bulk operation bar and integrated for collections. * Fixed an issue with shift clicking * Cleaned up css of bulk operations bar * Code cleanup
57 lines
1.6 KiB
C#
57 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using API.DTOs;
|
|
using API.DTOs.Reader;
|
|
using API.Entities;
|
|
using API.Interfaces.Repositories;
|
|
using AutoMapper;
|
|
using AutoMapper.QueryableExtensions;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace API.Data.Repositories
|
|
{
|
|
public class VolumeRepository : IVolumeRepository
|
|
{
|
|
private readonly DataContext _context;
|
|
|
|
public VolumeRepository(DataContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public void Update(Volume volume)
|
|
{
|
|
_context.Entry(volume).State = EntityState.Modified;
|
|
}
|
|
|
|
public async Task<IList<MangaFile>> GetFilesForVolume(int volumeId)
|
|
{
|
|
return await _context.Chapter
|
|
.Where(c => volumeId == c.VolumeId)
|
|
.Include(c => c.Files)
|
|
.SelectMany(c => c.Files)
|
|
.AsNoTracking()
|
|
.ToListAsync();
|
|
}
|
|
|
|
public async Task<string> GetVolumeCoverImageAsync(int volumeId)
|
|
{
|
|
return await _context.Volume
|
|
.Where(v => v.Id == volumeId)
|
|
.Select(v => v.CoverImage)
|
|
.AsNoTracking()
|
|
.SingleOrDefaultAsync();
|
|
}
|
|
|
|
public async Task<IList<int>> GetChapterIdsByVolumeIds(IReadOnlyList<int> volumeIds)
|
|
{
|
|
return await _context.Chapter
|
|
.Where(c => volumeIds.Contains(c.VolumeId))
|
|
.Select(c => c.Id)
|
|
.ToListAsync();
|
|
}
|
|
}
|
|
}
|