A few more bug fixes (#3876)
Co-authored-by: Joseph Milazzo <joseph.v.milazzo@gmail.com>
This commit is contained in:
parent
4b9bbc5d78
commit
d909e03baf
21 changed files with 3940 additions and 45 deletions
|
|
@ -4,7 +4,6 @@ using System.Linq;
|
|||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using API.DTOs.KavitaPlus.Metadata;
|
||||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Entities.Enums.UserPreferences;
|
||||
|
|
@ -18,7 +17,6 @@ using Microsoft.AspNetCore.Identity;
|
|||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
|
||||
namespace API.Data;
|
||||
|
||||
|
|
@ -43,7 +41,7 @@ public sealed class DataContext : IdentityDbContext<AppUser, AppRole, int,
|
|||
public DbSet<ServerSetting> ServerSetting { get; set; } = null!;
|
||||
public DbSet<AppUserPreferences> AppUserPreferences { get; set; } = null!;
|
||||
public DbSet<SeriesMetadata> SeriesMetadata { get; set; } = null!;
|
||||
[Obsolete]
|
||||
[Obsolete("Use AppUserCollection")]
|
||||
public DbSet<CollectionTag> CollectionTag { get; set; } = null!;
|
||||
public DbSet<AppUserBookmark> AppUserBookmark { get; set; } = null!;
|
||||
public DbSet<ReadingList> ReadingList { get; set; } = null!;
|
||||
|
|
@ -72,7 +70,7 @@ public sealed class DataContext : IdentityDbContext<AppUser, AppRole, int,
|
|||
public DbSet<ExternalSeriesMetadata> ExternalSeriesMetadata { get; set; } = null!;
|
||||
public DbSet<ExternalRecommendation> ExternalRecommendation { get; set; } = null!;
|
||||
public DbSet<ManualMigrationHistory> ManualMigrationHistory { get; set; } = null!;
|
||||
[Obsolete]
|
||||
[Obsolete("Use IsBlacklisted field on Series")]
|
||||
public DbSet<SeriesBlacklist> SeriesBlacklist { get; set; } = null!;
|
||||
public DbSet<AppUserCollection> AppUserCollection { get; set; } = null!;
|
||||
public DbSet<ChapterPeople> ChapterPeople { get; set; } = null!;
|
||||
|
|
@ -286,6 +284,22 @@ public sealed class DataContext : IdentityDbContext<AppUser, AppRole, int,
|
|||
v => JsonSerializer.Serialize(v, JsonSerializerOptions.Default),
|
||||
v => JsonSerializer.Deserialize<List<int>>(v, JsonSerializerOptions.Default) ?? new List<int>())
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
builder.Entity<SeriesMetadata>()
|
||||
.Property(sm => sm.KPlusOverrides)
|
||||
.HasConversion(
|
||||
v => JsonSerializer.Serialize(v, JsonSerializerOptions.Default),
|
||||
v => JsonSerializer.Deserialize<IList<MetadataSettingField>>(v, JsonSerializerOptions.Default) ??
|
||||
new List<MetadataSettingField>())
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValue(new List<MetadataSettingField>());
|
||||
builder.Entity<Chapter>()
|
||||
.Property(sm => sm.KPlusOverrides)
|
||||
.HasConversion(
|
||||
v => JsonSerializer.Serialize(v, JsonSerializerOptions.Default),
|
||||
v => JsonSerializer.Deserialize<IList<MetadataSettingField>>(v, JsonSerializerOptions.Default) ?? new List<MetadataSettingField>())
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValue(new List<MetadataSettingField>());
|
||||
}
|
||||
|
||||
#nullable enable
|
||||
|
|
|
|||
3721
API/Data/Migrations/20250626162548_TrackKavitaPlusMetadata.Designer.cs
generated
Normal file
3721
API/Data/Migrations/20250626162548_TrackKavitaPlusMetadata.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,40 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace API.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class TrackKavitaPlusMetadata : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "KPlusOverrides",
|
||||
table: "SeriesMetadata",
|
||||
type: "TEXT",
|
||||
nullable: true,
|
||||
defaultValue: "[]");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "KPlusOverrides",
|
||||
table: "Chapter",
|
||||
type: "TEXT",
|
||||
nullable: true,
|
||||
defaultValue: "[]");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "KPlusOverrides",
|
||||
table: "SeriesMetadata");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "KPlusOverrides",
|
||||
table: "Chapter");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using API.Data;
|
||||
using API.Entities.MetadataMatching;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
|
@ -957,6 +959,11 @@ namespace API.Data.Migrations
|
|||
b.Property<bool>("IsSpecial")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("KPlusOverrides")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValue("[]");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
|
|
@ -1683,6 +1690,11 @@ namespace API.Data.Migrations
|
|||
b.Property<bool>("InkerLocked")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("KPlusOverrides")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValue("[]");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
|
|
|
|||
|
|
@ -387,8 +387,8 @@ public class PersonRepository : IPersonRepository
|
|||
|
||||
return await _context.Person
|
||||
.Includes(includes)
|
||||
.Where(p => EF.Functions.Like(p.Name, $"%{searchQuery}%")
|
||||
|| p.Aliases.Any(pa => EF.Functions.Like(pa.Alias, $"%{searchQuery}%")))
|
||||
.Where(p => EF.Functions.Like(p.NormalizedName, $"%{searchQuery}%")
|
||||
|| p.Aliases.Any(pa => EF.Functions.Like(pa.NormalizedAlias, $"%{searchQuery}%")))
|
||||
.ProjectTo<PersonDto>(_mapper.ConfigurationProvider)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ public interface ISeriesRepository
|
|||
void Attach(Series series);
|
||||
void Attach(SeriesRelation relation);
|
||||
void Update(Series series);
|
||||
void Update(SeriesMetadata seriesMetadata);
|
||||
void Remove(Series series);
|
||||
void Remove(IEnumerable<Series> series);
|
||||
void Detach(Series series);
|
||||
|
|
@ -219,6 +220,11 @@ public class SeriesRepository : ISeriesRepository
|
|||
_context.Entry(series).State = EntityState.Modified;
|
||||
}
|
||||
|
||||
public void Update(SeriesMetadata seriesMetadata)
|
||||
{
|
||||
_context.Entry(seriesMetadata).State = EntityState.Modified;
|
||||
}
|
||||
|
||||
public void Remove(Series series)
|
||||
{
|
||||
_context.Series.Remove(series);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue