Make history's time non nullable (it was never null anyways)

This commit is contained in:
Zoe Roux 2025-07-20 15:12:33 +02:00
parent 4fb1406f2b
commit bc8e87f343
No known key found for this signature in database
5 changed files with 8 additions and 10 deletions

View File

@ -18,7 +18,7 @@ export const history = schema.table(
.references(() => entries.pk, { onDelete: "cascade" }), .references(() => entries.pk, { onDelete: "cascade" }),
videoPk: integer().references(() => videos.pk, { onDelete: "set null" }), videoPk: integer().references(() => videos.pk, { onDelete: "set null" }),
percent: integer().notNull().default(0), percent: integer().notNull().default(0),
time: integer(), time: integer().notNull().default(0),
playedDate: timestamp({ withTimezone: true, mode: "iso" }) playedDate: timestamp({ withTimezone: true, mode: "iso" })
.notNull() .notNull()
.default(sql`now()`), .default(sql`now()`),

View File

@ -3,15 +3,13 @@ import { comment } from "~/utils";
export const Progress = t.Object({ export const Progress = t.Object({
percent: t.Integer({ minimum: 0, maximum: 100 }), percent: t.Integer({ minimum: 0, maximum: 100 }),
time: t.Nullable( time: t.Integer({
t.Integer({ minimum: 0,
minimum: 0, description: comment`
description: comment`
When this episode was stopped (in seconds since the start). When this episode was stopped (in seconds since the start).
This value is null if the entry was never watched or is finished. This value is null if the entry was never watched or is finished.
`, `,
}), }),
),
playedDate: t.Nullable(t.String({ format: "date-time" })), playedDate: t.Nullable(t.String({ format: "date-time" })),
videoId: t.Nullable( videoId: t.Nullable(
t.String({ t.String({

View File

@ -29,7 +29,7 @@ const Base = z.object({
), ),
progress: z.object({ progress: z.object({
percent: z.int().min(0).max(100), percent: z.int().min(0).max(100),
time: z.int().min(0).nullable(), time: z.int().min(0),
playedDate: zdate().nullable(), playedDate: zdate().nullable(),
videoId: z.string().nullable(), videoId: z.string().nullable(),
}), }),

View File

@ -22,7 +22,7 @@ export const Extra = z.object({
progress: z.object({ progress: z.object({
percent: z.int().min(0).max(100), percent: z.int().min(0).max(100),
time: z.int().min(0).nullable(), time: z.int().min(0),
playedDate: zdate().nullable(), playedDate: zdate().nullable(),
}), }),
}); });

View File

@ -39,7 +39,7 @@ export const FullVideo = Video.extend({
slugs: z.array(z.string()), slugs: z.array(z.string()),
progress: z.object({ progress: z.object({
percent: z.int().min(0).max(100), percent: z.int().min(0).max(100),
time: z.int().min(0).nullable(), time: z.int().min(0),
playedDate: zdate().nullable(), playedDate: zdate().nullable(),
videoId: z.string().nullable(), videoId: z.string().nullable(),
}), }),