From 78e84cf960c266fcc2fceca5bf6184889396a491 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Fri, 8 Nov 2024 22:32:19 +0100 Subject: [PATCH] Use string for date & datetime --- api/src/db/schema/entries.ts | 4 ++-- api/src/db/schema/shows.ts | 10 ++++++---- api/src/models/movie.ts | 9 ++++----- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/api/src/db/schema/entries.ts b/api/src/db/schema/entries.ts index e7b52a6d..dfb13fd4 100644 --- a/api/src/db/schema/entries.ts +++ b/api/src/db/schema/entries.ts @@ -37,8 +37,8 @@ export const entries = schema.table( externalId: jsonb().notNull().default({}), - createdAt: timestamp({ withTimezone: true }).defaultNow(), - nextRefresh: timestamp({ withTimezone: true }), + createdAt: timestamp({ withTimezone: true, mode: "string" }).defaultNow(), + nextRefresh: timestamp({ withTimezone: true, mode: "string" }), }, (t) => ({ // episodeKey: unique().on(t.showId, t.seasonNumber, t.episodeNumber), diff --git a/api/src/db/schema/shows.ts b/api/src/db/schema/shows.ts index 2e4bcde2..ba2aa3e6 100644 --- a/api/src/db/schema/shows.ts +++ b/api/src/db/schema/shows.ts @@ -56,14 +56,16 @@ export const shows = schema.table( rating: smallint(), runtime: integer(), status: showStatus().notNull(), - startAir: date({ mode: "date" }), - endAir: date({ mode: "date" }), + startAir: date(), + endAir: date(), originalLanguage: language(), externalId: externalid(), - createdAt: timestamp({ withTimezone: true }).notNull().defaultNow(), - nextRefresh: timestamp({ withTimezone: true }).notNull(), + createdAt: timestamp({ withTimezone: true, mode: "string" }) + .notNull() + .defaultNow(), + nextRefresh: timestamp({ withTimezone: true, mode: "string" }).notNull(), }, (t) => ({ ratingValid: check( diff --git a/api/src/models/movie.ts b/api/src/models/movie.ts index f0c20011..765ce890 100644 --- a/api/src/models/movie.ts +++ b/api/src/models/movie.ts @@ -17,18 +17,17 @@ export const Movie = t.Object({ status: ShowStatus, runtime: t.Nullable(t.Number({ minimum: 0 })), - airDate: t.Nullable(t.Date()), + airDate: t.Nullable(t.String({ format: "date" })), originalLanguage: t.Nullable(t.String()), - trailerUrl: t.Nullable(t.String()), poster: t.Nullable(Image), thumbnail: t.Nullable(Image), banner: t.Nullable(Image), logo: t.Nullable(Image), + trailerUrl: t.Nullable(t.String()), - // this is a datetime, not just a date. - createdAt: t.Date(), - nextRefresh: t.Date(), + createdAt: t.String({ format: "date-time" }), + nextRefresh: t.String({ format: "date-time" }), externalId: ExternalId, });