feat(api): add external ids to movie/tv response
This commit is contained in:
@@ -7,6 +7,8 @@ import {
|
||||
Crew,
|
||||
mapCast,
|
||||
mapCrew,
|
||||
ExternalIds,
|
||||
mapExternalIds,
|
||||
} from './common';
|
||||
|
||||
export interface MovieDetails {
|
||||
@@ -45,6 +47,7 @@ export interface MovieDetails {
|
||||
crew: Crew[];
|
||||
};
|
||||
request?: MediaRequest;
|
||||
externalIds: ExternalIds;
|
||||
}
|
||||
|
||||
export const mapMovieDetails = (
|
||||
@@ -84,5 +87,6 @@ export const mapMovieDetails = (
|
||||
cast: movie.credits.cast.map(mapCast),
|
||||
crew: movie.credits.crew.map(mapCrew),
|
||||
},
|
||||
externalIds: mapExternalIds(movie.external_ids),
|
||||
request,
|
||||
});
|
||||
|
||||
@@ -5,6 +5,8 @@ import {
|
||||
Crew,
|
||||
mapCast,
|
||||
mapCrew,
|
||||
ExternalIds,
|
||||
mapExternalIds,
|
||||
} from './common';
|
||||
import { MediaRequest } from '../entity/MediaRequest';
|
||||
import {
|
||||
@@ -75,6 +77,7 @@ export interface TvDetails {
|
||||
cast: Cast[];
|
||||
crew: Crew[];
|
||||
};
|
||||
externalIds: ExternalIds;
|
||||
request?: MediaRequest;
|
||||
}
|
||||
|
||||
@@ -155,5 +158,6 @@ export const mapTvDetails = (
|
||||
cast: show.credits.cast.map(mapCast),
|
||||
crew: show.credits.crew.map(mapCrew),
|
||||
},
|
||||
externalIds: mapExternalIds(show.external_ids),
|
||||
request,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { TmdbCreditCast, TmdbCreditCrew } from '../api/themoviedb';
|
||||
import {
|
||||
TmdbCreditCast,
|
||||
TmdbCreditCrew,
|
||||
TmdbExternalIds,
|
||||
} from '../api/themoviedb';
|
||||
|
||||
export interface ProductionCompany {
|
||||
id: number;
|
||||
@@ -33,6 +37,17 @@ export interface Crew {
|
||||
profilePath?: string;
|
||||
}
|
||||
|
||||
export interface ExternalIds {
|
||||
imdbId?: string;
|
||||
freebaseMid?: string;
|
||||
freebaseId?: string;
|
||||
tvdbId?: number;
|
||||
tvrageId?: string;
|
||||
facebookId?: string;
|
||||
instagramId?: string;
|
||||
twitterId?: string;
|
||||
}
|
||||
|
||||
export const mapCast = (person: TmdbCreditCast): Cast => ({
|
||||
castId: person.cast_id,
|
||||
character: person.character,
|
||||
@@ -53,3 +68,14 @@ export const mapCrew = (person: TmdbCreditCrew): Crew => ({
|
||||
gender: person.gender,
|
||||
profilePath: person.profile_path,
|
||||
});
|
||||
|
||||
export const mapExternalIds = (eids: TmdbExternalIds): ExternalIds => ({
|
||||
facebookId: eids.facebook_id,
|
||||
freebaseId: eids.freebase_id,
|
||||
freebaseMid: eids.freebase_mid,
|
||||
imdbId: eids.imdb_id,
|
||||
instagramId: eids.instagram_id,
|
||||
tvdbId: eids.tvdb_id,
|
||||
tvrageId: eids.tvrage_id,
|
||||
twitterId: eids.twitter_id,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user