A self hosted solution for privately rating and reviewing different sorts of media
1import { Entry, EntryTranslation, User } from '@prisma/client';
2
3export const getUserTitleFromEntry = (
4 entry: Entry & { translations: EntryTranslation[] }
5) => {
6 return entry.translations.length !== 0
7 ? entry.translations[0]!.name
8 : entry.originalTitle;
9};
10
11export const getDefaultWhereForTranslations = (
12 authUser: { showMediaMetaInId: number | null } | null
13) => {
14 return {
15 where: {
16 language: {
17 id: authUser?.showMediaMetaInId ?? undefined,
18 iso_639_1: !authUser || !authUser?.showMediaMetaInId ? 'en' : undefined,
19 },
20 },
21 };
22};