From 4c1ad4da5be6b82e2f23d68810e679bc25c2ef40 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 14 Jul 2025 03:05:50 +0200 Subject: [PATCH] Fix progress date format --- api/src/controllers/entries.ts | 2 +- api/tests/movies/watchstatus.test.ts | 8 ++++---- api/tests/series/history.test.ts | 8 ++++---- api/tests/series/nextup.test.ts | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/api/src/controllers/entries.ts b/api/src/controllers/entries.ts index 3919e4ce..c59fa656 100644 --- a/api/src/controllers/entries.ts +++ b/api/src/controllers/entries.ts @@ -146,7 +146,7 @@ export const mapProgress = ({ aliased }: { aliased: boolean }) => { const ret = { time: coalesce(time, sql`0`), percent: coalesce(percent, sql`0`), - playedDate: sql`${playedDate}`, + playedDate: sql`to_char(${playedDate}, 'YYYY-MM-DD"T"HH24:MI:SS"Z"')`, videoId: sql`${videoId}`, }; if (!aliased) return ret; diff --git a/api/tests/movies/watchstatus.test.ts b/api/tests/movies/watchstatus.test.ts index eb6cf011..ee5ec600 100644 --- a/api/tests/movies/watchstatus.test.ts +++ b/api/tests/movies/watchstatus.test.ts @@ -36,7 +36,7 @@ describe("Set & get watch status", () => { expect(body.items[0].slug).toBe(bubble.slug); expect(body.items[0].watchStatus).toMatchObject({ status: "completed", - completedAt: "2024-12-21 00:00:00+00", + completedAt: "2024-12-21T00:00:00Z", score: 85, percent: 100, }); @@ -61,7 +61,7 @@ describe("Set & get watch status", () => { expect(body.items[0].slug).toBe(bubble.slug); expect(body.items[0].watchStatus).toMatchObject({ status: "rewatching", - completedAt: "2024-12-21 00:00:00+00", + completedAt: "2024-12-21T00:00:00Z", score: 85, percent: 0, }); @@ -89,7 +89,7 @@ describe("Set & get watch status", () => { expect(body.items[0].slug).toBe(bubble.slug); expect(body.items[0].watchStatus).toMatchObject({ status: "rewatching", - completedAt: "2024-12-21 00:00:00+00", + completedAt: "2024-12-21T00:00:00Z", score: 85, percent: 0, }); @@ -109,7 +109,7 @@ describe("Set & get watch status", () => { expect(body.slug).toBe(bubble.slug); expect(body.watchStatus).toMatchObject({ status: "rewatching", - completedAt: "2024-12-21 00:00:00+00", + completedAt: "2024-12-21T00:00:00Z", score: 85, percent: 0, }); diff --git a/api/tests/series/history.test.ts b/api/tests/series/history.test.ts index 1382b176..12b7cc2b 100644 --- a/api/tests/series/history.test.ts +++ b/api/tests/series/history.test.ts @@ -109,7 +109,7 @@ describe("Set & get history", () => { percent: 100, time: 38 * 60, videoId: madeInAbyssVideo.id, - playedDate: "2025-02-03 00:00:00+00", + playedDate: "2025-02-03T00:00:00Z", }); }); @@ -122,7 +122,7 @@ describe("Set & get history", () => { percent: 100, time: 38 * 60, videoId: madeInAbyssVideo.id, - playedDate: "2025-02-03 00:00:00+00", + playedDate: "2025-02-03T00:00:00Z", }); }); @@ -137,13 +137,13 @@ describe("Set & get history", () => { expect(body.items[0].watchStatus).toMatchObject({ status: "watching", seenCount: 1, - startedAt: "2025-02-01 00:00:00+00", + startedAt: "2025-02-01T00:00:00Z", }); expect(body.items[1].slug).toBe(bubble.slug); expect(body.items[1].watchStatus).toMatchObject({ status: "completed", percent: 100, - completedAt: "2025-02-02 00:00:00+00", + completedAt: "2025-02-02T00:00:00Z", }); }); }); diff --git a/api/tests/series/nextup.test.ts b/api/tests/series/nextup.test.ts index af25062b..b10ef224 100644 --- a/api/tests/series/nextup.test.ts +++ b/api/tests/series/nextup.test.ts @@ -113,7 +113,7 @@ describe("nextup", () => { percent: 58, time: 28 * 60 + 12, videoId: madeInAbyssVideo.id, - playedDate: "2025-02-01T00:00:00+00:00", + playedDate: "2025-02-01T00:00:00Z", }); [resp, body] = await getMovie(bubble.slug, {}); @@ -121,7 +121,7 @@ describe("nextup", () => { expect(body.watchStatus).toMatchObject({ percent: 100, status: "completed", - completedAt: "2025-02-02 00:00:00+00", + completedAt: "2025-02-02T00:00:00Z", }); [resp, body] = await getNextup("me", {}); @@ -132,7 +132,7 @@ describe("nextup", () => { percent: 58, time: 28 * 60 + 12, videoId: madeInAbyssVideo.id, - playedDate: "2025-02-01 00:00:00+00", + playedDate: "2025-02-01T00:00:00Z", }); });