mirror of
				https://github.com/Kareadita/Kavita.git
				synced 2025-10-31 02:27:04 -04:00 
			
		
		
		
	* Fixed an issue from perf tuning where I forgot to send Pages to frontend, breaking reader. * Built out continuous reading for webtoon reader. Still has some issues with triggering. * Refactored GetUserByUsernameAsync to have a new flavor and allow the caller to pass in bitwise flags for what to include. This has a get by username or id variant. Code is much cleaner and snappier as we avoid many extra joins when not needed. * Cleanup old code from UserRepository.cs * Refactored OPDS to use faster API lookups for User * Refactored more code to be cleaner and faster. * Refactored GetNext/Prev ChapterIds to ReaderService. * Refactored Repository methods to their correct entity repos. * Refactored DTOs and overall cleanup of the code. * Added ability to press 'b' to bookmark a page * On hitting last page, save progress forcing last page to be read. Adjusted logic for the top and bottom spacers for triggering next/prev chapter load * When at top or moving between chapters, scrolling down then up will now trigger page load. Show a toastr to inform the user of a change in chapter (it can be really fast to switch) * Cleaned up scroll code * Fixed an issue where loading a chapter with last page bookmarked, we'd load lastpage - 1 * Fixed last page of webtoon reader not being resumed on loading said chapter due to a difference in how max page is handled between infinite scroller and manga reader. * Removed some comments * Book reader shouldn't look at left/right tap to paginate elems for position bookmarking. Missed a few areas for saving while in incognito mode * Added a benchmark to test out a sort code * Updated the read status on reading list to use same style as other places * Refactored GetNextChapterId to bring the average response time from 1.2 seconds to 400ms. * Added a filter to add to list when there are more than 5 reading lists * Added download reading list (will be removed, just saving for later). Fixes around styling on reading lists * Removed ability to download reading lists * Tweaked the logic for infinite scroller to be much smoother loading next/prev chapter. Added a bug marker for a concurrency bug. * Updated the top spacer so that when you hit the top, you stay at the page height and can now just scroll up. * Got the logic for scrolling up. Now just need the CSS then cont infinite scroller will be working * More polishing on infinite scroller * Removed IsSpecial on volumeDto, which is not used anywhere. * Cont Reading inf scroller edition is done. * Code smells and fixed package.json explore script
		
			
				
	
	
		
			84 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System.Threading.Tasks;
 | |
| using API.Data.Repositories;
 | |
| using API.Entities;
 | |
| using API.Interfaces;
 | |
| using API.Interfaces.Repositories;
 | |
| using AutoMapper;
 | |
| using Microsoft.AspNetCore.Identity;
 | |
| 
 | |
| namespace API.Data
 | |
| {
 | |
|     public class UnitOfWork : IUnitOfWork
 | |
|     {
 | |
|         private readonly DataContext _context;
 | |
|         private readonly IMapper _mapper;
 | |
|         private readonly UserManager<AppUser> _userManager;
 | |
| 
 | |
|         public UnitOfWork(DataContext context, IMapper mapper, UserManager<AppUser> userManager)
 | |
|         {
 | |
|             _context = context;
 | |
|             _mapper = mapper;
 | |
|             _userManager = userManager;
 | |
|         }
 | |
| 
 | |
|         public ISeriesRepository SeriesRepository => new SeriesRepository(_context, _mapper);
 | |
|         public IUserRepository UserRepository => new UserRepository(_context, _userManager, _mapper);
 | |
|         public ILibraryRepository LibraryRepository => new LibraryRepository(_context, _mapper);
 | |
| 
 | |
|         public IVolumeRepository VolumeRepository => new VolumeRepository(_context);
 | |
| 
 | |
|         public ISettingsRepository SettingsRepository => new SettingsRepository(_context, _mapper);
 | |
| 
 | |
|         public IAppUserProgressRepository AppUserProgressRepository => new AppUserProgressRepository(_context);
 | |
|         public ICollectionTagRepository CollectionTagRepository => new CollectionTagRepository(_context, _mapper);
 | |
|         public IFileRepository FileRepository => new FileRepository(_context);
 | |
|         public IChapterRepository ChapterRepository => new ChapterRepository(_context, _mapper);
 | |
|         public IReadingListRepository ReadingListRepository => new ReadingListRepository(_context, _mapper);
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Commits changes to the DB. Completes the open transaction.
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public bool Commit()
 | |
|         {
 | |
|             return _context.SaveChanges() > 0;
 | |
|         }
 | |
|         /// <summary>
 | |
|         /// Commits changes to the DB. Completes the open transaction.
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public async Task<bool> CommitAsync()
 | |
|         {
 | |
|             return await _context.SaveChangesAsync() > 0;
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Is the DB Context aware of Changes in loaded entities
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public bool HasChanges()
 | |
|         {
 | |
|             return _context.ChangeTracker.HasChanges();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Rollback transaction
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public async Task<bool> RollbackAsync()
 | |
|         {
 | |
|             await _context.DisposeAsync();
 | |
|             return true;
 | |
|         }
 | |
|         /// <summary>
 | |
|         /// Rollback transaction
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public bool Rollback()
 | |
|         {
 | |
|             _context.Dispose();
 | |
|             return true;
 | |
|         }
 | |
|     }
 | |
| }
 |