Skip to content

Commit

Permalink
Include TMDB IDs in JSON file
Browse files Browse the repository at this point in the history
  • Loading branch information
sjlu committed Jul 18, 2023
1 parent c7e3463 commit 1c879df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const associateImdbIds = function (movies) {
return getImdbId(movie.id)
.then(function ({ imdbId }) {
movie.imdb_id = imdbId
movie.tmdb_id = movie.id
return movie
})
})
Expand Down Expand Up @@ -77,7 +78,7 @@ const sanatizeForResponse = function (movies) {
return Promise
.resolve(movies)
.map(function (movie) {
return _.pick(movie, ['title', 'imdb_id', 'poster_url'])
return _.pick(movie, ['title', 'tmdb_id', 'imdb_id', 'poster_url'])
})
}

Expand Down Expand Up @@ -108,6 +109,7 @@ const logger = function (movies) {
console.table(movies, [
'id',
'imdb_id',
'tmdb_id',
'title',
'release_date',
'age',
Expand Down
1 change: 1 addition & 0 deletions test/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ describe('all', function () {
expect(movies[0]).must.have.keys([
'title',
'imdb_id',
'tmdb_id',
'poster_url'
])
expect(movies[0].title).to.be.string()
Expand Down

0 comments on commit 1c879df

Please sign in to comment.