Cleaned up some warnings and implemented re-occuring scan libraries task. Customization of task schedules is in v0.2.

This commit is contained in:
Joseph Milazzo 2021-01-19 14:41:50 -06:00
parent e180032a8e
commit 3c8e4b2240
13 changed files with 20 additions and 58 deletions

View file

@ -39,11 +39,6 @@ namespace API.Data
.WithOne(u => u.Role)
.HasForeignKey(ur => ur.RoleId)
.IsRequired();
// AppUsers have Libraries, not other way around
// builder.Entity<Library>()
// .HasMany(p => p.AppUsers)
// .WithMany(p => p.Libraries)
// .UsingEntity(j => j.ToTable("AppUserLibrary"));
}
void OnEntityTracked(object sender, EntityTrackedEventArgs e)

View file

@ -63,17 +63,6 @@ namespace API.Data
public async Task<IEnumerable<SeriesDto>> GetSeriesDtoForLibraryIdAsync(int libraryId, int userId)
{
// if (userId > 0)
// {
// return await _context.AppUserProgresses
// .Include(p => p.Series)
// .Where(p => p.AppUserId == userId && p.Series.LibraryId == libraryId)
// .Select(p => p.Series)
// .ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
// //.Select(s => s.PagesRead = )
// .ToListAsync();
// }
var sw = Stopwatch.StartNew();
var series = await _context.Series
.Where(s => s.LibraryId == libraryId)

View file

@ -20,7 +20,7 @@ namespace API.Data
}
public ISeriesRepository SeriesRepository => new SeriesRepository(_context, _mapper);
public IUserRepository UserRepository => new UserRepository(_context, _mapper, _userManager);
public IUserRepository UserRepository => new UserRepository(_context, _userManager);
public ILibraryRepository LibraryRepository => new LibraryRepository(_context, _mapper);
public async Task<bool> Complete()

View file

@ -5,8 +5,6 @@ using API.Constants;
using API.DTOs;
using API.Entities;
using API.Interfaces;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
@ -15,13 +13,11 @@ namespace API.Data
public class UserRepository : IUserRepository
{
private readonly DataContext _context;
private readonly IMapper _mapper;
private readonly UserManager<AppUser> _userManager;
public UserRepository(DataContext context, IMapper mapper, UserManager<AppUser> userManager)
public UserRepository(DataContext context, UserManager<AppUser> userManager)
{
_context = context;
_mapper = mapper;
_userManager = userManager;
}
@ -77,13 +73,5 @@ namespace API.Data
.AsNoTracking()
.ToListAsync();
}
// public async Task<MemberDto> GetMemberAsync(string username)
// {
// return await _context.Users.Where(x => x.UserName == username)
// .Include(x => x.Libraries)
// .ProjectTo<MemberDto>(_mapper.ConfigurationProvider)
// .SingleOrDefaultAsync();
// }
}
}