Polish 4 (#3577)
Co-authored-by: Zeoic <zeorgaming@gmail.com> Co-authored-by: Fesaa <77553571+Fesaa@users.noreply.github.com>
This commit is contained in:
parent
b38400c092
commit
0ffe0228e5
30 changed files with 339 additions and 115 deletions
|
@ -213,9 +213,10 @@ public class ExternalSeriesMetadataRepository : IExternalSeriesMetadataRepositor
|
|||
{
|
||||
return await _context.Series
|
||||
.Where(s => !ExternalMetadataService.NonEligibleLibraryTypes.Contains(s.Library.Type))
|
||||
.WhereIf(includeStaleData, s => s.ExternalSeriesMetadata == null || s.ExternalSeriesMetadata.ValidUntilUtc < DateTime.UtcNow)
|
||||
.Where(s => s.ExternalSeriesMetadata == null || s.ExternalSeriesMetadata.ValidUntilUtc == DateTime.MinValue)
|
||||
.Where(s => s.Library.AllowMetadataMatching)
|
||||
.WhereIf(includeStaleData, s => s.ExternalSeriesMetadata == null || s.ExternalSeriesMetadata.ValidUntilUtc < DateTime.UtcNow)
|
||||
.Where(s => s.ExternalSeriesMetadata == null || s.ExternalSeriesMetadata.AniListId == 0)
|
||||
.Where(s => !s.IsBlacklisted && !s.DontMatch)
|
||||
.OrderByDescending(s => s.Library.Type)
|
||||
.ThenBy(s => s.NormalizedName)
|
||||
.Select(s => s.Id)
|
||||
|
@ -229,6 +230,7 @@ public class ExternalSeriesMetadataRepository : IExternalSeriesMetadataRepositor
|
|||
.Include(s => s.Library)
|
||||
.Include(s => s.ExternalSeriesMetadata)
|
||||
.Where(s => !ExternalMetadataService.NonEligibleLibraryTypes.Contains(s.Library.Type))
|
||||
.Where(s => s.Library.AllowMetadataMatching)
|
||||
.FilterMatchState(filter.MatchStateOption)
|
||||
.OrderBy(s => s.NormalizedName)
|
||||
.ProjectTo<ManageMatchSeriesDto>(_mapper.ConfigurationProvider)
|
||||
|
|
|
@ -18,6 +18,7 @@ using Kavita.Common.Extensions;
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace API.Data.Repositories;
|
||||
#nullable enable
|
||||
|
||||
[Flags]
|
||||
public enum LibraryIncludes
|
||||
|
@ -260,7 +261,7 @@ public class LibraryRepository : ILibraryRepository
|
|||
public async Task<IList<LanguageDto>> GetAllLanguagesForLibrariesAsync(List<int>? libraryIds)
|
||||
{
|
||||
var ret = await _context.Series
|
||||
.WhereIf(libraryIds is {Count: > 0} , s => libraryIds.Contains(s.LibraryId))
|
||||
.WhereIf(libraryIds is {Count: > 0} , s => libraryIds!.Contains(s.LibraryId))
|
||||
.Select(s => s.Metadata.Language)
|
||||
.AsSplitQuery()
|
||||
.AsNoTracking()
|
||||
|
|
|
@ -19,11 +19,13 @@ public interface IScrobbleRepository
|
|||
void Attach(ScrobbleError error);
|
||||
void Remove(ScrobbleEvent evt);
|
||||
void Remove(IEnumerable<ScrobbleEvent> events);
|
||||
void Remove(IEnumerable<ScrobbleError> errors);
|
||||
void Update(ScrobbleEvent evt);
|
||||
Task<IList<ScrobbleEvent>> GetByEvent(ScrobbleEventType type, bool isProcessed = false);
|
||||
Task<IList<ScrobbleEvent>> GetProcessedEvents(int daysAgo);
|
||||
Task<bool> Exists(int userId, int seriesId, ScrobbleEventType eventType);
|
||||
Task<IEnumerable<ScrobbleErrorDto>> GetScrobbleErrors();
|
||||
Task<IList<ScrobbleError>> GetAllScrobbleErrorsForSeries(int seriesId);
|
||||
Task ClearScrobbleErrors();
|
||||
Task<bool> HasErrorForSeries(int seriesId);
|
||||
Task<ScrobbleEvent?> GetEvent(int userId, int seriesId, ScrobbleEventType eventType);
|
||||
|
@ -66,6 +68,11 @@ public class ScrobbleRepository : IScrobbleRepository
|
|||
_context.ScrobbleEvent.RemoveRange(events);
|
||||
}
|
||||
|
||||
public void Remove(IEnumerable<ScrobbleError> errors)
|
||||
{
|
||||
_context.ScrobbleError.RemoveRange(errors);
|
||||
}
|
||||
|
||||
public void Update(ScrobbleEvent evt)
|
||||
{
|
||||
_context.Entry(evt).State = EntityState.Modified;
|
||||
|
@ -113,6 +120,13 @@ public class ScrobbleRepository : IScrobbleRepository
|
|||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IList<ScrobbleError>> GetAllScrobbleErrorsForSeries(int seriesId)
|
||||
{
|
||||
return await _context.ScrobbleError
|
||||
.Where(e => e.SeriesId == seriesId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task ClearScrobbleErrors()
|
||||
{
|
||||
_context.ScrobbleError.RemoveRange(_context.ScrobbleError);
|
||||
|
@ -161,4 +175,5 @@ public class ScrobbleRepository : IScrobbleRepository
|
|||
return await _context.ScrobbleEvent.Where(e => e.SeriesId == seriesId)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -276,18 +276,18 @@ public static class Seed
|
|||
await context.SaveChangesAsync();
|
||||
|
||||
// Port, IpAddresses and LoggingLevel are managed in appSettings.json. Update the DB values to match
|
||||
context.ServerSetting.First(s => s.Key == ServerSettingKey.Port).Value =
|
||||
(await context.ServerSetting.FirstAsync(s => s.Key == ServerSettingKey.Port)).Value =
|
||||
Configuration.Port + string.Empty;
|
||||
context.ServerSetting.First(s => s.Key == ServerSettingKey.IpAddresses).Value =
|
||||
(await context.ServerSetting.FirstAsync(s => s.Key == ServerSettingKey.IpAddresses)).Value =
|
||||
Configuration.IpAddresses;
|
||||
context.ServerSetting.First(s => s.Key == ServerSettingKey.CacheDirectory).Value =
|
||||
(await context.ServerSetting.FirstAsync(s => s.Key == ServerSettingKey.CacheDirectory)).Value =
|
||||
directoryService.CacheDirectory + string.Empty;
|
||||
context.ServerSetting.First(s => s.Key == ServerSettingKey.BackupDirectory).Value =
|
||||
(await context.ServerSetting.FirstAsync(s => s.Key == ServerSettingKey.BackupDirectory)).Value =
|
||||
DirectoryService.BackupDirectory + string.Empty;
|
||||
context.ServerSetting.First(s => s.Key == ServerSettingKey.CacheSize).Value =
|
||||
(await context.ServerSetting.FirstAsync(s => s.Key == ServerSettingKey.CacheSize)).Value =
|
||||
Configuration.CacheSize + string.Empty;
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public static async Task SeedMetadataSettings(DataContext context)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue