change watch history duration watched to float

This commit is contained in:
Pas 2026-01-16 19:11:47 -07:00
parent c8079ff2c8
commit 011a5a7791
4 changed files with 15 additions and 9 deletions

View file

@ -0,0 +1,6 @@
-- AlterTable
ALTER TABLE "user_group_order" ALTER COLUMN "updated_at" SET DEFAULT CURRENT_TIMESTAMP;
-- AlterTable
ALTER TABLE "watch_history" ALTER COLUMN "duration" SET DATA TYPE DOUBLE PRECISION,
ALTER COLUMN "watched" SET DATA TYPE DOUBLE PRECISION;

View file

@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"
provider = "postgresql"

View file

@ -148,8 +148,8 @@ model watch_history {
season_id String? @db.VarChar(255)
episode_id String? @db.VarChar(255)
meta Json
duration BigInt
watched BigInt
duration Float
watched Float
watched_at DateTime @db.Timestamptz(0)
completed Boolean @default(false)
season_number Int?

View file

@ -77,8 +77,8 @@ export default defineEventHandler(async event => {
id: existingItem.id,
},
data: {
duration: BigInt(validatedBody.duration),
watched: BigInt(validatedBody.watched),
duration: parseFloat(validatedBody.duration),
watched: parseFloat(validatedBody.watched),
watched_at: watchedAt,
completed: validatedBody.completed,
meta: validatedBody.meta,
@ -95,8 +95,8 @@ export default defineEventHandler(async event => {
episode_id: validatedBody.episodeId || null,
season_number: validatedBody.seasonNumber || null,
episode_number: validatedBody.episodeNumber || null,
duration: BigInt(validatedBody.duration),
watched: BigInt(validatedBody.watched),
duration: parseFloat(validatedBody.duration),
watched: parseFloat(validatedBody.watched),
watched_at: watchedAt,
completed: validatedBody.completed,
meta: validatedBody.meta,
@ -115,8 +115,8 @@ export default defineEventHandler(async event => {
seasonNumber: watchHistoryItem.season_number,
episodeNumber: watchHistoryItem.episode_number,
meta: watchHistoryItem.meta,
duration: Number(watchHistoryItem.duration),
watched: Number(watchHistoryItem.watched),
duration: watchHistoryItem.duration,
watched: watchHistoryItem.watched,
watchedAt: watchHistoryItem.watched_at.toISOString(),
completed: watchHistoryItem.completed,
updatedAt: watchHistoryItem.updated_at.toISOString(),