mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Cleanup external id types in db
This commit is contained in:
parent
84ce544f4d
commit
ffa42de4f3
@ -22,6 +22,28 @@ export const entryType = schema.enum("entry_type", [
|
||||
"extra",
|
||||
]);
|
||||
|
||||
export const entryid = () =>
|
||||
jsonb()
|
||||
.$type<
|
||||
Record<
|
||||
string,
|
||||
| {
|
||||
// used for movies
|
||||
dataId: string;
|
||||
link: string | null;
|
||||
}
|
||||
| {
|
||||
// used for episodes, specials & extra
|
||||
serieId: string;
|
||||
season: number | null;
|
||||
episode: number;
|
||||
link: string | null;
|
||||
}
|
||||
>
|
||||
>()
|
||||
.notNull()
|
||||
.default({});
|
||||
|
||||
export const entries = schema.table(
|
||||
"entries",
|
||||
{
|
||||
@ -37,7 +59,7 @@ export const entries = schema.table(
|
||||
runtime: integer(),
|
||||
thumbnails: image(),
|
||||
|
||||
externalId: jsonb().notNull().default({}),
|
||||
externalId: entryid(),
|
||||
|
||||
createdAt: timestamp({ withTimezone: true, mode: "string" }).defaultNow(),
|
||||
nextRefresh: timestamp({ withTimezone: true, mode: "string" }),
|
||||
|
@ -3,6 +3,7 @@ import {
|
||||
check,
|
||||
date,
|
||||
integer,
|
||||
jsonb,
|
||||
primaryKey,
|
||||
smallint,
|
||||
text,
|
||||
@ -10,7 +11,7 @@ import {
|
||||
uuid,
|
||||
varchar,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import { externalid, image, language, schema } from "./utils";
|
||||
import { image, language, schema } from "./utils";
|
||||
|
||||
export const showKind = schema.enum("show_kind", ["serie", "movie"]);
|
||||
export const showStatus = schema.enum("show_status", [
|
||||
@ -45,6 +46,20 @@ export const genres = schema.enum("genres", [
|
||||
"talk",
|
||||
]);
|
||||
|
||||
export const externalid = () =>
|
||||
jsonb()
|
||||
.$type<
|
||||
Record<
|
||||
string,
|
||||
{
|
||||
dataId: string;
|
||||
link: string | null;
|
||||
}
|
||||
>
|
||||
>()
|
||||
.notNull()
|
||||
.default({});
|
||||
|
||||
export const shows = schema.table(
|
||||
"shows",
|
||||
{
|
||||
|
@ -23,20 +23,6 @@ export const language = () => varchar({ length: 255 });
|
||||
export const image = () =>
|
||||
jsonb().$type<{ id: string; source: string; blurhash: string }>();
|
||||
|
||||
export const externalid = () =>
|
||||
jsonb()
|
||||
.$type<
|
||||
Record<
|
||||
string,
|
||||
{
|
||||
dataId: string;
|
||||
link: string | null;
|
||||
}
|
||||
>
|
||||
>()
|
||||
.notNull()
|
||||
.default({});
|
||||
|
||||
// https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts#L58
|
||||
type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user