Dashboard Customization Polish (#2295)
This commit is contained in:
parent
25e759d301
commit
25ffb2ffe1
42 changed files with 255 additions and 258 deletions
|
@ -51,7 +51,6 @@ public interface ILibraryRepository
|
|||
Task<bool> DoAnySeriesFoldersMatch(IEnumerable<string> folders);
|
||||
Task<string?> GetLibraryCoverImageAsync(int libraryId);
|
||||
Task<IList<string>> GetAllCoverImagesAsync();
|
||||
Task<IDictionary<int, LibraryType>> GetLibraryTypesForIdsAsync(IEnumerable<int> libraryIds);
|
||||
Task<IList<Library>> GetAllWithCoversInDifferentEncoding(EncodeFormat encodeFormat);
|
||||
Task<bool> GetAllowsScrobblingBySeriesId(int seriesId);
|
||||
}
|
||||
|
@ -346,28 +345,6 @@ public class LibraryRepository : ILibraryRepository
|
|||
.ToListAsync())!;
|
||||
}
|
||||
|
||||
public async Task<IDictionary<int, LibraryType>> GetLibraryTypesForIdsAsync(IEnumerable<int> libraryIds)
|
||||
{
|
||||
var types = await _context.Library
|
||||
.Where(l => libraryIds.Contains(l.Id))
|
||||
.AsNoTracking()
|
||||
.Select(l => new
|
||||
{
|
||||
LibraryId = l.Id,
|
||||
LibraryType = l.Type
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var dict = new Dictionary<int, LibraryType>();
|
||||
|
||||
foreach (var type in types)
|
||||
{
|
||||
dict.TryAdd(type.LibraryId, type.LibraryType);
|
||||
}
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
public async Task<IList<Library>> GetAllWithCoversInDifferentEncoding(EncodeFormat encodeFormat)
|
||||
{
|
||||
var extension = encodeFormat.GetExtension();
|
||||
|
|
|
@ -9,7 +9,6 @@ namespace API.Data.Repositories;
|
|||
public interface IMangaFileRepository
|
||||
{
|
||||
void Update(MangaFile file);
|
||||
Task<bool> AnyMissingExtension();
|
||||
Task<IList<MangaFile>> GetAllWithMissingExtension();
|
||||
}
|
||||
|
||||
|
@ -27,11 +26,6 @@ public class MangaFileRepository : IMangaFileRepository
|
|||
_context.Entry(file).State = EntityState.Modified;
|
||||
}
|
||||
|
||||
public async Task<bool> AnyMissingExtension()
|
||||
{
|
||||
return (await _context.MangaFile.CountAsync(f => string.IsNullOrEmpty(f.Extension))) > 0;
|
||||
}
|
||||
|
||||
public async Task<IList<MangaFile>> GetAllWithMissingExtension()
|
||||
{
|
||||
return await _context.MangaFile
|
||||
|
|
|
@ -15,7 +15,6 @@ public interface IMediaErrorRepository
|
|||
void Attach(MediaError error);
|
||||
void Remove(MediaError error);
|
||||
Task<MediaError> Find(string filename);
|
||||
Task<PagedList<MediaErrorDto>> GetAllErrorDtosAsync(UserParams userParams);
|
||||
IEnumerable<MediaErrorDto> GetAllErrorDtosAsync();
|
||||
Task<bool> ExistsAsync(MediaError error);
|
||||
Task DeleteAll();
|
||||
|
@ -49,15 +48,6 @@ public class MediaErrorRepository : IMediaErrorRepository
|
|||
return _context.MediaError.Where(e => e.FilePath == filename).SingleOrDefaultAsync();
|
||||
}
|
||||
|
||||
public Task<PagedList<MediaErrorDto>> GetAllErrorDtosAsync(UserParams userParams)
|
||||
{
|
||||
var query = _context.MediaError
|
||||
.OrderByDescending(m => m.Created)
|
||||
.ProjectTo<MediaErrorDto>(_mapper.ConfigurationProvider)
|
||||
.AsNoTracking();
|
||||
return PagedList<MediaErrorDto>.CreateAsync(query, userParams.PageNumber, userParams.PageSize);
|
||||
}
|
||||
|
||||
public IEnumerable<MediaErrorDto> GetAllErrorDtosAsync()
|
||||
{
|
||||
var query = _context.MediaError
|
||||
|
|
|
@ -19,7 +19,7 @@ public interface IPersonRepository
|
|||
Task<IList<Person>> GetAllPeople();
|
||||
Task<IList<PersonDto>> GetAllPersonDtosAsync(int userId);
|
||||
Task<IList<PersonDto>> GetAllPersonDtosByRoleAsync(int userId, PersonRole role);
|
||||
Task RemoveAllPeopleNoLongerAssociated(bool removeExternal = false);
|
||||
Task RemoveAllPeopleNoLongerAssociated();
|
||||
Task<IList<PersonDto>> GetAllPeopleDtosForLibrariesAsync(List<int> libraryIds, int userId);
|
||||
Task<int> GetCountAsync();
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class PersonRepository : IPersonRepository
|
|||
_context.Person.Remove(person);
|
||||
}
|
||||
|
||||
public async Task RemoveAllPeopleNoLongerAssociated(bool removeExternal = false)
|
||||
public async Task RemoveAllPeopleNoLongerAssociated()
|
||||
{
|
||||
var peopleWithNoConnections = await _context.Person
|
||||
.Include(p => p.SeriesMetadatas)
|
||||
|
|
|
@ -18,7 +18,7 @@ public interface IScrobbleRepository
|
|||
void Attach(ScrobbleEvent evt);
|
||||
void Attach(ScrobbleError error);
|
||||
void Remove(ScrobbleEvent evt);
|
||||
void Remove(IList<ScrobbleEvent> evts);
|
||||
void Remove(IEnumerable<ScrobbleEvent> events);
|
||||
void Update(ScrobbleEvent evt);
|
||||
Task<IList<ScrobbleEvent>> GetByEvent(ScrobbleEventType type, bool isProcessed = false);
|
||||
Task<IList<ScrobbleEvent>> GetProcessedEvents(int daysAgo);
|
||||
|
@ -60,9 +60,9 @@ public class ScrobbleRepository : IScrobbleRepository
|
|||
_context.ScrobbleEvent.Remove(evt);
|
||||
}
|
||||
|
||||
public void Remove(IList<ScrobbleEvent> evts)
|
||||
public void Remove(IEnumerable<ScrobbleEvent> events)
|
||||
{
|
||||
_context.ScrobbleEvent.RemoveRange(evts);
|
||||
_context.ScrobbleEvent.RemoveRange(events);
|
||||
}
|
||||
|
||||
public void Update(ScrobbleEvent evt)
|
||||
|
|
|
@ -128,8 +128,6 @@ public interface ISeriesRepository
|
|||
Task<Series?> GetSeriesByFolderPath(string folder, SeriesIncludes includes = SeriesIncludes.None);
|
||||
Task<IEnumerable<Series>> GetAllSeriesByNameAsync(IList<string> normalizedNames,
|
||||
int userId, SeriesIncludes includes = SeriesIncludes.None);
|
||||
Task<IEnumerable<SeriesDto>> GetAllSeriesDtosByNameAsync(IEnumerable<string> normalizedNames,
|
||||
int userId, SeriesIncludes includes = SeriesIncludes.None);
|
||||
Task<Series?> GetFullSeriesByAnyName(string seriesName, string localizedName, int libraryId, MangaFormat format, bool withFullIncludes = true);
|
||||
Task<IList<Series>> RemoveSeriesNotInList(IList<ParsedSeries> seenSeries, int libraryId);
|
||||
Task<IDictionary<string, IList<SeriesModified>>> GetFolderPathMap(int libraryId);
|
||||
|
@ -1054,7 +1052,7 @@ public class SeriesRepository : ISeriesRepository
|
|||
|
||||
private static IQueryable<Series> BuildFilterGroup(int userId, FilterStatementDto statement, IQueryable<Series> query)
|
||||
{
|
||||
var (value, _) = FilterFieldValueConverter.ConvertValue(statement.Field, statement.Value);
|
||||
var value = FilterFieldValueConverter.ConvertValue(statement.Field, statement.Value);
|
||||
return statement.Field switch
|
||||
{
|
||||
FilterField.Summary => query.HasSummary(true, statement.Comparison, (string) value),
|
||||
|
@ -1085,7 +1083,7 @@ public class SeriesRepository : ISeriesRepository
|
|||
FilterField.WantToRead =>
|
||||
// This is handled in the higher level of code as it's more general
|
||||
query,
|
||||
FilterField.ReadProgress => query.HasReadingProgress(true, statement.Comparison, (int) value, userId),
|
||||
FilterField.ReadProgress => query.HasReadingProgress(true, statement.Comparison, (float) value, userId),
|
||||
FilterField.Formats => query.HasFormat(true, statement.Comparison, (IList<MangaFormat>) value),
|
||||
FilterField.ReleaseYear => query.HasReleaseYear(true, statement.Comparison, (int) value),
|
||||
FilterField.ReadTime => query.HasAverageReadTime(true, statement.Comparison, (int) value),
|
||||
|
@ -1471,20 +1469,6 @@ public class SeriesRepository : ISeriesRepository
|
|||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<SeriesDto>> GetAllSeriesDtosByNameAsync(IEnumerable<string> normalizedNames, int userId,
|
||||
SeriesIncludes includes = SeriesIncludes.None)
|
||||
{
|
||||
var libraryIds = _context.Library.GetUserLibraries(userId);
|
||||
var userRating = await _context.AppUser.GetUserAgeRestriction(userId);
|
||||
|
||||
return await _context.Series
|
||||
.Where(s => normalizedNames.Contains(s.NormalizedName))
|
||||
.Where(s => libraryIds.Contains(s.LibraryId))
|
||||
.RestrictAgainstAgeRestriction(userRating)
|
||||
.Includes(includes)
|
||||
.ProjectTo<SeriesDto>(_mapper.ConfigurationProvider)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds a series by series name or localized name for a given library.
|
||||
|
|
|
@ -19,7 +19,6 @@ public interface ISiteThemeRepository
|
|||
Task<SiteThemeDto?> GetThemeDtoByName(string themeName);
|
||||
Task<SiteTheme> GetDefaultTheme();
|
||||
Task<IEnumerable<SiteTheme>> GetThemes();
|
||||
Task<SiteTheme?> GetThemeById(int themeId);
|
||||
}
|
||||
|
||||
public class SiteThemeRepository : ISiteThemeRepository
|
||||
|
@ -89,13 +88,6 @@ public class SiteThemeRepository : ISiteThemeRepository
|
|||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<SiteTheme?> GetThemeById(int themeId)
|
||||
{
|
||||
return await _context.SiteTheme
|
||||
.Where(t => t.Id == themeId)
|
||||
.SingleOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<SiteThemeDto?> GetThemeDto(int themeId)
|
||||
{
|
||||
return await _context.SiteTheme
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface ITagRepository
|
|||
void Remove(Tag tag);
|
||||
Task<IList<Tag>> GetAllTagsAsync();
|
||||
Task<IList<TagDto>> GetAllTagDtosAsync(int userId);
|
||||
Task RemoveAllTagNoLongerAssociated(bool removeExternal = false);
|
||||
Task RemoveAllTagNoLongerAssociated();
|
||||
Task<IList<TagDto>> GetAllTagDtosForLibrariesAsync(IList<int> libraryIds, int userId);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class TagRepository : ITagRepository
|
|||
_context.Tag.Remove(tag);
|
||||
}
|
||||
|
||||
public async Task RemoveAllTagNoLongerAssociated(bool removeExternal = false)
|
||||
public async Task RemoveAllTagNoLongerAssociated()
|
||||
{
|
||||
var tagsWithNoConnections = await _context.Tag
|
||||
.Include(p => p.SeriesMetadatas)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue