diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs b/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs index 8adc3ca4..8e9852d7 100644 --- a/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs +++ b/back/src/Kyoo.Abstractions/Models/Resources/Episode.cs @@ -238,16 +238,16 @@ namespace Kyoo.Abstractions.Models || (x.SeasonNumber == SeasonNumber && x.EpisodeNumber > EpisodeNumber) ); - [SerializeIgnore] public ICollection Watched { get; set; } + [SerializeIgnore] public ICollection Watched { get; set; } /// /// Metadata of what an user as started/planned to watch. /// - [Projectable(UseMemberBody = nameof(_WatchInfo), OnlyOnInclude = true)] - [LoadableRelation] public EpisodeWatchInfo? WatchInfo { get; set; } + [Projectable(UseMemberBody = nameof(_WatchStatus), OnlyOnInclude = true)] + [LoadableRelation] public EpisodeWatchStatus? WatchStatus { get; set; } // 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(); /// /// Links to watch this episode. diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs b/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs index 71377ca8..bef6b871 100644 --- a/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs +++ b/back/src/Kyoo.Abstractions/Models/Resources/Movie.cs @@ -146,16 +146,16 @@ namespace Kyoo.Abstractions.Models Hls = $"/video/movie/{Slug}/master.m3u8", }; - [SerializeIgnore] public ICollection Watched { get; set; } + [SerializeIgnore] public ICollection Watched { get; set; } /// /// Metadata of what an user as started/planned to watch. /// - [Projectable(UseMemberBody = nameof(_WatchInfo), OnlyOnInclude = true)] - [LoadableRelation] public MovieWatchInfo? WatchInfo { get; set; } + [Projectable(UseMemberBody = nameof(_WatchStatus), OnlyOnInclude = true)] + [LoadableRelation] public MovieWatchStatus WatchStatus { get; set; } // 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(); /// public void OnMerge(object merged) diff --git a/back/src/Kyoo.Abstractions/Models/Resources/Show.cs b/back/src/Kyoo.Abstractions/Models/Resources/Show.cs index 8363b7d1..bd2bf657 100644 --- a/back/src/Kyoo.Abstractions/Models/Resources/Show.cs +++ b/back/src/Kyoo.Abstractions/Models/Resources/Show.cs @@ -178,16 +178,16 @@ namespace Kyoo.Abstractions.Models .ThenBy(x => x.EpisodeNumber) .FirstOrDefault(); - [SerializeIgnore] public ICollection Watched { get; set; } + [SerializeIgnore] public ICollection Watched { get; set; } /// /// Metadata of what an user as started/planned to watch. /// - [Projectable(UseMemberBody = nameof(_WatchInfo), OnlyOnInclude = true)] - [LoadableRelation] public ShowWatchInfo? WatchInfo { get; set; } + [Projectable(UseMemberBody = nameof(_WatchStatus), OnlyOnInclude = true)] + [LoadableRelation] public ShowWatchStatus? WatchStatus { get; set; } // 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(); /// public void OnMerge(object merged) diff --git a/back/src/Kyoo.Abstractions/Models/Resources/WatchInfo.cs b/back/src/Kyoo.Abstractions/Models/Resources/WatchInfo.cs index c6ae4dc2..09ce0308 100644 --- a/back/src/Kyoo.Abstractions/Models/Resources/WatchInfo.cs +++ b/back/src/Kyoo.Abstractions/Models/Resources/WatchInfo.cs @@ -52,7 +52,7 @@ namespace Kyoo.Abstractions.Models /// /// Metadata of what an user as started/planned to watch. /// - public class MovieWatchInfo : IAddedDate + public class MovieWatchStatus : IAddedDate { /// /// The ID of the user that started watching this episode. @@ -91,7 +91,7 @@ namespace Kyoo.Abstractions.Models public int? WatchedTime { get; set; } } - public class EpisodeWatchInfo : IAddedDate + public class EpisodeWatchStatus : IAddedDate { /// /// The ID of the user that started watching this episode. @@ -130,7 +130,7 @@ namespace Kyoo.Abstractions.Models public int? WatchedTime { get; set; } } - public class ShowWatchInfo : IAddedDate + public class ShowWatchStatus : IAddedDate { /// /// The ID of the user that started watching this episode. diff --git a/back/src/Kyoo.Postgresql/DatabaseContext.cs b/back/src/Kyoo.Postgresql/DatabaseContext.cs index 26bffbab..3163e5a6 100644 --- a/back/src/Kyoo.Postgresql/DatabaseContext.cs +++ b/back/src/Kyoo.Postgresql/DatabaseContext.cs @@ -100,11 +100,11 @@ namespace Kyoo.Postgresql // /// // public DbSet PeopleRoles { get; set; } - public DbSet MovieWatchInfo { get; set; } + public DbSet MovieWatchInfo { get; set; } - public DbSet ShowWatchInfo { get; set; } + public DbSet ShowWatchInfo { get; set; } - public DbSet EpisodeWatchInfo { get; set; } + public DbSet EpisodeWatchInfo { get; set; } /// /// Add a many to many link between two resources. @@ -306,24 +306,24 @@ namespace Kyoo.Postgresql modelBuilder.Entity().OwnsOne(x => x.Logo); - modelBuilder.Entity() + modelBuilder.Entity() .HasKey(x => new { User = x.UserId, Movie = x.MovieId }); - modelBuilder.Entity() + modelBuilder.Entity() .HasKey(x => new { User = x.UserId, Show = x.ShowId }); - modelBuilder.Entity() + modelBuilder.Entity() .HasKey(x => new { User = x.UserId, Episode = x.EpisodeId }); - modelBuilder.Entity().HasQueryFilter(x => x.UserId == CurrentUserId); - modelBuilder.Entity().HasQueryFilter(x => x.UserId == CurrentUserId); - modelBuilder.Entity().HasQueryFilter(x => x.UserId == CurrentUserId); + modelBuilder.Entity().HasQueryFilter(x => x.UserId == CurrentUserId); + modelBuilder.Entity().HasQueryFilter(x => x.UserId == CurrentUserId); + modelBuilder.Entity().HasQueryFilter(x => x.UserId == CurrentUserId); - _HasAddedDate(modelBuilder); - _HasAddedDate(modelBuilder); - _HasAddedDate(modelBuilder); + _HasAddedDate(modelBuilder); + _HasAddedDate(modelBuilder); + _HasAddedDate(modelBuilder); - modelBuilder.Entity().Ignore(x => x.WatchInfo); - modelBuilder.Entity().Ignore(x => x.WatchInfo); - modelBuilder.Entity().Ignore(x => x.WatchInfo); + modelBuilder.Entity().Ignore(x => x.WatchStatus); + modelBuilder.Entity().Ignore(x => x.WatchStatus); + modelBuilder.Entity().Ignore(x => x.WatchStatus); modelBuilder.Entity() .HasIndex(x => x.Slug)