Push fix next episode id nullability

This commit is contained in:
Zoe Roux 2023-12-03 22:22:04 +01:00
parent 275a892ee1
commit 015bfe983c
6 changed files with 24 additions and 22 deletions

View File

@ -203,7 +203,7 @@ namespace Kyoo.Abstractions.Models
/// <summary>
/// The ID of the episode started.
/// </summary>
[SerializeIgnore] public Guid NextEpisodeId { get; set; }
[SerializeIgnore] public Guid? NextEpisodeId { get; set; }
/// <summary>
/// The next <see cref="Episode"/> to watch.

View File

@ -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<T>()
.Property(x => x.AddedDate)
.HasDefaultValueSql("now() at time zone 'utc'");
.HasDefaultValueSql("now() at time zone 'utc'")
.ValueGeneratedOnAdd();
}
/// <summary>
@ -317,6 +316,8 @@ namespace Kyoo.Postgresql
modelBuilder.Entity<ShowWatchStatus>().HasQueryFilter(x => x.UserId == CurrentUserId);
modelBuilder.Entity<EpisodeWatchStatus>().HasQueryFilter(x => x.UserId == CurrentUserId);
modelBuilder.Entity<ShowWatchStatus>().Navigation(x => x.NextEpisode).AutoInclude();
_HasAddedDate<MovieWatchStatus>(modelBuilder);
_HasAddedDate<ShowWatchStatus>(modelBuilder);
_HasAddedDate<EpisodeWatchStatus>(modelBuilder);

View File

@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace Kyoo.Postgresql.Migrations
{
[DbContext(typeof(PostgresContext))]
[Migration("20231129014309_Watchlist")]
[Migration("20231203194301_Watchlist")]
partial class Watchlist
{
/// <inheritdoc />
@ -495,7 +495,7 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("added_date")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property<Guid>("NextEpisodeId")
b.Property<Guid?>("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")

View File

@ -105,7 +105,7 @@ namespace Kyoo.Postgresql.Migrations
played_date = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
status = table.Column<WatchStatus>(type: "watch_status", nullable: false),
unseen_episodes_count = table.Column<int>(type: "integer", nullable: false),
next_episode_id = table.Column<Guid>(type: "uuid", nullable: false)
next_episode_id = table.Column<Guid>(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,

View File

@ -492,7 +492,7 @@ namespace Kyoo.Postgresql.Migrations
.HasColumnName("added_date")
.HasDefaultValueSql("now() at time zone 'utc'");
b.Property<Guid>("NextEpisodeId")
b.Property<Guid?>("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")

View File

@ -124,14 +124,20 @@ export const Slider = ({
>
{subtleProgress !== undefined && (
<View
{...css({
bg: (theme) => 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),
},
},
)}
/>
)}
<View