Browse Source

chore: updated a bunch of jsdocs, removed comments

Kristian Vos 1 year ago
parent
commit
65ce7dd6d5

+ 1 - 1
backend/core.js

@@ -268,7 +268,7 @@ class Job {
 	}
 
 	/**
-	 * Set whether to job is a long job.
+	 * Set whether this job is a long job.
 	 */
 	keepLongJob() {
 		this.longJob = true;

+ 3 - 18
backend/logic/actions/apis.js

@@ -119,7 +119,7 @@ export default {
 	}),
 
 	/**
-	 *
+	 * Gets alternative media sources for list of Spotify tracks (media sources)
 	 *
 	 * @param session
 	 * @param trackId - the trackId
@@ -147,11 +147,6 @@ export default {
 							message: "Starting up",
 							id: this.toString()
 						});
-						// await CacheModule.runJob(
-						// 	"RPUSH",
-						// 	{ key: `longJobs.${session.userId}`, value: this.toString() },
-						// 	this
-						// );
 
 						SpotifyModule.runJob(
 							"GET_ALTERNATIVE_MEDIA_SOURCES_FOR_TRACKS",
@@ -189,7 +184,7 @@ export default {
 	),
 
 	/**
-	 *
+	 * Gets alternative album sources (such as YouTube playlists) for a list of Spotify album ids
 	 *
 	 * @param session
 	 * @param trackId - the trackId
@@ -217,11 +212,6 @@ export default {
 							message: "Starting up",
 							id: this.toString()
 						});
-						// await CacheModule.runJob(
-						// 	"RPUSH",
-						// 	{ key: `longJobs.${session.userId}`, value: this.toString() },
-						// 	this
-						// );
 
 						SpotifyModule.runJob(
 							"GET_ALTERNATIVE_ALBUM_SOURCES_FOR_ALBUMS",
@@ -258,7 +248,7 @@ export default {
 	),
 
 	/**
-	 *
+	 * Gets a list of alternative artist sources (such as YouTube channels) for a list of Spotify artist ids
 	 *
 	 * @param session
 	 * @param trackId - the trackId
@@ -286,11 +276,6 @@ export default {
 							message: "Starting up",
 							id: this.toString()
 						});
-						// await CacheModule.runJob(
-						// 	"RPUSH",
-						// 	{ key: `longJobs.${session.userId}`, value: this.toString() },
-						// 	this
-						// );
 
 						SpotifyModule.runJob(
 							"GET_ALTERNATIVE_ARTIST_SOURCES_FOR_ARTISTS",

+ 8 - 74
backend/logic/actions/playlists.js

@@ -1197,8 +1197,6 @@ export default {
 	addSongToPlaylist: isLoginRequired(async function addSongToPlaylist(session, isSet, mediaSource, playlistId, cb) {
 		const playlistModel = await DBModule.runJob("GET_MODEL", { modelName: "playlist" }, this);
 
-		console.log(55, isSet, mediaSource, playlistId);
-
 		async.waterfall(
 			[
 				next => {
@@ -1365,12 +1363,12 @@ export default {
 	}),
 
 	/**
-	 * Adds a song to a private playlist
+	 * Replaces a song in a playlist with another song, used to replace Spotify songs with playable songs
 	 *
 	 * @param {object} session - the session object automatically added by the websocket
-	 * @param {string} oldMediaSource -
-	 * @param {string} newMediaSource -
-	 * @param {string} playlistId -
+	 * @param {string} oldMediaSource - the media source of the song to be removed
+	 * @param {string} newMediaSource - the media source of the song to be added
+	 * @param {string} playlistId - the playlist to replace the song in
 	 * @param {Function} cb - gets called with the result
 	 */
 	replaceSongInPlaylist: isLoginRequired(async function replaceSongInPlaylist(
@@ -1459,22 +1457,7 @@ export default {
 					`Successfully replaced song "${oldMediaSource}" with "${newMediaSource}" in private playlist "${playlistId}" for user "${session.userId}".`
 				);
 
-				// if (!isSet && playlist.type === "user" && playlist.privacy === "public") {
-				// 	const songName = newSong.artists
-				// 		? `${newSong.title} by ${newSong.artists.join(", ")}`
-				// 		: newSong.title;
-
-				// 	ActivitiesModule.runJob("ADD_ACTIVITY", {
-				// 		userId: session.userId,
-				// 		type: "playlist__add_song",
-				// 		payload: {
-				// 			message: `Added <mediaSource>${songName}</mediaSource> to playlist <playlistId>${playlist.displayName}</playlistId>`,
-				// 			thumbnail: newSong.thumbnail,
-				// 			playlistId,
-				// 			mediaSource
-				// 		}
-				// 	});
-				// }
+				// NOTE: we may want to publish an activity event here
 
 				CacheModule.runJob("PUB", {
 					channel: "playlist.replaceSong",
@@ -1492,57 +1475,6 @@ export default {
 					value: { playlistId }
 				});
 
-				// if (ratings && (playlist.type === "user-liked" || playlist.type === "user-disliked")) {
-				// 	const { _id, mediaSource, title, artists, thumbnail } = newSong;
-				// 	const { likes, dislikes } = ratings;
-
-				// 	if (_id) SongsModule.runJob("UPDATE_SONG", { songId: _id });
-
-				// 	if (playlist.type === "user-liked") {
-				// 		CacheModule.runJob("PUB", {
-				// 			channel: "ratings.like",
-				// 			value: JSON.stringify({
-				// 				mediaSource,
-				// 				userId: session.userId,
-				// 				likes,
-				// 				dislikes
-				// 			})
-				// 		});
-
-				// 		ActivitiesModule.runJob("ADD_ACTIVITY", {
-				// 			userId: session.userId,
-				// 			type: "song__like",
-				// 			payload: {
-				// 				message: `Liked song <mediaSource>${title} by ${artists.join(", ")}</mediaSource>`,
-				// 				mediaSource,
-				// 				thumbnail
-				// 			}
-				// 		});
-				// 	} else {
-				// 		CacheModule.runJob("PUB", {
-				// 			channel: "ratings.dislike",
-				// 			value: JSON.stringify({
-				// 				mediaSource,
-				// 				userId: session.userId,
-				// 				likes,
-				// 				dislikes
-				// 			})
-				// 		});
-
-				// 		ActivitiesModule.runJob("ADD_ACTIVITY", {
-				// 			userId: session.userId,
-				// 			type: "song__dislike",
-				// 			payload: {
-				// 				message: `Disliked song <mediaSource>${title} by ${artists.join(
-				// 					mediaSource
-				// 				)}</mediaSource>`,
-				// 				mediaSource,
-				// 				thumbnail
-				// 			}
-				// 		});
-				// 	}
-				// }
-
 				return cb({
 					status: "success",
 					message: "Song has been successfully replaced in the playlist",
@@ -1718,6 +1650,8 @@ export default {
 					value: { playlistId }
 				});
 
+				// NOTE: we may want to publish an activity event here
+
 				const message = `Done adding songs. Succesful: ${successful.length}, failed: ${
 					Object.keys(failed).length
 				}, existing: ${existing.length}.`;
@@ -1911,7 +1845,7 @@ export default {
 	),
 
 	/**
-	 * Adds a set of songs to a private playlist
+	 * Adds a set of songs to a user playlist
 	 *
 	 * @param {object} session - the session object automatically added by the websocket
 	 * @param {string} url - the url of the the YouTube playlist

+ 9 - 44
backend/logic/actions/soundcloud.js

@@ -212,45 +212,7 @@ export default {
 									]
 								},
 								specialQueries: {},
-								specialFilters: {
-									// importJob: importJobId => [
-									// 	{
-									// 		$lookup: {
-									// 			from: "importjobs",
-									// 			let: { trackId: "$trackId" },
-									// 			pipeline: [
-									// 				{
-									// 					$match: {
-									// 						_id: mongoose.Types.ObjectId(importJobId)
-									// 					}
-									// 				},
-									// 				{
-									// 					$addFields: {
-									// 						importJob: {
-									// 							$in: ["$$trackId", "$response.successfulVideoIds"]
-									// 						}
-									// 					}
-									// 				},
-									// 				{
-									// 					$project: {
-									// 						importJob: 1,
-									// 						_id: 0
-									// 					}
-									// 				}
-									// 			],
-									// 			as: "importJob"
-									// 		}
-									// 	},
-									// 	{
-									// 		$unwind: "$importJob"
-									// 	},
-									// 	{
-									// 		$set: {
-									// 			importJob: "$importJob.importJob"
-									// 		}
-									// 	}
-									// ]
-								}
+								specialFilters: {}
 							},
 							this
 						)
@@ -265,10 +227,10 @@ export default {
 				async (err, response) => {
 					if (err && err !== true) {
 						err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
-						this.log("ERROR", "SOUNDCLOUD_GET_VIDEOS", `Failed to get SoundCloud tracks. "${err}"`);
+						this.log("ERROR", "SOUNDCLOUD_GET_TRACKS", `Failed to get SoundCloud tracks. "${err}"`);
 						return cb({ status: "error", message: err });
 					}
-					this.log("SUCCESS", "SOUNDCLOUD_GET_VIDEOS", `Fetched SoundCloud tracks successfully.`);
+					this.log("SUCCESS", "SOUNDCLOUD_GET_TRACKS", `Fetched SoundCloud tracks successfully.`);
 					return cb({
 						status: "success",
 						message: "Successfully fetched SoundCloud tracks.",
@@ -282,18 +244,21 @@ export default {
 	/**
 	 * Get a SoundCloud track
 	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param identifier - the identifier of the SoundCloud track
+	 * @param createMissing - whether to create/fetch the SoundCloud track if it's missing
 	 * @returns {{status: string, data: object}}
 	 */
 	getTrack: isLoginRequired(function getTrack(session, identifier, createMissing, cb) {
 		return SoundcloudModule.runJob("GET_TRACK", { identifier, createMissing }, this)
 			.then(res => {
-				this.log("SUCCESS", "SOUNDCLOUD_GET_VIDEO", `Fetching track was successful.`);
+				this.log("SUCCESS", "SOUNDCLOUD_GET_TRACK", `Fetching track was successful.`);
 
-				return cb({ status: "success", message: "Successfully fetched SoundCloud video", data: res.track });
+				return cb({ status: "success", message: "Successfully fetched SoundCloud track", data: res.track });
 			})
 			.catch(async err => {
 				err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
-				this.log("ERROR", "SOUNDCLOUD_GET_VIDEO", `Fetching track failed. "${err}"`);
+				this.log("ERROR", "SOUNDCLOUD_GET_TRACK", `Fetching track failed. "${err}"`);
 				return cb({ status: "error", message: err });
 			});
 	})

+ 6 - 0
backend/logic/actions/spotify.js

@@ -10,6 +10,8 @@ export default {
 	/**
 	 * Fetches tracks from media sources
 	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {array} mediaSources - the media sources to get tracks for
 	 * @returns {{status: string, data: object}}
 	 */
 	getTracksFromMediaSources: useHasPermission(
@@ -39,6 +41,8 @@ export default {
 	/**
 	 * Fetches albums from ids
 	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {array} albumIds - the ids of the Spotify albums to get
 	 * @returns {{status: string, data: object}}
 	 */
 	getAlbumsFromIds: useHasPermission("spotify.getAlbumsFromIds", function getAlbumsFromIds(session, albumIds, cb) {
@@ -57,6 +61,8 @@ export default {
 	/**
 	 * Fetches artists from ids
 	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {array} artistIds - the ids of the Spotify artists to get
 	 * @returns {{status: string, data: object}}
 	 */
 	getArtistsFromIds: useHasPermission(

+ 38 - 16
backend/logic/actions/stations.js

@@ -467,7 +467,7 @@ export default {
 	 * @param sort - the sort object
 	 * @param queries - the queries array
 	 * @param operator - the operator for queries
-	 * @param cb
+	 * @param {Function} cb - gets called with the result
 	 */
 	getData: useHasPermission(
 		"admin.view.stations",
@@ -1210,9 +1210,9 @@ export default {
 	/**
 	 * Toggle votes to skip a station
 	 *
-	 * @param session
+	 * @param {object} session - the session object automatically added by the websocket
 	 * @param stationId - the station id
-	 * @param cb
+	 *  @param {Function} cb - gets called with the result
 	 */
 	toggleSkipVote: isLoginRequired(async function toggleSkipVote(session, stationId, cb) {
 		const stationModel = await DBModule.runJob("GET_MODEL", { modelName: "station" }, this);
@@ -1727,9 +1727,9 @@ export default {
 	/**
 	 * Create a station
 	 *
-	 * @param session
+	 * @param {object} session - the session object automatically added by the websocket
 	 * @param data - the station data
-	 * @param cb
+	 *  @param {Function} cb - gets called with the result
 	 */
 	create: isLoginRequired(async function create(session, data, cb) {
 		const stationModel = await DBModule.runJob("GET_MODEL", { modelName: "station" }, this);
@@ -1896,10 +1896,11 @@ export default {
 	/**
 	 * Adds song to station queue
 	 *
-	 * @param session
+	 * @param {object} session - the session object automatically added by the websocket
 	 * @param stationId - the station id
-	 * @param mediaSource the song id
-	 * @param cb
+	 * @param mediaSource - the song id
+	 * @param requestType - whether the song was autorequested or requested normally
+	 *  @param {Function} cb - gets called with the result
 	 */
 	addToQueue: isLoginRequired(async function addToQueue(session, stationId, mediaSource, requestType, cb) {
 		async.waterfall(
@@ -2489,6 +2490,13 @@ export default {
 		);
 	},
 
+	/**
+	 * Favorites a station
+	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {string} stationId - the station to favorite
+	 * @param {Function} cb - gets called with the result
+	 */
 	favoriteStation: isLoginRequired(async function favoriteStation(session, stationId, cb) {
 		const userModel = await DBModule.runJob("GET_MODEL", { modelName: "user" }, this);
 		async.waterfall(
@@ -2556,6 +2564,13 @@ export default {
 		);
 	}),
 
+	/**
+	 * Unfavorites a station
+	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {string} stationId - the station to unfavorite
+	 * @param {Function} cb - gets called with the result
+	 */
 	unfavoriteStation: isLoginRequired(async function unfavoriteStation(session, stationId, cb) {
 		const userModel = await DBModule.runJob("GET_MODEL", { modelName: "user" }, this);
 
@@ -2613,7 +2628,7 @@ export default {
 	/**
 	 * Clears every station queue
 	 *
-	 * @param {object} session - the session object automatically added by socket.io
+	 * @param {object} session - the session object automatically added by the websocket
 	 * @param {Function} cb - gets called with the result
 	 */
 	clearEveryStationQueue: useHasPermission(
@@ -2668,7 +2683,7 @@ export default {
 	/**
 	 * Reset a station queue
 	 *
-	 * @param {object} session - the session object automatically added by socket.io
+	 * @param {object} session - the session object automatically added by the websocket
 	 * @param {string} stationId - the station id
 	 * @param {Function} cb - gets called with the result
 	 */
@@ -2702,10 +2717,10 @@ export default {
 	/**
 	 * Gets skip votes for a station
 	 *
-	 * @param session
-	 * @param stationId - the station id
-	 * @param stationId - the song id to get skipvotes for
-	 * @param cb
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {string} stationId - the station id
+	 * @param {string} songId - the song id to get skipvotes for
+	 * @param {Function} cb - gets called with the result
 	 */
 
 	getSkipVotes: isLoginRequired(async function getSkipVotes(session, stationId, songId, cb) {
@@ -2754,7 +2769,7 @@ export default {
 	/**
 	 * Add DJ to station
 	 *
-	 * @param {object} session - the session object automatically added by socket.io
+	 * @param {object} session - the session object automatically added by the websocket
 	 * @param {string} stationId - the station id
 	 * @param {string} userId - the dj user id
 	 * @param {Function} cb - gets called with the result
@@ -2789,7 +2804,7 @@ export default {
 	/**
 	 * Remove DJ from station
 	 *
-	 * @param {object} session - the session object automatically added by socket.io
+	 * @param {object} session - the session object automatically added by the websocket
 	 * @param {string} stationId - the station id
 	 * @param {string} userId - the dj user id
 	 * @param {Function} cb - gets called with the result
@@ -2821,6 +2836,13 @@ export default {
 		);
 	},
 
+	/**
+	 * Sets the state of the current user session
+	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {string} newStationState - the new state
+	 * @param {Function} cb - gets called with the result
+	 */
 	setStationState(session, newStationState, cb) {
 		session.stationState = newStationState;
 

+ 19 - 4
backend/logic/actions/youtube.js

@@ -244,7 +244,7 @@ export default {
 	 * @param sort - the sort object
 	 * @param queries - the queries array
 	 * @param operator - the operator for queries
-	 * @param cb
+	 * @param {Function} cb - gets called with the result
 	 */
 	getVideos: useHasPermission(
 		"admin.view.youtubeVideos",
@@ -388,7 +388,7 @@ export default {
 	 * @param sort - the sort object
 	 * @param queries - the queries array
 	 * @param operator - the operator for queries
-	 * @param cb
+	 * @param {Function} cb - gets called with the result
 	 */
 	getChannels: useHasPermission(
 		"admin.view.youtubeChannels",
@@ -441,6 +441,10 @@ export default {
 	/**
 	 * Get a YouTube video
 	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {string} identifier - the identifier of the video to get
+	 * @param {string} createMissing - whether to create the video if it doesn't exist yet
+	 * @param {Function} cb - gets called with the result
 	 * @returns {{status: string, data: object}}
 	 */
 	getVideo: isLoginRequired(function getVideo(session, identifier, createMissing, cb) {
@@ -460,6 +464,9 @@ export default {
 	/**
 	 * Get a YouTube channel from ID
 	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {string} channelId - the YouTube channel id to get
+	 * @param {Function} cb - gets called with the result
 	 * @returns {{status: string, data: object}}
 	 */
 	getChannel: useHasPermission("youtube.getChannel", function getChannel(session, channelId, cb) {
@@ -487,6 +494,9 @@ export default {
 	/**
 	 * Remove YouTube videos
 	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {array} videoIds - the YouTube video ids to remove
+	 * @param {Function} cb - gets called with the result
 	 * @returns {{status: string, data: object}}
 	 */
 	removeVideos: useHasPermission("youtube.removeVideos", async function removeVideos(session, videoIds, cb) {
@@ -530,6 +540,8 @@ export default {
 	/**
 	 * Gets missing YouTube video's from all playlists, stations and songs
 	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {Function} cb - gets called with the result
 	 * @returns {{status: string, data: object}}
 	 */
 	getMissingVideos: useHasPermission("youtube.getMissingVideos", async function getMissingVideos(session, cb) {
@@ -571,8 +583,10 @@ export default {
 	}),
 
 	/**
-	 * Gets missing YouTube video's from all playlists, stations and songs
+	 * Updates YouTube video's from version 1 to version 2, by re-fetching the video's
 	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {Function} cb - gets called with the result
 	 * @returns {{status: string, data: object}}
 	 */
 	updateVideosV1ToV2: useHasPermission("youtube.updateVideosV1ToV2", async function updateVideosV1ToV2(session, cb) {
@@ -768,7 +782,8 @@ export default {
 
 	/**
 	 * Gets missing YouTube channels
-	 *
+	 * @param {object} session - the session object automatically added by the websocket
+	 * @param {Function} cb - gets called with the result
 	 * @returns {{status: string, data: object}}
 	 */
 	getMissingChannels: useHasPermission("youtube.getMissingChannels", function getMissingChannels(session, cb) {

+ 1 - 72
backend/logic/musicbrainz.js

@@ -42,9 +42,6 @@ class _MusicBrainzModule extends CoreClass {
 	constructor() {
 		super("musicbrainz", {
 			concurrency: 10
-			// priorities: {
-			// 	GET_PLAYLIST: 11
-			// }
 		});
 
 		MusicBrainzModule = this;
@@ -62,86 +59,18 @@ class _MusicBrainzModule extends CoreClass {
 			modelName: "genericApiRequest"
 		});
 
-		// this.youtubeVideoModel = this.YoutubeVideoModel = await DBModule.runJob("GET_MODEL", {
-		// 	modelName: "youtubeVideo"
-		// });
-
-		// return new Promise(resolve => {
-		// CacheModule.runJob("SUB", {
-		// 	channel: "youtube.removeYoutubeApiRequest",
-		// 	cb: requestId => {
-		// 		WSModule.runJob("EMIT_TO_ROOM", {
-		// 			room: `view-api-request.${requestId}`,
-		// 			args: ["event:youtubeApiRequest.removed"]
-		// 		});
-
-		// 		WSModule.runJob("EMIT_TO_ROOM", {
-		// 			room: "admin.youtube",
-		// 			args: ["event:admin.youtubeApiRequest.removed", { data: { requestId } }]
-		// 		});
-		// 	}
-		// });
-
-		// CacheModule.runJob("SUB", {
-		// 	channel: "youtube.removeVideos",
-		// 	cb: videoIds => {
-		// 		const videos = Array.isArray(videoIds) ? videoIds : [videoIds];
-		// 		videos.forEach(videoId => {
-		// 			WSModule.runJob("EMIT_TO_ROOM", {
-		// 				room: `view-media.youtube:${videoId}`,
-		// 				args: ["event:youtubeVideo.removed"]
-		// 			});
-
-		// 			WSModule.runJob("EMIT_TO_ROOM", {
-		// 				room: "admin.youtubeVideos",
-		// 				args: ["event:admin.youtubeVideo.removed", { data: { videoId } }]
-		// 			});
-
-		// 			WSModule.runJob("EMIT_TO_ROOMS", {
-		// 				rooms: ["import-album", "edit-songs"],
-		// 				args: ["event:admin.youtubeVideo.removed", { videoId }]
-		// 			});
-		// 		});
-		// 	}
-		// });
-
 		this.rateLimiter = new RateLimitter(1100);
-		// this.requestTimeout = config.get("apis.youtube.requestTimeout");
 		this.requestTimeout = 5000;
 
 		this.axios = axios.create();
-		// this.axios.defaults.raxConfig = {
-		// 	instance: this.axios,
-		// 	retry: config.get("apis.youtube.retryAmount"),
-		// 	noResponseRetries: config.get("apis.youtube.retryAmount")
-		// };
-		// rax.attach(this.axios);
-
-		// this.youtubeApiRequestModel
-		// 	.find(
-		// 		{ date: { $gte: new Date() - 2 * 24 * 60 * 60 * 1000 } },
-		// 		{ date: true, quotaCost: true, _id: false }
-		// 	)
-		// 	.sort({ date: 1 })
-		// 	.exec((err, youtubeApiRequests) => {
-		// 		if (err) console.log("Couldn't load YouTube API requests.");
-		// 		else {
-		// 			this.apiCalls = youtubeApiRequests;
-		// 			resolve();
-		// 		}
-		// 	});
-
-		// 	resolve();
-		// });
 	}
 
 	/**
 	 * Perform MusicBrainz API call
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.url - request url
+	 * @param {string} payload.url - request url
 	 * @param {object} payload.params - request parameters
-	 * @param {object} payload.quotaCost - request quotaCost
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async API_CALL(payload) {

+ 25 - 27
backend/logic/playlists.js

@@ -159,33 +159,31 @@ class _PlaylistsModule extends CoreClass {
 		});
 	}
 
-	// /**
-	//  * Returns a list of youtube ids in all user playlists of the specified user
-	//  *
-	//  * @param {object} payload - object that contains the payload
-	//  * @param {string} payload.userId - the user id
-	//  * @returns {Promise} - returns promise (reject, resolve)
-	//  */
-	// GET_SONG_YOUTUBE_IDS_FROM_PLAYLISTS(payload) {
-	// 	return new Promise((resolve, reject) => {
-	// 		PlaylistsModule.playlistModel.find({ createdBy: payload.userId }, (err, playlists) => {
-	// 			const youtubeIds = new Set();
-
-	// 			if (err) reject(err);
-	// 			else {
-	// 				playlists.forEach(playlist => {
-	// 					playlist.songs.forEach(song => {
-	// 						youtubeIds.add(song.youtubeId);
-	// 					});
-	// 				});
-
-	// 				console.log(Array.from(youtubeIds));
-
-	// 				resolve({ youtubeIds: Array.from(youtubeIds) });
-	// 			}
-	// 		});
-	// 	});
-	// }
+	/**
+	 * Returns a list of youtube ids in all user playlists of the specified user
+	 *
+	 * @param {object} payload - object that contains the payload
+	 * @param {string} payload.userId - the user id
+	 * @returns {Promise} - returns promise (reject, resolve)
+	 */
+	GET_SONG_YOUTUBE_IDS_FROM_USER_PLAYLISTS(payload) {
+		return new Promise((resolve, reject) => {
+			PlaylistsModule.playlistModel.find({ createdBy: payload.userId }, (err, playlists) => {
+				const youtubeIds = new Set();
+
+				if (err) reject(err);
+				else {
+					playlists.forEach(playlist => {
+						playlist.songs.forEach(song => {
+							youtubeIds.add(song.youtubeId);
+						});
+					});
+
+					resolve({ youtubeIds: Array.from(youtubeIds) });
+				}
+			});
+		});
+	}
 
 	/**
 	 * Creates a playlist owned by a user

+ 8 - 11
backend/logic/soundcloud.js

@@ -115,10 +115,6 @@ class _SoundCloudModule extends CoreClass {
 		CacheModule = this.moduleManager.modules.cache;
 		MediaModule = this.moduleManager.modules.media;
 
-		// this.youtubeApiRequestModel = this.YoutubeApiRequestModel = await DBModule.runJob("GET_MODEL", {
-		// 	modelName: "youtubeApiRequest"
-		// });
-
 		this.soundcloudTrackModel = this.SoundCloudTrackModel = await DBModule.runJob("GET_MODEL", {
 			modelName: "soundcloudTrack"
 		});
@@ -232,7 +228,7 @@ class _SoundCloudModule extends CoreClass {
 	 * Perform SoundCloud API get track request
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.params - request parameters
+	 * @param {strubg} payload.trackId - the SoundCloud track id to get
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	API_GET_TRACK(payload) {
@@ -259,14 +255,12 @@ class _SoundCloudModule extends CoreClass {
 	 * Perform SoundCloud API call
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.url - request url
+	 * @param {strubg} payload.url - request url
 	 * @param {object} payload.params - request parameters
-	 * @param {object} payload.quotaCost - request quotaCost
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	API_CALL(payload) {
 		return new Promise((resolve, reject) => {
-			// const { url, params, quotaCost } = payload;
 			const { url } = payload;
 
 			const { soundcloudApiKey } = SoundCloudModule;
@@ -298,7 +292,7 @@ class _SoundCloudModule extends CoreClass {
 	 * Create SoundCloud track
 	 *
 	 * @param {object} payload - an object containing the payload
-	 * @param {string} payload.soundcloudTrack - the soundcloudTrack object
+	 * @param {object} payload.soundcloudTrack - the soundcloudTrack object
 	 * @returns {Promise} - returns a promise (resolve, reject)
 	 */
 	CREATE_TRACK(payload) {
@@ -345,7 +339,7 @@ class _SoundCloudModule extends CoreClass {
 	 *
 	 * @param {object} payload - an object containing the payload
 	 * @param {string} payload.identifier - the soundcloud track ObjectId or track id
-	 * @param {string} payload.createMissing - attempt to fetch and create track if not in db
+	 * @param {boolean} payload.createMissing - attempt to fetch and create track if not in db
 	 * @returns {Promise} - returns a promise (resolve, reject)
 	 */
 	GET_TRACK(payload) {
@@ -610,7 +604,7 @@ class _SoundCloudModule extends CoreClass {
 	 * Get Soundcloud artists
 	 *
 	 * @param {object} payload - an object containing the payload
-	 * @param {string} payload.userPermalinks - an array of Soundcloud user permalinks
+	 * @param {array} payload.userPermalinks - an array of Soundcloud user permalinks
 	 * @returns {Promise} - returns a promise (resolve, reject)
 	 */
 	async GET_ARTISTS_FROM_PERMALINKS(payload) {
@@ -660,6 +654,7 @@ class _SoundCloudModule extends CoreClass {
 	/**
 	 * @param {object} payload - object that contains the payload
 	 * @param {string} payload.url - the url of the SoundCloud resource
+	 * @returns {Promise} - returns a promise (resolve, reject)
 	 */
 	API_RESOLVE(payload) {
 		return new Promise((resolve, reject) => {
@@ -686,6 +681,8 @@ class _SoundCloudModule extends CoreClass {
 	 *
 	 * @param {object} payload - object that contains the payload
 	 * @param {string} payload.artistId - the id of the SoundCloud artist
+	 * @param {string} payload.nextHref - the next url to call
+	 * @returns {Promise} - returns a promise (resolve, reject)
 	 */
 	API_GET_ARTIST_TRACKS(payload) {
 		return new Promise((resolve, reject) => {

+ 19 - 51
backend/logic/spotify.js

@@ -86,10 +86,6 @@ class _SpotifyModule extends CoreClass {
 		SoundcloudModule = this.moduleManager.modules.soundcloud;
 		WikiDataModule = this.moduleManager.modules.wikidata;
 
-		// this.youtubeApiRequestModel = this.YoutubeApiRequestModel = await DBModule.runJob("GET_MODEL", {
-		// 	modelName: "youtubeApiRequest"
-		// });
-
 		this.spotifyTrackModel = this.SpotifyTrackModel = await DBModule.runJob("GET_MODEL", {
 			modelName: "spotifyTrack"
 		});
@@ -191,7 +187,7 @@ class _SpotifyModule extends CoreClass {
 	 * Perform Spotify API get albums request
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.albumIds - the album ids to get
+	 * @param {array} payload.albumIds - the album ids to get
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	API_GET_ALBUMS(payload) {
@@ -221,7 +217,7 @@ class _SpotifyModule extends CoreClass {
 	 * Perform Spotify API get artists request
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.artistIds - the artist ids to get
+	 * @param {array} payload.artistIds - the artist ids to get
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	API_GET_ARTISTS(payload) {
@@ -251,7 +247,7 @@ class _SpotifyModule extends CoreClass {
 	 * Perform Spotify API get track request
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.params - request parameters
+	 * @param {string} payload.trackId - the Spotify track id to get
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	API_GET_TRACK(payload) {
@@ -278,7 +274,8 @@ class _SpotifyModule extends CoreClass {
 	 * Perform Spotify API get playlist request
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.params - request parameters
+	 * @param {string} payload.playlistId - the Spotify playlist id to get songs from
+	 * @param {string} payload.nextUrl - the next URL to use
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	API_GET_PLAYLIST(payload) {
@@ -305,14 +302,12 @@ class _SpotifyModule extends CoreClass {
 	 * Perform Spotify API call
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.url - request url
+	 * @param {string} payload.url - request url
 	 * @param {object} payload.params - request parameters
-	 * @param {object} payload.quotaCost - request quotaCost
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	API_CALL(payload) {
 		return new Promise((resolve, reject) => {
-			// const { url, params, quotaCost } = payload;
 			const { url, params } = payload;
 
 			SpotifyModule.runJob("GET_API_TOKEN", {}, this)
@@ -351,7 +346,7 @@ class _SpotifyModule extends CoreClass {
 	 * Create Spotify track
 	 *
 	 * @param {object} payload - an object containing the payload
-	 * @param {string} payload.spotifyTracks - the spotifyTracks
+	 * @param {array} payload.spotifyTracks - the spotifyTracks
 	 * @returns {Promise} - returns a promise (resolve, reject)
 	 */
 	CREATE_TRACKS(payload) {
@@ -410,7 +405,7 @@ class _SpotifyModule extends CoreClass {
 	 * Create Spotify albums
 	 *
 	 * @param {object} payload - an object containing the payload
-	 * @param {string} payload.spotifyAlbums - the Spotify albums
+	 * @param {array} payload.spotifyAlbums - the Spotify albums
 	 * @returns {Promise} - returns a promise (resolve, reject)
 	 */
 	async CREATE_ALBUMS(payload) {
@@ -440,7 +435,7 @@ class _SpotifyModule extends CoreClass {
 	 * Create Spotify artists
 	 *
 	 * @param {object} payload - an object containing the payload
-	 * @param {string} payload.spotifyArtists - the Spotify artists
+	 * @param {array} payload.spotifyArtists - the Spotify artists
 	 * @returns {Promise} - returns a promise (resolve, reject)
 	 */
 	async CREATE_ARTISTS(payload) {
@@ -470,7 +465,7 @@ class _SpotifyModule extends CoreClass {
 	 * Gets tracks from media sources
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {string} payload.mediaSources - the media sources to get tracks from
+	 * @param {array} payload.mediaSources - the media sources to get tracks from
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async GET_TRACKS_FROM_MEDIA_SOURCES(payload) {
@@ -517,7 +512,7 @@ class _SpotifyModule extends CoreClass {
 	 * Gets albums from Spotify album ids
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {string} payload.albumIds - the Spotify album ids
+	 * @param {array} payload.albumIds - the Spotify album ids
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async GET_ALBUMS_FROM_IDS(payload) {
@@ -560,7 +555,7 @@ class _SpotifyModule extends CoreClass {
 	 * Gets Spotify artists from Spotify artist ids
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {string} payload.artistIds - the Spotify artist ids
+	 * @param {array} payload.artistIds - the Spotify artist ids
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async GET_ARTISTS_FROM_IDS(payload) {
@@ -604,7 +599,7 @@ class _SpotifyModule extends CoreClass {
 	 *
 	 * @param {object} payload - an object containing the payload
 	 * @param {string} payload.identifier - the spotify track ObjectId or track id
-	 * @param {string} payload.createMissing - attempt to fetch and create track if not in db
+	 * @param {boolean} payload.createMissing - attempt to fetch and create track if not in db
 	 * @returns {Promise} - returns a promise (resolve, reject)
 	 */
 	GET_TRACK(payload) {
@@ -767,8 +762,6 @@ class _SpotifyModule extends CoreClass {
 					}
 				}
 			);
-
-			// kind;
 		});
 	}
 
@@ -777,7 +770,7 @@ class _SpotifyModule extends CoreClass {
 	 *
 	 * @param {object} payload - object that contains the payload
 	 * @param {string} payload.artistIds - the Spotify artist ids to try and get alternative artist sources for
-	 * @param {string} payload.collectAlternativeArtistSourcesOrigins - whether to collect the origin of any alternative artist sources found
+	 * @param {boolean} payload.collectAlternativeArtistSourcesOrigins - whether to collect the origin of any alternative artist sources found
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async GET_ALTERNATIVE_ARTIST_SOURCES_FOR_ARTISTS(payload) {
@@ -822,7 +815,7 @@ class _SpotifyModule extends CoreClass {
 	 *
 	 * @param {object} payload - object that contains the payload
 	 * @param {string} payload.artistId - the Spotify artist id to try and get alternative artist sources for
-	 * @param {string} payload.collectAlternativeArtistSourcesOrigins - whether to collect the origin of any alternative artist sources found
+	 * @param {boolean} payload.collectAlternativeArtistSourcesOrigins - whether to collect the origin of any alternative artist sources found
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async GET_ALTERNATIVE_ARTIST_SOURCES_FOR_ARTIST(payload) {
@@ -830,14 +823,6 @@ class _SpotifyModule extends CoreClass {
 
 		if (!artistId) throw new Error("Artist id provided is not valid.");
 
-		// const artist = await SpotifyModule.runJob(
-		// 	"GET_ARTIST",
-		// 	{
-		// 		identifier: artistId
-		// 	},
-		// 	this
-		// );
-
 		const wikiDataResponse = await WikiDataModule.runJob(
 			"API_GET_DATA_FROM_SPOTIFY_ARTIST",
 			{ spotifyArtistId: artistId },
@@ -876,7 +861,7 @@ class _SpotifyModule extends CoreClass {
 	 *
 	 * @param {object} payload - object that contains the payload
 	 * @param {string} payload.albumIds - the Spotify album ids to try and get alternative album sources for
-	 * @param {string} payload.collectAlternativeAlbumSourcesOrigins - whether to collect the origin of any alternative album sources found
+	 * @param {boolean} payload.collectAlternativeAlbumSourcesOrigins - whether to collect the origin of any alternative album sources found
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async GET_ALTERNATIVE_ALBUM_SOURCES_FOR_ALBUMS(payload) {
@@ -921,7 +906,7 @@ class _SpotifyModule extends CoreClass {
 	 *
 	 * @param {object} payload - object that contains the payload
 	 * @param {string} payload.albumId - the Spotify album id to try and get alternative album sources for
-	 * @param {string} payload.collectAlternativeAlbumSourcesOrigins - whether to collect the origin of any alternative album sources found
+	 * @param {boolean} payload.collectAlternativeAlbumSourcesOrigins - whether to collect the origin of any alternative album sources found
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async GET_ALTERNATIVE_ALBUM_SOURCES_FOR_ALBUM(payload) {
@@ -929,14 +914,6 @@ class _SpotifyModule extends CoreClass {
 
 		if (!albumId) throw new Error("Album id provided is not valid.");
 
-		// const album = await SpotifyModule.runJob(
-		// 	"GET_ALBUM",
-		// 	{
-		// 		identifier: albumId
-		// 	},
-		// 	this
-		// );
-
 		const wikiDataResponse = await WikiDataModule.runJob(
 			"API_GET_DATA_FROM_SPOTIFY_ALBUM",
 			{ spotifyAlbumId: albumId },
@@ -959,7 +936,7 @@ class _SpotifyModule extends CoreClass {
 	 *
 	 * @param {object} payload - object that contains the payload
 	 * @param {string} payload.mediaSources - the Spotify media sources to try and get alternative track sources for
-	 * @param {string} payload.collectAlternativeMediaSourcesOrigins - whether to collect the origin of any alternative track sources found
+	 * @param {boolean} payload.collectAlternativeMediaSourcesOrigins - whether to collect the origin of any alternative track sources found
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async GET_ALTERNATIVE_MEDIA_SOURCES_FOR_TRACKS(payload) {
@@ -1004,7 +981,7 @@ class _SpotifyModule extends CoreClass {
 	 *
 	 * @param {object} payload - object that contains the payload
 	 * @param {string} payload.mediaSource - the Spotify media source to try and get alternative track sources for
-	 * @param {string} payload.collectAlternativeMediaSourcesOrigins - whether to collect the origin of any alternative track sources found
+	 * @param {boolean} payload.collectAlternativeMediaSourcesOrigins - whether to collect the origin of any alternative track sources found
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async GET_ALTERNATIVE_MEDIA_SOURCES_FOR_TRACK(payload) {
@@ -1045,9 +1022,6 @@ class _SpotifyModule extends CoreClass {
 				this
 			);
 
-			// console.log("ISRCApiResponse");
-			// console.dir(ISRCApiResponse, { depth: 5 });
-
 			ISRCApiResponse.recordings.forEach(recording => {
 				recording.relations.forEach(relation => {
 					if (relation["target-type"] === "url" && relation.url) {
@@ -1055,8 +1029,6 @@ class _SpotifyModule extends CoreClass {
 						const { resource } = relation.url;
 
 						if (config.get("experimental.soundcloud") && resource.indexOf("soundcloud.com") !== -1) {
-							// throw new Error(`Unable to parse SoundCloud resource ${resource}.`);
-
 							const promise = new Promise(resolve => {
 								SoundcloudModule.runJob(
 									"GET_TRACK_FROM_URL",
@@ -1519,10 +1491,6 @@ class _SpotifyModule extends CoreClass {
 			console.log("Error during getting releases from ISRC", err);
 		}
 
-		// console.log("RecordingApiResponse");
-		// console.dir(RecordingApiResponse, { depth: 10 });
-		// console.dir(RecordingApiResponse.recordings[0].releases[0], { depth: 10 });
-
 		await Promise.allSettled(jobsToRun);
 
 		return {

+ 2 - 2
backend/logic/stations.js

@@ -664,7 +664,7 @@ class _StationsModule extends CoreClass {
 								return true;
 							// Skip songs already in songsToAdd
 							if (songsToAdd.find(songToAdd => songToAdd.mediaSource === song.mediaSource)) return true;
-							// Skips songs already in the queue
+							// Skip songs already in the queue
 							if (currentMediaSources.indexOf(song.mediaSource) !== -1) return true;
 
 							lastSongAdded = song;
@@ -987,7 +987,7 @@ class _StationsModule extends CoreClass {
 	 *
 	 * @param {object} payload - object containing the payload
 	 * @param {string} payload.stationId - the station id to create the history item for
-	 * @param {string} payload.currentSong - the song to create the history item for
+	 * @param {object} payload.currentSong - the song to create the history item for
 	 * @param {string} payload.skipReason - the reason the song was skipped
 	 * @param {string} payload.skippedAt - the date/time the song was skipped
 	 * @returns {Promise} - returns a promise (resolve, reject)

+ 6 - 77
backend/logic/wikidata.js

@@ -41,9 +41,6 @@ class _WikiDataModule extends CoreClass {
 	constructor() {
 		super("wikidata", {
 			concurrency: 10
-			// priorities: {
-			// 	GET_PLAYLIST: 11
-			// }
 		});
 
 		WikiDataModule = this;
@@ -61,84 +58,17 @@ class _WikiDataModule extends CoreClass {
 			modelName: "genericApiRequest"
 		});
 
-		// this.youtubeVideoModel = this.YoutubeVideoModel = await DBModule.runJob("GET_MODEL", {
-		// 	modelName: "youtubeVideo"
-		// });
-
-		// return new Promise(resolve => {
-		// CacheModule.runJob("SUB", {
-		// 	channel: "youtube.removeYoutubeApiRequest",
-		// 	cb: requestId => {
-		// 		WSModule.runJob("EMIT_TO_ROOM", {
-		// 			room: `view-api-request.${requestId}`,
-		// 			args: ["event:youtubeApiRequest.removed"]
-		// 		});
-
-		// 		WSModule.runJob("EMIT_TO_ROOM", {
-		// 			room: "admin.youtube",
-		// 			args: ["event:admin.youtubeApiRequest.removed", { data: { requestId } }]
-		// 		});
-		// 	}
-		// });
-
-		// CacheModule.runJob("SUB", {
-		// 	channel: "youtube.removeVideos",
-		// 	cb: videoIds => {
-		// 		const videos = Array.isArray(videoIds) ? videoIds : [videoIds];
-		// 		videos.forEach(videoId => {
-		// 			WSModule.runJob("EMIT_TO_ROOM", {
-		// 				room: `view-media.youtube:${videoId}`,
-		// 				args: ["event:youtubeVideo.removed"]
-		// 			});
-
-		// 			WSModule.runJob("EMIT_TO_ROOM", {
-		// 				room: "admin.youtubeVideos",
-		// 				args: ["event:admin.youtubeVideo.removed", { data: { videoId } }]
-		// 			});
-
-		// 			WSModule.runJob("EMIT_TO_ROOMS", {
-		// 				rooms: ["import-album", "edit-songs"],
-		// 				args: ["event:admin.youtubeVideo.removed", { videoId }]
-		// 			});
-		// 		});
-		// 	}
-		// });
-
 		this.rateLimiter = new RateLimitter(1100);
-		// this.requestTimeout = config.get("apis.youtube.requestTimeout");
 		this.requestTimeout = 5000;
 
 		this.axios = axios.create();
-		// this.axios.defaults.raxConfig = {
-		// 	instance: this.axios,
-		// 	retry: config.get("apis.youtube.retryAmount"),
-		// 	noResponseRetries: config.get("apis.youtube.retryAmount")
-		// };
-		// rax.attach(this.axios);
-
-		// this.youtubeApiRequestModel
-		// 	.find(
-		// 		{ date: { $gte: new Date() - 2 * 24 * 60 * 60 * 1000 } },
-		// 		{ date: true, quotaCost: true, _id: false }
-		// 	)
-		// 	.sort({ date: 1 })
-		// 	.exec((err, youtubeApiRequests) => {
-		// 		if (err) console.log("Couldn't load YouTube API requests.");
-		// 		else {
-		// 			this.apiCalls = youtubeApiRequests;
-		// 			resolve();
-		// 		}
-		// 	});
-
-		// 	resolve();
-		// });
 	}
 
 	/**
 	 * Get WikiData data from entity url
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.entityUrl - entity url
+	 * @param {string} payload.entityUrl - entity url
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async API_GET_DATA_FROM_ENTITY_URL(payload) {
@@ -168,7 +98,7 @@ class _WikiDataModule extends CoreClass {
 	 * Get WikiData data from work id
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.workId - work id
+	 * @param {strubg} payload.workId - work id
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async API_GET_DATA_FROM_MUSICBRAINZ_WORK(payload) {
@@ -207,7 +137,7 @@ class _WikiDataModule extends CoreClass {
 	 * Get WikiData data from release group id
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.releaseGroupId - release group id
+	 * @param {string} payload.releaseGroupId - release group id
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async API_GET_DATA_FROM_MUSICBRAINZ_RELEASE_GROUP(payload) {
@@ -246,7 +176,7 @@ class _WikiDataModule extends CoreClass {
 	 * Get WikiData data from Spotify album id
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.spotifyAlbumId - Spotify album id
+	 * @param {string} payload.spotifyAlbumId - Spotify album id
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async API_GET_DATA_FROM_SPOTIFY_ALBUM(payload) {
@@ -285,7 +215,7 @@ class _WikiDataModule extends CoreClass {
 	 * Get WikiData data from Spotify artist id
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.spotifyArtistId - Spotify artist id
+	 * @param {string} payload.spotifyArtistId - Spotify artist id
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async API_GET_DATA_FROM_SPOTIFY_ARTIST(payload) {
@@ -326,9 +256,8 @@ class _WikiDataModule extends CoreClass {
 	 * Perform WikiData API call
 	 *
 	 * @param {object} payload - object that contains the payload
-	 * @param {object} payload.url - request url
+	 * @param {string} payload.url - request url
 	 * @param {object} payload.params - request parameters
-	 * @param {object} payload.quotaCost - request quotaCost
 	 * @returns {Promise} - returns promise (reject, resolve)
 	 */
 	async API_CALL(payload) {

+ 5 - 7
backend/logic/youtube.js

@@ -1327,7 +1327,7 @@ class _YouTubeModule extends CoreClass {
 	 * Create YouTube videos
 	 *
 	 * @param {object} payload - an object containing the payload
-	 * @param {string} payload.youtubeVideos - the youtubeVideo object or array of
+	 * @param {array|object} payload.youtubeVideos - the youtubeVideo object or array of
 	 * @returns {Promise} - returns a promise (resolve, reject)
 	 */
 	CREATE_VIDEOS(payload) {
@@ -1373,9 +1373,9 @@ class _YouTubeModule extends CoreClass {
 	 * Get YouTube videos
 	 *
 	 * @param {object} payload - an object containing the payload
-	 * @param {string} payload.identifiers - an array of YouTube video ObjectId's or YouTube ID's
-	 * @param {string} payload.createMissing - attempt to fetch and create video's if not in db
-	 * @param {string} payload.replaceExisting - replace existing
+	 * @param {array} payload.identifiers - an array of YouTube video ObjectId's or YouTube ID's
+	 * @param {boolean} payload.createMissing - attempt to fetch and create video's if not in db
+	 * @param {boolean} payload.replaceExisting - replace existing
 	 * @returns {Promise} - returns a promise (resolve, reject)
 	 */
 	async GET_VIDEOS(payload) {
@@ -1462,8 +1462,6 @@ class _YouTubeModule extends CoreClass {
 
 			const newVideos = await getVideosFromYoutubeIds(missingYoutubeIds);
 
-			// console.dir(newVideos, { depth: 5 });
-
 			await YouTubeModule.runJob("CREATE_VIDEOS", { youtubeVideos: newVideos }, this);
 
 			return { videos: existingVideos.concat(newVideos) };
@@ -1487,7 +1485,7 @@ class _YouTubeModule extends CoreClass {
 	 * Get YouTube channels
 	 *
 	 * @param {object} payload - an object containing the payload
-	 * @param {string} payload.channelIds - an array of YouTube channel id's
+	 * @param {array} payload.channelIds - an array of YouTube channel id's
 	 * @returns {Promise} - returns a promise (resolve, reject)
 	 */
 	async GET_CHANNELS_FROM_IDS(payload) {