parent
560f75b7c9
commit
e73fcc1e73
@ -1,16 +0,0 @@ |
||||
import movie1 from '../../resources/movies/3532674.json'; |
||||
import movie2 from '../../resources/movies/5979300.json'; |
||||
import movie3 from '../../resources/movies/11043689.json'; |
||||
import movie4 from '../../resources/movies/11528860.json'; |
||||
import { InternalMoviesProvider } from './types'; |
||||
|
||||
const movies = [movie1, movie2, movie3, movie4]; |
||||
|
||||
export const createInternalMoviesClient = (): InternalMoviesProvider => { |
||||
return { |
||||
getMovieMetadataByInternalId: async (internalId: number) => |
||||
Promise.resolve(movies.find(({ id }) => id == internalId)), |
||||
getMovieMetadataByImdbId: async (id: string) => |
||||
Promise.resolve(movies.find(({ imdbId }) => imdbId == id)), |
||||
}; |
||||
}; |
@ -0,0 +1,16 @@ |
||||
import movie1 from '../../../resources/movies/3532674.json'; |
||||
import movie2 from '../../../resources/movies/5979300.json'; |
||||
import movie3 from '../../../resources/movies/11043689.json'; |
||||
import movie4 from '../../../resources/movies/11528860.json'; |
||||
import { StorageClient } from './types'; |
||||
|
||||
const movies = [movie1, movie2, movie3, movie4]; |
||||
|
||||
export const createStorageClient = (): StorageClient => { |
||||
return { |
||||
getMetadataByInternalId: async (internalId: number) => |
||||
Promise.resolve(movies.find(({ id }) => id == internalId)), |
||||
getMetadataByImdbId: async (id: string) => |
||||
Promise.resolve(movies.find(({ imdbId }) => imdbId == id)), |
||||
}; |
||||
}; |
@ -0,0 +1,41 @@ |
||||
type StoredData = { |
||||
/** |
||||
* Description in local language |
||||
*/ |
||||
description: string; |
||||
/** |
||||
* A whole number of minutes, presumably |
||||
*/ |
||||
duration: number; |
||||
id: number; |
||||
imdbId: string; |
||||
/** |
||||
* Two-letter codes |
||||
*/ |
||||
languages: string[]; |
||||
/** |
||||
* Two-letter code |
||||
*/ |
||||
originalLanguage: string; |
||||
productionYear: number; |
||||
studios: string[]; |
||||
/** |
||||
* Title in local language |
||||
*/ |
||||
title: string; |
||||
userrating: { |
||||
countStar1: number; |
||||
countStar2: number; |
||||
countStar3: number; |
||||
countStar4: number; |
||||
countStar5: number; |
||||
countTotal: number; |
||||
}; |
||||
}; |
||||
|
||||
export type StorageClient = { |
||||
getMetadataByInternalId( |
||||
internalId: number, |
||||
): Promise<StoredData | undefined>; |
||||
getMetadataByImdbId(imdbId: string): Promise<StoredData | undefined>; |
||||
}; |
Loading…
Reference in new issue