Add external links on show/movie page

This commit is contained in:
Zoe Roux
2023-11-03 16:05:09 +01:00
parent a825912ad3
commit b995b86cee
8 changed files with 129 additions and 18 deletions
@@ -0,0 +1,37 @@
/*
* Kyoo - A portable and vast media library solution.
* Copyright (c) Kyoo.
*
* See AUTHORS.md and LICENSE file in the project root for full license information.
*
* Kyoo is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Kyoo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
*/
import { z } from "zod";
export const MetadataP = z.record(
z.object({
/*
* The ID of the resource on the external provider.
*/
dataId: z.string(),
/*
* The URL of the resource on the external provider.
*/
link: z.string().nullable(),
}),
);
export type Metadata = z.infer<typeof MetadataP>;
@@ -25,6 +25,7 @@ import { Genre } from "./genre";
import { StudioP } from "./studio";
import { Status } from "./show";
import { CollectionP } from "./collection";
import { MetadataP } from "./metadata";
export const MovieP = withImages(
ResourceP.extend({
@@ -94,6 +95,10 @@ export const MovieP = withImages(
*/
hls: z.string().transform(imageFn),
}),
/**
* The link to metadata providers that this show has.
*/
externalId: MetadataP,
}),
"movies",
)
@@ -26,6 +26,7 @@ import { SeasonP } from "./season";
import { StudioP } from "./studio";
import { BaseEpisodeP } from "./episode.base";
import { CollectionP } from "./collection";
import { MetadataP } from "./metadata";
/**
* The enum containing show's status.
@@ -99,6 +100,10 @@ export const ShowP = withImages(
* The first episode of this show
*/
firstEpisode: BaseEpisodeP.optional().nullable(),
/**
* The link to metadata providers that this show has.
*/
externalId: MetadataP,
}),
"shows",
)