From 452e4f32b426eb7d4997df3a4efe1ec743ad3cfd Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Fri, 19 Dec 2025 17:30:35 +0100 Subject: [PATCH] Fix `/api/videos/:id?with=show`'s watchlist date formats --- api/src/controllers/videos.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/src/controllers/videos.ts b/api/src/controllers/videos.ts index db528571..3fcb323a 100644 --- a/api/src/controllers/videos.ts +++ b/api/src/controllers/videos.ts @@ -318,11 +318,16 @@ const videoRelations = { ) .as("t"); + const { startedAt, lastPlayedAt, completedAt, ...watchlistCols } = + getColumns(watchlist); const watchStatusQ = db .select({ watchStatus: jsonbBuildObject({ - ...getColumns(watchlist), + ...watchlistCols, percent: watchlist.seenCount, + startedAt: sql`to_char(${startedAt}, 'YYYY-MM-DD"T"HH24:MI:SS"Z"')`, + lastPlayedAt: sql`to_char(${lastPlayedAt}, 'YYYY-MM-DD"T"HH24:MI:SS"Z"')`, + completedAt: sql`to_char(${completedAt}, 'YYYY-MM-DD"T"HH24:MI:SS"Z"')`, }).as("watchStatus"), }) .from(watchlist)