mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-03 21:54:26 -04:00
Fix ancestors (#13827)
This commit is contained in:
parent
0e7ae0e9a4
commit
de3d1445c0
@ -2090,7 +2090,7 @@ public sealed class BaseItemRepository
|
|||||||
if (!string.IsNullOrWhiteSpace(filter.AncestorWithPresentationUniqueKey))
|
if (!string.IsNullOrWhiteSpace(filter.AncestorWithPresentationUniqueKey))
|
||||||
{
|
{
|
||||||
baseQuery = baseQuery
|
baseQuery = baseQuery
|
||||||
.Where(e => context.BaseItems.Where(f => f.PresentationUniqueKey == filter.AncestorWithPresentationUniqueKey).Any(f => f.ParentAncestors!.Any(w => w.ItemId == f.Id)));
|
.Where(e => context.BaseItems.Where(f => f.PresentationUniqueKey == filter.AncestorWithPresentationUniqueKey).Any(f => f.Children!.Any(w => w.ItemId == e.Id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(filter.SeriesPresentationUniqueKey))
|
if (!string.IsNullOrWhiteSpace(filter.SeriesPresentationUniqueKey))
|
||||||
@ -2125,7 +2125,7 @@ public sealed class BaseItemRepository
|
|||||||
{
|
{
|
||||||
baseQuery = baseQuery
|
baseQuery = baseQuery
|
||||||
.Where(e =>
|
.Where(e =>
|
||||||
e.ParentAncestors!
|
e.Parents!
|
||||||
.Any(f =>
|
.Any(f =>
|
||||||
f.ParentItem.ItemValues!.Any(w => w.ItemValue.Type == ItemValueType.Tags && filter.IncludeInheritedTags.Contains(w.ItemValue.CleanValue))
|
f.ParentItem.ItemValues!.Any(w => w.ItemValue.Type == ItemValueType.Tags && filter.IncludeInheritedTags.Contains(w.ItemValue.CleanValue))
|
||||||
|| e.Data!.Contains($"OwnerUserId\":\"{filter.User!.Id:N}\"")));
|
|| e.Data!.Contains($"OwnerUserId\":\"{filter.User!.Id:N}\"")));
|
||||||
@ -2134,7 +2134,7 @@ public sealed class BaseItemRepository
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
baseQuery = baseQuery
|
baseQuery = baseQuery
|
||||||
.Where(e => e.ParentAncestors!.Any(f => f.ParentItem.ItemValues!.Any(w => w.ItemValue.Type == ItemValueType.Tags && filter.IncludeInheritedTags.Contains(w.ItemValue.CleanValue))));
|
.Where(e => e.Parents!.Any(f => f.ParentItem.ItemValues!.Any(w => w.ItemValue.Type == ItemValueType.Tags && filter.IncludeInheritedTags.Contains(w.ItemValue.CleanValue))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ public class BaseItemEntity
|
|||||||
|
|
||||||
public ICollection<BaseItemProvider>? Provider { get; set; }
|
public ICollection<BaseItemProvider>? Provider { get; set; }
|
||||||
|
|
||||||
public ICollection<AncestorId>? ParentAncestors { get; set; }
|
public ICollection<AncestorId>? Parents { get; set; }
|
||||||
|
|
||||||
public ICollection<AncestorId>? Children { get; set; }
|
public ICollection<AncestorId>? Children { get; set; }
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ public class AncestorIdConfiguration : IEntityTypeConfiguration<AncestorId>
|
|||||||
{
|
{
|
||||||
builder.HasKey(e => new { e.ItemId, e.ParentItemId });
|
builder.HasKey(e => new { e.ItemId, e.ParentItemId });
|
||||||
builder.HasIndex(e => e.ParentItemId);
|
builder.HasIndex(e => e.ParentItemId);
|
||||||
builder.HasOne(e => e.ParentItem).WithMany(e => e.ParentAncestors).HasForeignKey(f => f.ParentItemId);
|
builder.HasOne(e => e.ParentItem).WithMany(e => e.Children).HasForeignKey(f => f.ParentItemId);
|
||||||
builder.HasOne(e => e.Item).WithMany(e => e.Children).HasForeignKey(f => f.ItemId);
|
builder.HasOne(e => e.Item).WithMany(e => e.Parents).HasForeignKey(f => f.ItemId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ public class BaseItemConfiguration : IEntityTypeConfiguration<BaseItemEntity>
|
|||||||
builder.HasMany(e => e.MediaStreams);
|
builder.HasMany(e => e.MediaStreams);
|
||||||
builder.HasMany(e => e.Chapters);
|
builder.HasMany(e => e.Chapters);
|
||||||
builder.HasMany(e => e.Provider);
|
builder.HasMany(e => e.Provider);
|
||||||
builder.HasMany(e => e.ParentAncestors);
|
builder.HasMany(e => e.Parents);
|
||||||
builder.HasMany(e => e.Children);
|
builder.HasMany(e => e.Children);
|
||||||
builder.HasMany(e => e.LockedFields);
|
builder.HasMany(e => e.LockedFields);
|
||||||
builder.HasMany(e => e.TrailerTypes);
|
builder.HasMany(e => e.TrailerTypes);
|
||||||
|
1658
src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250401142247_FixAncestors.Designer.cs
generated
Normal file
1658
src/Jellyfin.Database/Jellyfin.Database.Providers.Sqlite/Migrations/20250401142247_FixAncestors.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,20 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class FixAncestors : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1405,13 +1405,13 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AncestorId", b =>
|
modelBuilder.Entity("Jellyfin.Database.Implementations.Entities.AncestorId", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
|
b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "Item")
|
||||||
.WithMany("Children")
|
.WithMany("Parents")
|
||||||
.HasForeignKey("ItemId")
|
.HasForeignKey("ItemId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "ParentItem")
|
b.HasOne("Jellyfin.Database.Implementations.Entities.BaseItemEntity", "ParentItem")
|
||||||
.WithMany("ParentAncestors")
|
.WithMany("Children")
|
||||||
.HasForeignKey("ParentItemId")
|
.HasForeignKey("ParentItemId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
@ -1642,7 +1642,7 @@ namespace Jellyfin.Server.Implementations.Migrations
|
|||||||
|
|
||||||
b.Navigation("MediaStreams");
|
b.Navigation("MediaStreams");
|
||||||
|
|
||||||
b.Navigation("ParentAncestors");
|
b.Navigation("Parents");
|
||||||
|
|
||||||
b.Navigation("Peoples");
|
b.Navigation("Peoples");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user