mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 04:04:21 -04:00
Add season model
This commit is contained in:
parent
ed19413576
commit
0b0ae9abd3
23
api/src/models/season.ts
Normal file
23
api/src/models/season.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { t } from "elysia";
|
||||||
|
import { Image } from "./utils/image";
|
||||||
|
import { SeasonId } from "./utils/external-id";
|
||||||
|
|
||||||
|
export const Season = t.Object({
|
||||||
|
id: t.String({ format: "uuid" }),
|
||||||
|
slug: t.String(),
|
||||||
|
seasonNumber: t.Number({ minimum: 1 }),
|
||||||
|
name: t.Nullable(t.String()),
|
||||||
|
description: 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()),
|
||||||
|
|
||||||
|
createdAt: t.String({ format: "date-time" }),
|
||||||
|
nextRefresh: t.String({ format: "date-time" }),
|
||||||
|
|
||||||
|
externalId: SeasonId,
|
||||||
|
});
|
||||||
|
export type Season = typeof Season.static;
|
@ -8,7 +8,6 @@ export const ExternalId = t.Record(
|
|||||||
link: t.Nullable(t.String({ format: "uri" })),
|
link: t.Nullable(t.String({ format: "uri" })),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
export type ExternalId = typeof ExternalId.static;
|
export type ExternalId = typeof ExternalId.static;
|
||||||
|
|
||||||
export const EpisodeId = t.Record(
|
export const EpisodeId = t.Record(
|
||||||
@ -29,3 +28,19 @@ export const EpisodeId = t.Record(
|
|||||||
link: t.Nullable(t.String({ format: "uri" })),
|
link: t.Nullable(t.String({ format: "uri" })),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
export type EpisodeId = typeof EpisodeId.static;
|
||||||
|
|
||||||
|
export const SeasonId = t.Record(
|
||||||
|
t.String(),
|
||||||
|
t.Object({
|
||||||
|
serieId: t.String({
|
||||||
|
descrpition: comment`
|
||||||
|
Id on the external website.
|
||||||
|
We store the serie's id because episode id are rarely stable.
|
||||||
|
`,
|
||||||
|
}),
|
||||||
|
season: t.Number(),
|
||||||
|
link: t.Nullable(t.String({ format: "uri" })),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
export type SeasonId = typeof SeasonId.static;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user