Create itemHelper

This commit is contained in:
Nikhil Nawgiri 2024-10-26 17:46:58 +02:00
parent 6ad2721831
commit ea78b4a6b5

48
be/src/itemHelper.ts Normal file
View file

@ -0,0 +1,48 @@
interface Item {
Name: string,
ServerId: string,
Id: string,
HasSubtitles?: boolean,
Container: string,
PremiereDate: string,
CriticRating: number,
OfficialRating: string,
ChannelId: null,
CommunityRating: number,
RunTimeTicks: number,
ProductionYear: number,
ProviderIds: {
Tmdb: string,
Imdb: string,
TmdbCollection?: string,
},
IsFolder: boolean,
Type: "Movie" | "Series",
VideoType: string,
ImageBlurHashes: {},
LocationType: string,
MediaType: string,
};
export const transformItems = (items: []) => (
items.map((item: Item) => {
// omit unnecessary props
const {
ServerId,
Id,
Container,
PremiereDate,
CriticRating,
ChannelId,
CommunityRating,
RunTimeTicks,
IsFolder,
VideoType,
ImageBlurHashes,
LocationType,
MediaType,
...remainingProps
} = item;
return remainingProps;
})
);