Rename watch info to watch status

This commit is contained in:
Zoe Roux 2023-11-13 17:54:55 +01:00
parent b6bb190e69
commit 4f9c06c7bd
5 changed files with 30 additions and 30 deletions

View File

@ -238,16 +238,16 @@ namespace Kyoo.Abstractions.Models
|| (x.SeasonNumber == SeasonNumber && x.EpisodeNumber > EpisodeNumber) || (x.SeasonNumber == SeasonNumber && x.EpisodeNumber > EpisodeNumber)
); );
[SerializeIgnore] public ICollection<EpisodeWatchInfo> Watched { get; set; } [SerializeIgnore] public ICollection<EpisodeWatchStatus> Watched { get; set; }
/// <summary> /// <summary>
/// Metadata of what an user as started/planned to watch. /// Metadata of what an user as started/planned to watch.
/// </summary> /// </summary>
[Projectable(UseMemberBody = nameof(_WatchInfo), OnlyOnInclude = true)] [Projectable(UseMemberBody = nameof(_WatchStatus), OnlyOnInclude = true)]
[LoadableRelation] public EpisodeWatchInfo? WatchInfo { get; set; } [LoadableRelation] public EpisodeWatchStatus? WatchStatus { get; set; }
// There is a global query filter to filter by user so we just need to do single. // There is a global query filter to filter by user so we just need to do single.
private EpisodeWatchInfo? _WatchInfo => Watched.FirstOrDefault(); private EpisodeWatchStatus? _WatchStatus => Watched.FirstOrDefault();
/// <summary> /// <summary>
/// Links to watch this episode. /// Links to watch this episode.

View File

@ -146,16 +146,16 @@ namespace Kyoo.Abstractions.Models
Hls = $"/video/movie/{Slug}/master.m3u8", Hls = $"/video/movie/{Slug}/master.m3u8",
}; };
[SerializeIgnore] public ICollection<MovieWatchInfo> Watched { get; set; } [SerializeIgnore] public ICollection<MovieWatchStatus> Watched { get; set; }
/// <summary> /// <summary>
/// Metadata of what an user as started/planned to watch. /// Metadata of what an user as started/planned to watch.
/// </summary> /// </summary>
[Projectable(UseMemberBody = nameof(_WatchInfo), OnlyOnInclude = true)] [Projectable(UseMemberBody = nameof(_WatchStatus), OnlyOnInclude = true)]
[LoadableRelation] public MovieWatchInfo? WatchInfo { get; set; } [LoadableRelation] public MovieWatchStatus WatchStatus { get; set; }
// There is a global query filter to filter by user so we just need to do single. // There is a global query filter to filter by user so we just need to do single.
private MovieWatchInfo? _WatchInfo => Watched.FirstOrDefault(); private MovieWatchStatus? _WatchStatus => Watched.FirstOrDefault();
/// <inheritdoc /> /// <inheritdoc />
public void OnMerge(object merged) public void OnMerge(object merged)

View File

@ -178,16 +178,16 @@ namespace Kyoo.Abstractions.Models
.ThenBy(x => x.EpisodeNumber) .ThenBy(x => x.EpisodeNumber)
.FirstOrDefault(); .FirstOrDefault();
[SerializeIgnore] public ICollection<ShowWatchInfo> Watched { get; set; } [SerializeIgnore] public ICollection<ShowWatchStatus> Watched { get; set; }
/// <summary> /// <summary>
/// Metadata of what an user as started/planned to watch. /// Metadata of what an user as started/planned to watch.
/// </summary> /// </summary>
[Projectable(UseMemberBody = nameof(_WatchInfo), OnlyOnInclude = true)] [Projectable(UseMemberBody = nameof(_WatchStatus), OnlyOnInclude = true)]
[LoadableRelation] public ShowWatchInfo? WatchInfo { get; set; } [LoadableRelation] public ShowWatchStatus? WatchStatus { get; set; }
// There is a global query filter to filter by user so we just need to do single. // There is a global query filter to filter by user so we just need to do single.
private ShowWatchInfo? _WatchInfo => Watched.FirstOrDefault(); private ShowWatchStatus? _WatchStatus => Watched.FirstOrDefault();
/// <inheritdoc /> /// <inheritdoc />
public void OnMerge(object merged) public void OnMerge(object merged)

View File

