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" }),
videoPk: integer().references(() => videos.pk, { onDelete: "set null" }),
percent: integer().notNull().default(0),
time: integer(),
time: integer().notNull().default(0),
playedDate: timestamp({ withTimezone: true, mode: "iso" })
.notNull()
.default(sql`now()`),

View File

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

View File

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

View File

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

View File

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