Updated all imports to be relative to itself

This commit is contained in:
2022-08-16 01:15:36 +02:00
parent 3660e88acf
commit 7094aa2bb5
70 changed files with 1066 additions and 885 deletions

View File

@@ -1,14 +1,8 @@
const moviedb = require("km-moviedb");
const RedisCache = require("src/cache/redis");
const RedisCache = require("../cache/redis");
const redisCache = new RedisCache();
const {
Movie,
Show,
Person,
Credits,
ReleaseDates
} = require("src/tmdb/types");
const { Movie, Show, Person, Credits, ReleaseDates } = require("./types");
const tmdbErrorResponse = (error, typeString = undefined) => {
if (error.status === 404) {
@@ -107,14 +101,20 @@ class TMDB {
* @returns {Promise} movie release dates object
*/
movieReleaseDates(identifier) {
const query = { id: identifier }
const cacheKey = `tmdb/${this.cacheTags.movieReleaseDates}:${identifier}`
const query = { id: identifier };
const cacheKey = `tmdb/${this.cacheTags.movieReleaseDates}:${identifier}`;
return this.getFromCacheOrFetchFromTmdb(cacheKey, 'movieReleaseDates', query)
.then(releaseDates => this.cache.set(cacheKey, releaseDates, this.defaultTTL))
.then(releaseDates => ReleaseDates.convertFromTmdbResponse(releaseDates))
return this.getFromCacheOrFetchFromTmdb(
cacheKey,
"movieReleaseDates",
query
)
.then(releaseDates =>
this.cache.set(cacheKey, releaseDates, this.defaultTTL)
)
.then(releaseDates => ReleaseDates.convertFromTmdbResponse(releaseDates));
}
/**
* Retrieve a specific show by id from TMDB.
* @param {Number} identifier of the show you want to retrieve