mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-23 15:30:34 -04:00
Proper error handling for missing original
This commit is contained in:
parent
cca0da4bf6
commit
fd57f506c1
@ -48,6 +48,13 @@ export const seedMovie = async (
|
|||||||
|
|
||||||
const { translations, videos, collection, studios, ...movie } = seed;
|
const { translations, videos, collection, studios, ...movie } = seed;
|
||||||
const nextRefresh = guessNextRefresh(movie.airDate ?? new Date());
|
const nextRefresh = guessNextRefresh(movie.airDate ?? new Date());
|
||||||
|
const original = translations[movie.originalLanguage];
|
||||||
|
if (!original) {
|
||||||
|
return {
|
||||||
|
status: 422,
|
||||||
|
message: "No translation available in the original language.",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const col = await insertCollection(collection, {
|
const col = await insertCollection(collection, {
|
||||||
kind: "movie",
|
kind: "movie",
|
||||||
@ -55,7 +62,6 @@ export const seedMovie = async (
|
|||||||
...seed,
|
...seed,
|
||||||
});
|
});
|
||||||
|
|
||||||
const original = translations[movie.originalLanguage];
|
|
||||||
const show = await insertShow(
|
const show = await insertShow(
|
||||||
{
|
{
|
||||||
kind: "movie",
|
kind: "movie",
|
||||||
|
@ -83,6 +83,13 @@ export const seedSerie = async (
|
|||||||
...serie
|
...serie
|
||||||
} = seed;
|
} = seed;
|
||||||
const nextRefresh = guessNextRefresh(serie.startAir ?? new Date());
|
const nextRefresh = guessNextRefresh(serie.startAir ?? new Date());
|
||||||
|
const original = translations[serie.originalLanguage];
|
||||||
|
if (!original) {
|
||||||
|
return {
|
||||||
|
status: 422,
|
||||||
|
message: "No translation available in the original language.",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const col = await insertCollection(collection, {
|
const col = await insertCollection(collection, {
|
||||||
kind: "serie",
|
kind: "serie",
|
||||||
@ -90,7 +97,6 @@ export const seedSerie = async (
|
|||||||
...seed,
|
...seed,
|
||||||
});
|
});
|
||||||
|
|
||||||
const original = translations[serie.originalLanguage];
|
|
||||||
const show = await insertShow(
|
const show = await insertShow(
|
||||||
{
|
{
|
||||||
kind: "serie",
|
kind: "serie",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user