diff --git a/back/src/Kyoo.Abstractions/Models/Resources/WatchStatus.cs b/back/src/Kyoo.Abstractions/Models/Resources/WatchStatus.cs index 78e1e438..1a72fbfb 100644 --- a/back/src/Kyoo.Abstractions/Models/Resources/WatchStatus.cs +++ b/back/src/Kyoo.Abstractions/Models/Resources/WatchStatus.cs @@ -203,7 +203,7 @@ namespace Kyoo.Abstractions.Models /// /// The ID of the episode started. /// - [SerializeIgnore] public Guid NextEpisodeId { get; set; } + [SerializeIgnore] public Guid? NextEpisodeId { get; set; } /// /// The next to watch. diff --git a/back/src/Kyoo.Postgresql/DatabaseContext.cs b/back/src/Kyoo.Postgresql/DatabaseContext.cs index 3a52ea5b..9c6c4240 100644 --- a/back/src/Kyoo.Postgresql/DatabaseContext.cs +++ b/back/src/Kyoo.Postgresql/DatabaseContext.cs @@ -18,7 +18,6 @@ using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Linq.Expressions; using System.Text.Json; @@ -31,7 +30,6 @@ using Kyoo.Authentication; using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; -using Microsoft.EntityFrameworkCore.ValueGeneration; namespace Kyoo.Postgresql { @@ -204,7 +202,8 @@ namespace Kyoo.Postgresql { modelBuilder.Entity() .Property(x => x.AddedDate) - .HasDefaultValueSql("now() at time zone 'utc'"); + .HasDefaultValueSql("now() at time zone 'utc'") + .ValueGeneratedOnAdd(); } /// @@ -317,6 +316,8 @@ namespace Kyoo.Postgresql modelBuilder.Entity().HasQueryFilter(x => x.UserId == CurrentUserId); modelBuilder.Entity().HasQueryFilter(x => x.UserId == CurrentUserId); + modelBuilder.Entity().Navigation(x => x.NextEpisode).AutoInclude(); + _HasAddedDate(modelBuilder); _HasAddedDate(modelBuilder); _HasAddedDate(modelBuilder); diff --git a/back/src/Kyoo.Postgresql/Migrations/20231129014309_Watchlist.Designer.cs b/back/src/Kyoo.Postgresql/Migrations/20231203194301_Watchlist.Designer.cs similarity index 99% rename from back/src/Kyoo.Postgresql/Migrations/20231129014309_Watchlist.Designer.cs rename to back/src/Kyoo.Postgresql/Migrations/20231203194301_Watchlist.Designer.cs index c7e781de..12456592 100644 --- a/back/src/Kyoo.Postgresql/Migrations/20231129014309_Watchlist.Designer.cs +++ b/back/src/Kyoo.Postgresql/Migrations/20231203194301_Watchlist.Designer.cs @@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace Kyoo.Postgresql.Migrations { [DbContext(typeof(PostgresContext))] - [Migration("20231129014309_Watchlist")] + [Migration("20231203194301_Watchlist")] partial class Watchlist { /// @@ -495,7 +495,7 @@ namespace Kyoo.Postgresql.Migrations .HasColumnName("added_date") .HasDefaultValueSql("now() at time zone 'utc'"); - b.Property("NextEpisodeId") + b.Property("NextEpisodeId") .HasColumnType("uuid") .HasColumnName("next_episode_id"); @@ -1167,8 +1167,6 @@ namespace Kyoo.Postgresql.Migrations b.HasOne("Kyoo.Abstractions.Models.Episode", "NextEpisode") .WithMany() .HasForeignKey("NextEpisodeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() .HasConstraintName("fk_show_watch_status_episodes_next_episode_id"); b.HasOne("Kyoo.Abstractions.Models.Show", "Show") diff --git a/back/src/Kyoo.Postgresql/Migrations/20231129014309_Watchlist.cs b/back/src/Kyoo.Postgresql/Migrations/20231203194301_Watchlist.cs similarity index 98% rename from back/src/Kyoo.Postgresql/Migrations/20231129014309_Watchlist.cs rename to back/src/Kyoo.Postgresql/Migrations/20231203194301_Watchlist.cs index 1b0d20b5..4c893e21 100644 --- a/back/src/Kyoo.Postgresql/Migrations/20231129014309_Watchlist.cs +++ b/back/src/Kyoo.Postgresql/Migrations/20231203194301_Watchlist.cs @@ -105,7 +105,7 @@ namespace Kyoo.Postgresql.Migrations played_date = table.Column(type: "timestamp with time zone", nullable: true), status = table.Column(type: "watch_status", nullable: false), unseen_episodes_count = table.Column(type: "integer", nullable: false), - next_episode_id = table.Column(type: "uuid", nullable: false) + next_episode_id = table.Column(type: "uuid", nullable: true) }, constraints: table => { @@ -114,8 +114,7 @@ namespace Kyoo.Postgresql.Migrations name: "fk_show_watch_status_episodes_next_episode_id", column: x => x.next_episode_id, principalTable: "episodes", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); + principalColumn: "id"); table.ForeignKey( name: "fk_show_watch_status_shows_show_id", column: x => x.show_id, diff --git a/back/src/Kyoo.Postgresql/Migrations/PostgresContextModelSnapshot.cs b/back/src/Kyoo.Postgresql/Migrations/PostgresContextModelSnapshot.cs index ba08d9c2..1b236f4f 100644 --- a/back/src/Kyoo.Postgresql/Migrations/PostgresContextModelSnapshot.cs +++ b/back/src/Kyoo.Postgresql/Migrations/PostgresContextModelSnapshot.cs @@ -492,7 +492,7 @@ namespace Kyoo.Postgresql.Migrations .HasColumnName("added_date") .HasDefaultValueSql("now() at time zone 'utc'"); - b.Property("NextEpisodeId") + b.Property("NextEpisodeId") .HasColumnType("uuid") .HasColumnName("next_episode_id"); @@ -1164,8 +1164,6 @@ namespace Kyoo.Postgresql.Migrations b.HasOne("Kyoo.Abstractions.Models.Episode", "NextEpisode") .WithMany() .HasForeignKey("NextEpisodeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired() .HasConstraintName("fk_show_watch_status_episodes_next_episode_id"); b.HasOne("Kyoo.Abstractions.Models.Show", "Show") diff --git a/front/packages/primitives/src/slider.tsx b/front/packages/primitives/src/slider.tsx index 571c9935..fdb57087 100644 --- a/front/packages/primitives/src/slider.tsx +++ b/front/packages/primitives/src/slider.tsx @@ -124,14 +124,20 @@ export const Slider = ({ > {subtleProgress !== undefined && ( theme.overlay1, - position: "absolute", - top: 0, - bottom: 0, - left: 0, - width: percent((subtleProgress / max) * 100), - })} + {...css( + { + bg: (theme) => theme.overlay1, + position: "absolute", + top: 0, + bottom: 0, + left: 0, + }, + { + style: { + width: percent((subtleProgress / max) * 100), + }, + }, + )} /> )}