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)