[ADD] Simple views for accounts and channels

This commit is contained in:
max
2025-09-22 15:50:30 +02:00
parent a7baeb0d73
commit a478943792
10 changed files with 180 additions and 79 deletions

View File

@@ -58,6 +58,9 @@ public sealed class LibraryDbContext : DbContext
.WithOne(x => x.Channel)
.HasForeignKey<ClientAccountEntity>(e => e.Id)
.IsRequired(false);
channel.HasMany(x => x.Files)
.WithOne()
.HasForeignKey(f => f.ForeignKey);
});
modelBuilder.Entity<ClientAccountEntity>(cae =>
@@ -71,6 +74,9 @@ public sealed class LibraryDbContext : DbContext
.WithOne(ca => ca.ClientAccount)
.HasForeignKey<ChannelEntity>(ce => ce.Id)
.IsRequired(false);
cae.HasMany(x => x.Files)
.WithOne()
.HasForeignKey(f => f.ForeignKey);
});
modelBuilder.Entity<HttpCookieEntity>(httpce =>

View File

@@ -17,4 +17,5 @@ public class ChannelEntity : DateTimeBase
public List<MediaEntity> Media { get; set; } = [];
public List<PlaylistEntity> Playlists { get; set; } = [];
public ClientAccountEntity? ClientAccount { get; set; }
public List<FileEntity>? Files { get; set; }
}

View File

@@ -12,4 +12,5 @@ public class ClientAccountEntity : DateTimeBase
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
public string? UserAgent { get; set; }
public ChannelEntity? Channel { get; set; }
public List<FileEntity>? Files { get; set; }
}