@ -52,7 +52,7 @@ namespace Kyoo.Abstractions.Models
/// <summary> /// <summary>
/// Metadata of what an user as started/planned to watch. /// Metadata of what an user as started/planned to watch.
/// </summary> /// </summary>
public class MovieWatchInfo : IAddedDate public class MovieWatchStatus : IAddedDate
{ {
/// <summary> /// <summary>
/// The ID of the user that started watching this episode. /// The ID of the user that started watching this episode.
@ -91,7 +91,7 @@ namespace Kyoo.Abstractions.Models
public int? WatchedTime { get; set; } public int? WatchedTime { get; set; }
} }
public class EpisodeWatchInfo : IAddedDate public class EpisodeWatchStatus : IAddedDate
{ {
/// <summary> /// <summary>
/// The ID of the user that started watching this episode. /// The ID of the user that started watching this episode.
@ -130,7 +130,7 @@ namespace Kyoo.Abstractions.Models
public int? WatchedTime { get; set; } public int? WatchedTime { get; set; }
} }
public class ShowWatchInfo : IAddedDate public class ShowWatchStatus : IAddedDate
{ {
/// <summary> /// <summary>
/// The ID of the user that started watching this episode. /// The ID of the user that started watching this episode.

View File

@ -100,11 +100,11 @@ namespace Kyoo.Postgresql
// /// </summary> // /// </summary>
// public DbSet<PeopleRole> PeopleRoles { get; set; } // public DbSet<PeopleRole> PeopleRoles { get; set; }
public DbSet<MovieWatchInfo> MovieWatchInfo { get; set; } public DbSet<MovieWatchStatus> MovieWatchInfo { get; set; }
public DbSet<ShowWatchInfo> ShowWatchInfo { get; set; } public DbSet<ShowWatchStatus> ShowWatchInfo { get; set; }
public DbSet<EpisodeWatchInfo> EpisodeWatchInfo { get; set; } public DbSet<EpisodeWatchStatus> EpisodeWatchInfo { get; set; }
/// <summary> /// <summary>
/// Add a many to many link between two resources. /// Add a many to many link between two resources.
@ -306,24 +306,24 @@ namespace Kyoo.Postgresql
modelBuilder.Entity<User>().OwnsOne(x => x.Logo); modelBuilder.Entity<User>().OwnsOne(x => x.Logo);
modelBuilder.Entity<MovieWatchInfo>() modelBuilder.Entity<MovieWatchStatus>()
.HasKey(x => new { User = x.UserId, Movie = x.MovieId }); .HasKey(x => new { User = x.UserId, Movie = x.MovieId });
modelBuilder.Entity<ShowWatchInfo>() modelBuilder.Entity<ShowWatchStatus>()
.HasKey(x => new { User = x.UserId, Show = x.ShowId }); .HasKey(x => new { User = x.UserId, Show = x.ShowId });
modelBuilder.Entity<EpisodeWatchInfo>() modelBuilder.Entity<EpisodeWatchStatus>()
.HasKey(x => new { User = x.UserId, Episode = x.EpisodeId }); .HasKey(x => new { User = x.UserId, Episode = x.EpisodeId });
modelBuilder.Entity<MovieWatchInfo>().HasQueryFilter(x => x.UserId == CurrentUserId); modelBuilder.Entity<MovieWatchStatus>().HasQueryFilter(x => x.UserId == CurrentUserId);
modelBuilder.Entity<ShowWatchInfo>().HasQueryFilter(x => x.UserId == CurrentUserId); modelBuilder.Entity<ShowWatchStatus>().HasQueryFilter(x => x.UserId == CurrentUserId);
modelBuilder.Entity<EpisodeWatchInfo>().HasQueryFilter(x => x.UserId == CurrentUserId); modelBuilder.Entity<EpisodeWatchStatus>().HasQueryFilter(x => x.UserId == CurrentUserId);
_HasAddedDate<MovieWatchInfo>(modelBuilder); _HasAddedDate<MovieWatchStatus>(modelBuilder);
_HasAddedDate<ShowWatchInfo>(modelBuilder); _HasAddedDate<ShowWatchStatus>(modelBuilder);
_HasAddedDate<EpisodeWatchInfo>(modelBuilder); _HasAddedDate<EpisodeWatchStatus>(modelBuilder);
modelBuilder.Entity<Movie>().Ignore(x => x.WatchInfo); modelBuilder.Entity<Movie>().Ignore(x => x.WatchStatus);
modelBuilder.Entity<Show>().Ignore(x => x.WatchInfo); modelBuilder.Entity<Show>().Ignore(x => x.WatchStatus);
modelBuilder.Entity<Episode>().Ignore(x => x.WatchInfo); modelBuilder.Entity<Episode>().Ignore(x => x.WatchStatus);
modelBuilder.Entity<Collection>() modelBuilder.Entity<Collection>()
.HasIndex(x => x.Slug) .HasIndex(x => x.Slug)