Browse Source

Merge remote-tracking branch 'origin/polishing' into owen-manage-station

Owen Diffey 3 years ago
parent
commit
48907d5d8e
53 changed files with 477 additions and 483 deletions
  1. 10 6
      backend/logic/actions/activities.js
  2. 13 10
      backend/logic/actions/apis.js
  3. 1 1
      backend/logic/actions/hooks/adminRequired.js
  4. 1 1
      backend/logic/actions/hooks/loginRequired.js
  5. 1 1
      backend/logic/actions/hooks/ownerRequired.js
  6. 9 9
      backend/logic/actions/news.js
  7. 47 45
      backend/logic/actions/playlists.js
  8. 5 5
      backend/logic/actions/punishments.js
  9. 9 9
      backend/logic/actions/reports.js
  10. 37 35
      backend/logic/actions/songs.js
  11. 51 56
      backend/logic/actions/stations.js
  12. 45 45
      backend/logic/actions/users.js
  13. 9 7
      backend/logic/actions/utils.js
  14. 1 1
      backend/logic/app.js
  15. 2 6
      backend/logic/mail/schemas/passwordRequest.js
  16. 2 6
      backend/logic/mail/schemas/resetPasswordRequest.js
  17. 2 6
      backend/logic/mail/schemas/verifyEmail.js
  18. 1 3
      backend/logic/punishments.js
  19. 7 5
      frontend/src/App.vue
  20. 1 2
      frontend/src/api/auth.js
  21. 1 1
      frontend/src/components/AddToPlaylistDropdown.vue
  22. 2 2
      frontend/src/components/UserIdToUsername.vue
  23. 9 9
      frontend/src/components/modals/AddSongToQueue.vue
  24. 1 1
      frontend/src/components/modals/CreatePlaylist.vue
  25. 1 1
      frontend/src/components/modals/EditNews.vue
  26. 4 4
      frontend/src/components/modals/EditPlaylist.vue
  27. 4 4
      frontend/src/components/modals/EditSong.vue
  28. 9 9
      frontend/src/components/modals/EditStation.vue
  29. 8 8
      frontend/src/components/modals/RequestSong.vue
  30. 1 1
      frontend/src/components/modals/ViewPunishment.vue
  31. 1 1
      frontend/src/components/modals/ViewReport.vue
  32. 9 5
      frontend/src/components/modals/WhatIsNew.vue
  33. 1 1
      frontend/src/mixins/SortablePlaylists.vue
  34. 14 10
      frontend/src/pages/Admin/tabs/HiddenSongs.vue
  35. 16 19
      frontend/src/pages/Admin/tabs/News.vue
  36. 11 22
      frontend/src/pages/Admin/tabs/Playlists.vue
  37. 2 1
      frontend/src/pages/Admin/tabs/Punishments.vue
  38. 2 2
      frontend/src/pages/Admin/tabs/Reports.vue
  39. 2 5
      frontend/src/pages/Admin/tabs/Stations.vue
  40. 6 11
      frontend/src/pages/Admin/tabs/Statistics.vue
  41. 13 10
      frontend/src/pages/Admin/tabs/UnverifiedSongs.vue
  42. 1 2
      frontend/src/pages/Admin/tabs/Users.vue
  43. 13 10
      frontend/src/pages/Admin/tabs/VerifiedSongs.vue
  44. 4 2
      frontend/src/pages/News.vue
  45. 1 2
      frontend/src/pages/Profile/index.vue
  46. 1 1
      frontend/src/pages/Profile/tabs/Playlists.vue
  47. 8 6
      frontend/src/pages/Profile/tabs/RecentActivity.vue
  48. 2 6
      frontend/src/pages/ResetPassword.vue
  49. 2 5
      frontend/src/pages/Settings/index.vue
  50. 7 5
      frontend/src/pages/Settings/tabs/Preferences.vue
  51. 3 3
      frontend/src/pages/Station/Sidebar/Playlists.vue
  52. 59 52
      frontend/src/pages/Station/index.vue
  53. 5 3
      frontend/src/store/modules/user.js

+ 10 - 6
backend/logic/actions/activities.js

@@ -62,12 +62,16 @@ export default {
 						"SONGS_LENGTH",
 						`Failed to get length of activities for user ${userId}. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "ACTIVITIES_LENGTH", `Got length of activities for user ${userId} successfully.`);
 
-				return cb(count);
+				return cb({
+					status: "error",
+					message: "Successfully obtained length of activities.",
+					data: { length: count }
+				});
 			}
 		);
 	},
@@ -119,11 +123,11 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "ACTIVITIES_GET_SET", `Failed to get set ${set} from activities. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "ACTIVITIES_GET_SET", `Set ${set} from activities obtained successfully.`);
-				return cb({ status: "success", data: activities });
+				return cb({ status: "success", data: { activities } });
 			}
 		);
 	},
@@ -148,7 +152,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "ACTIVITIES_HIDE_ACTIVITY", `Failed to hide activity ${activityId}. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				CacheModule.runJob("PUB", {
@@ -197,7 +201,7 @@ export default {
 						`Failed to delete activities for user ${session.userId}. "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				CacheModule.runJob("PUB", {

+ 13 - 10
backend/logic/actions/apis.js

@@ -28,7 +28,7 @@ export default {
 			.catch(async err => {
 				err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 				this.log("ERROR", "APIS_SEARCH_YOUTUBE", `Searching youtube failed with query "${query}". "${err}"`);
-				return cb({ status: "failure", message: err });
+				return cb({ status: "error", message: err });
 			});
 	},
 
@@ -58,7 +58,7 @@ export default {
 					"APIS_SEARCH_YOUTUBE_FOR_PAGE",
 					`Searching youtube failed with query "${query}". "${err}"`
 				);
-				return cb({ status: "failure", message: err });
+				return cb({ status: "error", message: err });
 			});
 	},
 
@@ -97,7 +97,7 @@ export default {
 						"APIS_SEARCH_DISCOGS",
 						`Searching discogs failed with query "${query}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
@@ -106,8 +106,10 @@ export default {
 				);
 				return cb({
 					status: "success",
-					results: body.results,
-					pages: body.pagination.pages
+					data: {
+						results: body.results,
+						pages: body.pagination.pages
+					}
 				});
 			}
 		);
@@ -131,7 +133,8 @@ export default {
 					this.log("ERROR", `Joining room failed: ${err.message}`);
 				});
 		}
-		cb({});
+
+		cb({ status: "success", message: "Successfully joined room." });
 	},
 
 	/**
@@ -152,13 +155,13 @@ export default {
 			page === "users" ||
 			page === "statistics" ||
 			page === "punishments"
-		) {
+		)
 			WSModule.runJob("SOCKET_JOIN_ROOM", {
 				socketId: session.socketId,
 				room: `admin.${page}`
 			});
-		}
-		cb({});
+
+		cb({ status: "success", message: "Successfully joined admin room." });
 	}),
 
 	/**
@@ -168,6 +171,6 @@ export default {
 	 * @param {Function} cb - callback
 	 */
 	ping(session, cb) {
-		cb({ date: Date.now() });
+		cb({ status: "success", message: "Successfully pinged.", data: { date: Date.now() } });
 	}
 };

+ 1 - 1
backend/logic/actions/hooks/adminRequired.js

@@ -42,7 +42,7 @@ export default destination =>
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("INFO", "ADMIN_REQUIRED", `User failed to pass admin required check. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("INFO", "ADMIN_REQUIRED", `User "${session.userId}" passed admin required check.`, false);
 				return destination.apply(this, [session].concat(args));

+ 1 - 1
backend/logic/actions/hooks/loginRequired.js

@@ -32,7 +32,7 @@ export default destination =>
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("LOGIN_REQUIRED", `User failed to pass login required check.`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("LOGIN_REQUIRED", `User "${session.userId}" passed login required check.`);
 				return destination.apply(this, [session].concat(args));

+ 1 - 1
backend/logic/actions/hooks/ownerRequired.js

@@ -56,7 +56,7 @@ export default destination =>
 						"OWNER_REQUIRED",
 						`User failed to pass owner required check for station "${stationId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"INFO",

+ 9 - 9
backend/logic/actions/news.js

@@ -58,10 +58,10 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "NEWS_INDEX", `Indexing news failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "NEWS_INDEX", `Indexing news successful.`, false);
-				return cb({ status: "success", data: news });
+				return cb({ status: "success", data: { news } });
 			}
 		);
 	},
@@ -85,10 +85,10 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "GET_NEWS_FROM_ID", `Getting news failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "GET_NEWS_FROM_ID", `Got news successful.`, false);
-				return cb({ status: "success", data: news });
+				return cb({ status: "success", data: { news } });
 			}
 		);
 	},
@@ -113,7 +113,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "NEWS_CREATE", `Creating news failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				CacheModule.runJob("PUB", { channel: "news.create", value: news });
 				this.log("SUCCESS", "NEWS_CREATE", `Creating news successful.`);
@@ -143,11 +143,11 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "NEWS_NEWEST", `Getting the latest news failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "NEWS_NEWEST", `Successfully got the latest news.`, false);
-				return cb({ status: "success", data: news });
+				return cb({ status: "success", data: { news } });
 			}
 		);
 	},
@@ -171,7 +171,7 @@ export default {
 					"NEWS_REMOVE",
 					`Removing news "${news._id}" failed for user "${session.userId}". "${err}"`
 				);
-				return cb({ status: "failure", message: err });
+				return cb({ status: "error", message: err });
 			}
 			CacheModule.runJob("PUB", { channel: "news.remove", value: news });
 			this.log("SUCCESS", "NEWS_REMOVE", `Removing news "${news._id}" successful by user "${session.userId}".`);
@@ -201,7 +201,7 @@ export default {
 					"NEWS_UPDATE",
 					`Updating news "${_id}" failed for user "${session.userId}". "${err}"`
 				);
-				return cb({ status: "failure", message: err });
+				return cb({ status: "error", message: err });
 			}
 			CacheModule.runJob("PUB", { channel: "news.update", value: news });
 			this.log("SUCCESS", "NEWS_UPDATE", `Updating news "${_id}" successful for user "${session.userId}".`);

+ 47 - 45
backend/logic/actions/playlists.js

@@ -181,10 +181,10 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "PLAYLISTS_INDEX", `Indexing playlists failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "PLAYLISTS_INDEX", "Indexing playlists successful.");
-				return cb({ status: "success", data: playlists });
+				return cb({ status: "success", data: { playlists } });
 			}
 		);
 	}),
@@ -219,7 +219,7 @@ export default {
 						"PLAYLIST_GET_FIRST_SONG",
 						`Getting the first song of playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
@@ -228,7 +228,7 @@ export default {
 				);
 				return cb({
 					status: "success",
-					song
+					data: { song }
 				});
 			}
 		);
@@ -294,14 +294,14 @@ export default {
 						"PLAYLIST_INDEX_FOR_USER",
 						`Indexing playlists for user "${userId}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "PLAYLIST_INDEX_FOR_USER", `Successfully indexed playlists for user "${userId}".`);
 
 				return cb({
 					status: "success",
-					data: playlists
+					data: { playlists }
 				});
 			}
 		);
@@ -355,7 +355,7 @@ export default {
 						"PLAYLIST_INDEX_FOR_ME",
 						`Indexing playlists for user "${session.userId}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
@@ -364,7 +364,7 @@ export default {
 				);
 				return cb({
 					status: "success",
-					data: playlists
+					data: { playlists }
 				});
 			}
 		);
@@ -385,7 +385,7 @@ export default {
 
 		async.waterfall(
 			[
-				next => (data ? next() : cb({ status: "failure", message: "Invalid data" })),
+				next => (data ? next() : cb({ status: "error", message: "Invalid data" })),
 
 				next => {
 					const { displayName, songs, privacy } = data;
@@ -426,7 +426,7 @@ export default {
 						"PLAYLIST_CREATE",
 						`Creating private playlist failed for user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				CacheModule.runJob("PUB", {
@@ -453,7 +453,7 @@ export default {
 					status: "success",
 					message: "Successfully created playlist",
 					data: {
-						_id: playlist._id
+						playlistId: playlist._id
 					}
 				});
 			}
@@ -501,7 +501,7 @@ export default {
 						"PLAYLIST_GET",
 						`Getting private playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -512,7 +512,7 @@ export default {
 
 				return cb({
 					status: "success",
-					data: playlist
+					data: { playlist }
 				});
 			}
 		);
@@ -544,7 +544,7 @@ export default {
 						"PLAYLISTS_GET_PLAYLIST_FOR_ACTIVITY",
 						`Failed to obtain metadata of playlist ${playlistId} for activity formatting. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
@@ -605,7 +605,7 @@ export default {
 						"PLAYLIST_UPDATE",
 						`Updating private playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -616,7 +616,7 @@ export default {
 
 				return cb({
 					status: "success",
-					data: playlist
+					data: { playlist }
 				});
 			}
 		);
@@ -665,7 +665,7 @@ export default {
 						"PLAYLIST_SHUFFLE",
 						`Updating private playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -677,7 +677,7 @@ export default {
 				return cb({
 					status: "success",
 					message: "Successfully shuffled playlist.",
-					data: playlist
+					data: { playlist }
 				});
 			}
 		);
@@ -733,7 +733,7 @@ export default {
 						`Repositioning songs for private playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -827,7 +827,7 @@ export default {
 						"PLAYLIST_MOVE_SONG_TO_BOTTOM",
 						`Moving song "${youtubeId}" to the bottom for private playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -935,7 +935,7 @@ export default {
 						"PLAYLIST_ADD_SONG",
 						`Adding song "${youtubeId}" to private playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -982,7 +982,7 @@ export default {
 				return cb({
 					status: "success",
 					message: "Song has been successfully added to the playlist",
-					data: playlist.songs
+					data: { songs: playlist.songs }
 				});
 			}
 		);
@@ -1084,7 +1084,7 @@ export default {
 						"PLAYLIST_IMPORT",
 						`Importing a YouTube playlist to private playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				ActivitiesModule.runJob("ADD_ACTIVITY", {
@@ -1105,10 +1105,12 @@ export default {
 				return cb({
 					status: "success",
 					message: `Playlist has been imported. ${addSongsStats.successful} were added successfully, ${addSongsStats.failed} failed (${addSongsStats.alreadyInPlaylist} were already in the playlist)`,
-					data: playlist.songs,
-					stats: {
-						videosInPlaylistTotal,
-						songsInPlaylistTotal
+					data: {
+						songs: playlist.songs,
+						stats: {
+							videosInPlaylistTotal,
+							songsInPlaylistTotal
+						}
 					}
 				});
 			}
@@ -1242,7 +1244,7 @@ export default {
 						"PLAYLIST_REMOVE_SONG",
 						`Removing song "${youtubeId}" from private playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1264,7 +1266,7 @@ export default {
 				return cb({
 					status: "success",
 					message: "Song has been successfully removed from playlist",
-					data: playlist.songs
+					data: { songs: playlist.songs }
 				});
 			}
 		);
@@ -1316,7 +1318,7 @@ export default {
 						"PLAYLIST_UPDATE_DISPLAY_NAME",
 						`Updating display name to "${displayName}" for private playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1443,7 +1445,7 @@ export default {
 						"PLAYLIST_REMOVE",
 						`Removing private playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1514,7 +1516,7 @@ export default {
 						`Updating privacy to "${privacy}" for private playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1571,14 +1573,14 @@ export default {
 						"PLAYLISTS_DELETE_ORPHANED_STATION_PLAYLISTS",
 						`Deleting orphaned station playlists failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
 					"PLAYLISTS_DELETE_ORPHANED_STATION_PLAYLISTS",
-					"Deleting orphaned station playlists successfull."
+					"Deleting orphaned station playlists successful."
 				);
-				return cb({ status: "success", message: "Success" });
+				return cb({ status: "success", message: "Successfully deleted orphaned station playlists." });
 			}
 		);
 	}),
@@ -1606,14 +1608,14 @@ export default {
 						"PLAYLISTS_DELETE_ORPHANED_GENRE_PLAYLISTS",
 						`Deleting orphaned genre playlists failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
 					"PLAYLISTS_DELETE_ORPHANED_GENRE_PLAYLISTS",
-					"Deleting orphaned genre playlists successfull."
+					"Deleting orphaned genre playlists successful."
 				);
-				return cb({ status: "success", message: "Success" });
+				return cb({ status: "success", message: "Successfully deleted orphaned genre playlists." });
 			}
 		);
 	}),
@@ -1641,14 +1643,14 @@ export default {
 						"REQUEST_ORPHANED_PLAYLIST_SONGS",
 						`Requesting orphaned playlist songs failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
 					"REQUEST_ORPHANED_PLAYLIST_SONGS",
-					"Requesting orphaned playlist songs was successfull."
+					"Requesting orphaned playlist songs was successful."
 				);
-				return cb({ status: "success", message: "Success" });
+				return cb({ status: "success", message: "Successfully requested orphaned playlist songs." });
 			}
 		);
 	}),
@@ -1686,7 +1688,7 @@ export default {
 						`Clearing and refilling station playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1736,7 +1738,7 @@ export default {
 						`Clearing and refilling genre playlist "${playlistId}" failed for user "${session.userId}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1803,7 +1805,7 @@ export default {
 						`Clearing and refilling all station playlists failed for user "${session.userId}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1870,7 +1872,7 @@ export default {
 						`Clearing and refilling all genre playlists failed for user "${session.userId}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(

+ 5 - 5
backend/logic/actions/punishments.js

@@ -51,10 +51,10 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "PUNISHMENTS_INDEX", `Indexing punishments failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "PUNISHMENTS_INDEX", "Indexing punishments successful.");
-				return cb({ status: "success", data: punishments });
+				return cb({ status: "success", data: { punishments } });
 			}
 		);
 	}),
@@ -88,10 +88,10 @@ export default {
 						"GET_PUNISHMENT_BY_ID",
 						`Getting punishment with id ${punishmentId} failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "GET_PUNISHMENT_BY_ID", `Got punishment with id ${punishmentId} successful.`);
-				return cb({ status: "success", data: punishment });
+				return cb({ status: "success", data: { punishment } });
 			}
 		);
 	}),
@@ -178,7 +178,7 @@ export default {
 						"BAN_IP",
 						`User ${session.userId} failed to ban IP address ${value} with the reason ${reason}. '${err}'`
 					);
-					cb({ status: "failure", message: err });
+					cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",

+ 9 - 9
backend/logic/actions/reports.js

@@ -79,10 +79,10 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "REPORTS_INDEX", `Indexing reports failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "REPORTS_INDEX", "Indexing reports successful.");
-				return cb({ status: "success", data: reports });
+				return cb({ status: "success", data: { reports } });
 			}
 		);
 	}),
@@ -112,10 +112,10 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "REPORTS_FIND_ONE", `Finding report "${reportId}" failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "REPORTS_FIND_ONE", `Finding report "${reportId}" successful.`);
-				return cb({ status: "success", data: report });
+				return cb({ status: "success", data: { report } });
 			}
 		);
 	}),
@@ -156,7 +156,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "GET_REPORTS_FOR_SONG", `Indexing reports for song "${songId}" failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "GET_REPORTS_FOR_SONG", `Indexing reports for song "${songId}" successful.`);
 				return cb({ status: "success", data });
@@ -202,7 +202,7 @@ export default {
 						"REPORTS_RESOLVE",
 						`Resolving report "${reportId}" failed by user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				CacheModule.runJob("PUB", {
 					channel: "report.resolve",
@@ -260,14 +260,14 @@ export default {
 									)
 								) {
 									return cb({
-										status: "failure",
+										status: "error",
 										message: "Invalid data"
 									});
 								}
 							}
 						} else
 							return cb({
-								status: "failure",
+								status: "error",
 								message: "Invalid data"
 							});
 					}
@@ -302,7 +302,7 @@ export default {
 						"REPORTS_CREATE",
 						`Creating report for "${data.song._id}" failed by user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				CacheModule.runJob("PUB", {

+ 37 - 35
backend/logic/actions/songs.js

@@ -259,14 +259,14 @@ export default {
 						"SONGS_LENGTH",
 						`Failed to get length from songs that have the status ${status}. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
 					"SONGS_LENGTH",
 					`Got length from songs that have the status ${status} successfully.`
 				);
-				return cb(count);
+				return cb({ status: "success", message: "Successfully got length of songs.", data: { length: count } });
 			}
 		);
 	}),
@@ -298,10 +298,10 @@ export default {
 						"SONGS_GET_SET",
 						`Failed to get set from songs that have the status ${status}. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "SONGS_GET_SET", `Got set from songs that have the status ${status} successfully.`);
-				return cb(songs);
+				return cb({ status: "success", message: "Successfully got set of songs.", data: { songs } });
 			}
 		);
 	}),
@@ -330,10 +330,10 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "SONGS_GET_SONG", `Failed to get song ${youtubeId}. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "SONGS_GET_SONG", `Got song ${youtubeId} successfully.`);
-				return cb({ status: "success", data: song });
+				return cb({ status: "success", data: { song } });
 			}
 		);
 	}),
@@ -358,7 +358,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "SONGS_GET_SONG_FROM_MUSARE_ID", `Failed to get song ${songId}. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "SONGS_GET_SONG_FROM_MUSARE_ID", `Got song ${songId} successfully.`);
 				return cb({ status: "success", data: { song } });
@@ -392,7 +392,7 @@ export default {
 						`Failed to obtain metadata of song ${youtubeId} for activity formatting. "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				if (song) {
@@ -417,7 +417,7 @@ export default {
 					`Song ${youtubeId} does not exist so failed to obtain for activity formatting.`
 				);
 
-				return cb({ status: "failure" });
+				return cb({ status: "error" });
 			}
 		);
 	},
@@ -467,7 +467,7 @@ export default {
 
 					this.log("ERROR", "SONGS_UPDATE", `Failed to update song "${songId}". "${err}"`);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "SONGS_UPDATE", `Successfully updated song "${songId}".`);
@@ -492,7 +492,7 @@ export default {
 				return cb({
 					status: "success",
 					message: "Song has been successfully updated",
-					data: song
+					data: { song }
 				});
 			}
 		);
@@ -541,7 +541,7 @@ export default {
 
 	// 				this.log("ERROR", "SONGS_REMOVE", `Failed to remove song "${songId}". "${err}"`);
 
-	// 				return cb({ status: "failure", message: err });
+	// 				return cb({ status: "error", message: err });
 	// 			}
 
 	// 			this.log("SUCCESS", "SONGS_REMOVE", `Successfully remove song "${songId}".`);
@@ -593,7 +593,7 @@ export default {
 					"SONGS_REQUEST",
 					`Requesting song "${youtubeId}" failed for user ${session.userId}. "${err}"`
 				);
-				return cb({ status: "failure", message: err });
+				return cb({ status: "error", message: err });
 			});
 	}),
 
@@ -616,7 +616,7 @@ export default {
 			.catch(async err => {
 				err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 				this.log("ERROR", "SONGS_HIDE", `Hiding song "${songId}" failed for user ${session.userId}. "${err}"`);
-				return cb({ status: "failure", message: err });
+				return cb({ status: "error", message: err });
 			});
 	}),
 
@@ -643,7 +643,7 @@ export default {
 					"SONGS_UNHIDE",
 					`Unhiding song "${songId}" failed for user ${session.userId}. "${err}"`
 				);
-				return cb({ status: "failure", message: err });
+				return cb({ status: "error", message: err });
 			});
 	}),
 
@@ -694,7 +694,7 @@ export default {
 
 					this.log("ERROR", "SONGS_VERIFY", `User "${session.userId}" failed to verify song. "${err}"`);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -766,7 +766,7 @@ export default {
 
 					this.log("ERROR", "SONGS_UNVERIFY", `User "${session.userId}" failed to verify song. "${err}"`);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -866,7 +866,7 @@ export default {
 						"REQUEST_SET",
 						`Importing a YouTube playlist to be requested failed for user "${session.userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
@@ -937,7 +937,7 @@ export default {
 
 	// 				this.log("ERROR", "SONGS_ADD", `User "${session.userId}" failed to add song. "${err}"`);
 
-	// 				return cb({ status: "failure", message: err });
+	// 				return cb({ status: "error", message: err });
 	// 			}
 
 	// 			this.log("SUCCESS", "SONGS_ADD", `User "${session.userId}" successfully added song "${song.youtubeId}".`);
@@ -993,7 +993,7 @@ export default {
 							this
 						)
 						.then(res => {
-							if (res.status === "failure")
+							if (res.status === "error")
 								return next("Unable to add song to the 'Liked Songs' playlist.");
 							return next(null, song, user.dislikedSongsPlaylist);
 						})
@@ -1013,7 +1013,7 @@ export default {
 							this
 						)
 						.then(res => {
-							if (res.status === "failure")
+							if (res.status === "error")
 								return next("Unable to remove song from the 'Disliked Songs' playlist.");
 							return next(null, song);
 						})
@@ -1034,7 +1034,7 @@ export default {
 						"SONGS_LIKE",
 						`User "${session.userId}" failed to like song ${youtubeId}. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				SongsModule.runJob("UPDATE_SONG", { songId: song._id });
@@ -1108,7 +1108,7 @@ export default {
 							this
 						)
 						.then(res => {
-							if (res.status === "failure")
+							if (res.status === "error")
 								return next("Unable to add song to the 'Disliked Songs' playlist.");
 							return next(null, song, user.likedSongsPlaylist);
 						})
@@ -1128,7 +1128,7 @@ export default {
 							this
 						)
 						.then(res => {
-							if (res.status === "failure")
+							if (res.status === "error")
 								return next("Unable to remove song from the 'Liked Songs' playlist.");
 							return next(null, song);
 						})
@@ -1149,7 +1149,7 @@ export default {
 						"SONGS_DISLIKE",
 						`User "${session.userId}" failed to dislike song ${youtubeId}. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				SongsModule.runJob("UPDATE_SONG", { songId: song._id });
@@ -1221,7 +1221,7 @@ export default {
 							this
 						)
 						.then(res => {
-							if (res.status === "failure")
+							if (res.status === "error")
 								return next("Unable to remove song from the 'Disliked Songs' playlist.");
 							return next(null, song, user.likedSongsPlaylist);
 						})
@@ -1241,7 +1241,7 @@ export default {
 							this
 						)
 						.then(res => {
-							if (res.status === "failure")
+							if (res.status === "error")
 								return next("Unable to remove song from the 'Liked Songs' playlist.");
 							return next(null, song);
 						})
@@ -1262,7 +1262,7 @@ export default {
 						"SONGS_UNDISLIKE",
 						`User "${session.userId}" failed to undislike song ${youtubeId}. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				SongsModule.runJob("UPDATE_SONG", { songId: song._id });
@@ -1336,7 +1336,7 @@ export default {
 							this
 						)
 						.then(res => {
-							if (res.status === "failure")
+							if (res.status === "error")
 								return next("Unable to remove song from the 'Disliked Songs' playlist.");
 							return next(null, song, user.likedSongsPlaylist);
 						})
@@ -1356,7 +1356,7 @@ export default {
 							this
 						)
 						.then(res => {
-							if (res.status === "failure")
+							if (res.status === "error")
 								return next("Unable to remove song from the 'Liked Songs' playlist.");
 							return next(null, song);
 						})
@@ -1377,7 +1377,7 @@ export default {
 						"SONGS_UNLIKE",
 						`User "${session.userId}" failed to unlike song ${youtubeId}. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				SongsModule.runJob("UPDATE_SONG", { songId: song._id });
@@ -1479,16 +1479,18 @@ export default {
 						"SONGS_GET_OWN_RATINGS",
 						`User "${session.userId}" failed to get ratings for ${youtubeId}. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				const { isLiked, isDisliked } = ratings;
 
 				return cb({
 					status: "success",
-					youtubeId,
-					liked: isLiked,
-					disliked: isDisliked
+					data: {
+						youtubeId,
+						liked: isLiked,
+						disliked: isDisliked
+					}
 				});
 			}
 		);

+ 51 - 56
backend/logic/actions/stations.js

@@ -488,7 +488,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "STATIONS_INDEX", `Indexing stations failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "STATIONS_INDEX", `Indexing stations successful.`, false);
@@ -524,7 +524,7 @@ export default {
 						"STATIONS_GET_STATION_FOR_ACTIVITY",
 						`Failed to obtain metadata of station ${stationId} for activity formatting. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
@@ -573,7 +573,7 @@ export default {
 						"STATION_EXISTS_BY_NAME",
 						`Checking if station "${stationName}" exists failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -582,7 +582,7 @@ export default {
 					`Station "${stationName}" exists successfully.` /* , false */
 				);
 
-				return cb({ status: "success", exists });
+				return cb({ status: "success", data: { exists } });
 			}
 		);
 	},
@@ -618,7 +618,7 @@ export default {
 						"STATION_EXISTS_BY_ID",
 						`Checking if station "${stationId}" exists failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -627,7 +627,7 @@ export default {
 					`Station "${stationId}" exists successfully.` /* , false */
 				);
 
-				return cb({ status: "success", exists });
+				return cb({ status: "success", data: { exists } });
 			}
 		);
 	},
@@ -700,7 +700,7 @@ export default {
 						"STATIONS_GET_PLAYLIST",
 						`Getting playlist for station "${stationId}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -710,7 +710,7 @@ export default {
 					false
 				);
 
-				return cb({ status: "success", data: playlist.songs });
+				return cb({ status: "success", data: { songs: playlist.songs } });
 			}
 		);
 	},
@@ -843,7 +843,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "STATIONS_JOIN", `Joining station "${stationIdentifier}" failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "STATIONS_JOIN", `Joined station "${data._id}" successfully.`);
@@ -912,10 +912,10 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "GET_STATION_BY_ID", `Getting station "${stationId}" failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "GET_STATION_BY_ID", `Got station "${stationId}" successfully.`);
-				return cb({ status: "success", station: data });
+				return cb({ status: "success", data: { station: data } });
 			}
 		);
 	},
@@ -979,14 +979,14 @@ export default {
 						"GET_STATION_INCLUDED_PLAYLISTS_BY_ID",
 						`Getting station "${stationId}"'s included playlists failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
 					"GET_STATION_INCLUDED_PLAYLISTS_BY_ID",
 					`Got station "${stationId}"'s included playlists successfully.`
 				);
-				return cb({ status: "success", playlists });
+				return cb({ status: "success", data: { playlists } });
 			}
 		);
 	},
@@ -1050,14 +1050,14 @@ export default {
 						"GET_STATION_EXCLUDED_PLAYLISTS_BY_ID",
 						`Getting station "${stationId}"'s excluded playlists failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
 					"GET_STATION_EXCLUDED_PLAYLISTS_BY_ID",
 					`Got station "${stationId}"'s excluded playlists successfully.`
 				);
-				return cb({ status: "success", playlists });
+				return cb({ status: "success", data: { playlists } });
 			}
 		);
 	},
@@ -1070,13 +1070,8 @@ export default {
 	 * @param cb
 	 */
 	toggleLock: isOwnerRequired(async function toggleLock(session, stationId, cb) {
-		const stationModel = await DBModule.runJob(
-			"GET_MODEL",
-			{
-				modelName: "station"
-			},
-			this
-		);
+		const stationModel = await DBModule.runJob("GET_MODEL", { modelName: "station" }, this);
+
 		async.waterfall(
 			[
 				next => {
@@ -1107,7 +1102,7 @@ export default {
 						"STATIONS_UPDATE_LOCKED_STATUS",
 						`Toggling the queue lock for station "${stationId}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
@@ -1121,7 +1116,7 @@ export default {
 						locked: station.locked
 					}
 				});
-				return cb({ status: "success", data: station.locked });
+				return cb({ status: "success", data: { locked: station.locked } });
 			}
 		);
 	}),
@@ -1225,7 +1220,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "STATIONS_VOTE_SKIP", `Vote skipping station "${stationId}" failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "STATIONS_VOTE_SKIP", `Vote skipping "${stationId}" successful.`);
 
@@ -1271,7 +1266,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "STATIONS_FORCE_SKIP", `Force skipping station "${stationId}" failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				StationsModule.runJob("SKIP_STATION", { stationId });
 				this.log("SUCCESS", "STATIONS_FORCE_SKIP", `Force skipped station "${stationId}" successfully.`);
@@ -1310,7 +1305,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "STATIONS_LEAVE", `Leaving station "${stationId}" failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "STATIONS_LEAVE", `Left station "${stationId}" successfully.`);
@@ -1322,7 +1317,7 @@ export default {
 				return cb({
 					status: "success",
 					message: "Successfully left station.",
-					userCount
+					data: { userCount }
 				});
 			}
 		);
@@ -1366,7 +1361,7 @@ export default {
 						`Updating station "${stationId}" name to "${newName}" failed. "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1444,7 +1439,7 @@ export default {
 						"STATIONS_UPDATE_DISPLAY_NAME",
 						`Updating station "${stationId}" displayName to "${newDisplayName}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1511,7 +1506,7 @@ export default {
 						"STATIONS_UPDATE_DESCRIPTION",
 						`Updating station "${stationId}" description to "${newDescription}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1592,7 +1587,7 @@ export default {
 						"STATIONS_UPDATE_PRIVACY",
 						`Updating station "${stationId}" privacy to "${newPrivacy}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
@@ -1760,7 +1755,7 @@ export default {
 						"STATIONS_UPDATE_GENRES",
 						`Updating station "${stationId}" genres to "${newGenres}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1941,7 +1936,7 @@ export default {
 						"STATIONS_UPDATE_BLACKLISTED_GENRES",
 						`Updating station "${stationId}" blacklisted genres to "${newBlacklistedGenres}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -2035,7 +2030,7 @@ export default {
 						"STATIONS_UPDATE_PARTY_MODE",
 						`Updating station "${stationId}" party mode to "${newPartyMode}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
@@ -2112,7 +2107,7 @@ export default {
 						"STATIONS_UPDATE_PLAY_MODE",
 						`Updating station "${stationId}" play mode to "${newPlayMode}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
@@ -2181,7 +2176,7 @@ export default {
 						"STATIONS_UPDATE_THEME",
 						`Updating station "${stationId}" theme to "${newTheme}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -2259,7 +2254,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "STATIONS_PAUSE", `Pausing station "${stationId}" failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "STATIONS_PAUSE", `Paused station "${stationId}" successfully.`);
 				CacheModule.runJob("PUB", {
@@ -2328,7 +2323,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "STATIONS_RESUME", `Resuming station "${stationId}" failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "STATIONS_RESUME", `Resuming station "${stationId}" successfully.`);
 				CacheModule.runJob("PUB", {
@@ -2394,7 +2389,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "STATIONS_REMOVE", `Removing station "${stationId}" failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "STATIONS_REMOVE", `Removing station "${stationId}" successfully.`);
@@ -2738,7 +2733,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "STATIONS_CREATE", `Creating station failed. "${err}"`);
-					cb({ status: "failure", message: err });
+					cb({ status: "error", message: err });
 				} else {
 					this.log("SUCCESS", "STATIONS_CREATE", `Created station "${station._id}" successfully.`);
 
@@ -2967,7 +2962,7 @@ export default {
 						"STATIONS_ADD_SONG_TO_QUEUE",
 						`Adding song "${youtubeId}" to station "${stationId}" queue failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -3043,7 +3038,7 @@ export default {
 						"STATIONS_REMOVE_SONG_TO_QUEUE",
 						`Removing song "${youtubeId}" from station "${stationId}" queue failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -3108,7 +3103,7 @@ export default {
 						"STATIONS_GET_QUEUE",
 						`Getting queue for station "${stationId}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "STATIONS_GET_QUEUE", `Got queue for station "${stationId}" successfully.`);
@@ -3116,7 +3111,7 @@ export default {
 				return cb({
 					status: "success",
 					message: "Successfully got queue.",
-					queue
+					data: { queue }
 				});
 			}
 		);
@@ -3178,7 +3173,7 @@ export default {
 						"STATIONS_REPOSITION_SONG_IN_QUEUE",
 						`Repositioning song ${song.youtubeId} in queue of station "${stationId}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -3248,7 +3243,7 @@ export default {
 						"STATIONS_SELECT_PRIVATE_PLAYLIST",
 						`Selecting private playlist "${playlistId}" for station "${stationId}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -3322,7 +3317,7 @@ export default {
 						"STATIONS_DESELECT_PRIVATE_PLAYLIST",
 						`Deselecting private playlist for station "${stationId}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -3385,7 +3380,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "FAVORITE_STATION", `Favoriting station "${stationId}" failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "FAVORITE_STATION", `Favorited station "${stationId}" successfully.`);
@@ -3439,7 +3434,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "UNFAVORITE_STATION", `Unfavoriting station "${stationId}" failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "UNFAVORITE_STATION", `Unfavorited station "${stationId}" successfully.`);
@@ -3488,10 +3483,10 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "CLEAR_EVERY_STATION_QUEUE", `Clearing every station queue failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
-				this.log("SUCCESS", "CLEAR_EVERY_STATION_QUEUE", "Clearing every station queue was successfull.");
-				return cb({ status: "success", message: "Success" });
+				this.log("SUCCESS", "CLEAR_EVERY_STATION_QUEUE", "Clearing every station queue was successful.");
+				return cb({ status: "success", message: "Successfully cleared every station queue." });
 			}
 		);
 	}),
@@ -3520,14 +3515,14 @@ export default {
 						"CLEAR_AND_REFILL_STATION_QUEUE",
 						`Clearing and refilling station queue failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log(
 					"SUCCESS",
 					"CLEAR_AND_REFILL_STATION_QUEUE",
-					"Clearing and refilling station queue was successfull."
+					"Clearing and refilling station queue was successful."
 				);
-				return cb({ status: "success", message: "Success" });
+				return cb({ status: "success", message: "Successfully cleared and refilled station queue." });
 			}
 		);
 	})

+ 45 - 45
backend/logic/actions/users.js

@@ -176,7 +176,7 @@ export default {
 				if (err) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "USER_INDEX", `Indexing users failed. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "USER_INDEX", `Indexing users successful.`);
 				const filteredUsers = [];
@@ -202,7 +202,7 @@ export default {
 						services: { github: user.services.github }
 					});
 				});
-				return cb({ status: "success", data: filteredUsers });
+				return cb({ status: "success", data: { users: filteredUsers } });
 			}
 		);
 	}),
@@ -247,7 +247,7 @@ export default {
 						"USER_REMOVE",
 						`Removing data and account for user "${session.userId}" failed. "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -333,7 +333,7 @@ export default {
 						"USER_PASSWORD_LOGIN",
 						`Login failed with password for user "${identifier}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "USER_PASSWORD_LOGIN", `Login successful with password for user "${identifier}"`);
@@ -341,8 +341,7 @@ export default {
 				return cb({
 					status: "success",
 					message: "Login successful",
-					user: {},
-					SID: sessionId
+					data: { SID: sessionId }
 				});
 			}
 		);
@@ -521,7 +520,7 @@ export default {
 						"USER_PASSWORD_REGISTER",
 						`Register failed with password for user "${username}"."${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				ActivitiesModule.runJob("ADD_ACTIVITY", {
@@ -536,7 +535,7 @@ export default {
 					`Register successful with password for user "${username}".`
 				);
 
-				const result = await this.module.runJob(
+				const res = await this.module.runJob(
 					"RUN_ACTION2",
 					{
 						session,
@@ -551,8 +550,9 @@ export default {
 					status: "success",
 					message: "Successfully registered."
 				};
-				if (result.status === "success") {
-					obj.SID = result.SID;
+
+				if (res.status === "success") {
+					obj.SID = res.data.SID;
 				}
 
 				return cb(obj);
@@ -590,7 +590,7 @@ export default {
 				if (err && err !== true) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "USER_LOGOUT", `Logout failed. "${err}" `);
-					cb({ status: "failure", message: err });
+					cb({ status: "error", message: err });
 				} else {
 					this.log("SUCCESS", "USER_LOGOUT", `Logout successful.`);
 					cb({
@@ -675,7 +675,7 @@ export default {
 						"REMOVE_SESSIONS_FOR_USER",
 						`Couldn't remove all sessions for user "${userId}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 				this.log("SUCCESS", "REMOVE_SESSIONS_FOR_USER", `Removed all sessions for user "${userId}".`);
 				return cb({
@@ -721,7 +721,7 @@ export default {
 						`Couldn't update order of favorite stations for user "${session.userId}" to "${favoriteStations}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				CacheModule.runJob("PUB", {
@@ -777,7 +777,7 @@ export default {
 						`Couldn't update order of playlists for user "${session.userId}" to "${orderOfPlaylists}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				CacheModule.runJob("PUB", {
@@ -850,7 +850,7 @@ export default {
 						)}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				CacheModule.runJob("PUB", {
@@ -929,7 +929,7 @@ export default {
 						`Couldn't retrieve preferences for user "${session.userId}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -941,7 +941,7 @@ export default {
 				return cb({
 					status: "success",
 					message: "Preferences successfully retrieved",
-					data: preferences
+					data: { preferences }
 				});
 			}
 		);
@@ -974,7 +974,7 @@ export default {
 
 					this.log("ERROR", "FIND_BY_USERNAME", `User not found for username "${username}". "${err}"`);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "FIND_BY_USERNAME", `User found for username "${username}".`);
@@ -1013,7 +1013,7 @@ export default {
 
 					return cb({
 						status: "success",
-						data: user.username
+						data: { username: user.username }
 					});
 				}
 
@@ -1024,7 +1024,7 @@ export default {
 				);
 
 				return cb({
-					status: "failure",
+					status: "error",
 					message: "Couldn't find the user."
 				});
 			})
@@ -1036,7 +1036,7 @@ export default {
 						"GET_USERNAME_FROM_ID",
 						`Getting the username from userId "${userId}" failed. "${err}"`
 					);
-					cb({ status: "failure", message: err });
+					cb({ status: "error", message: err });
 				}
 			});
 	},
@@ -1082,7 +1082,7 @@ export default {
 				);
 
 				return cb({
-					status: "failure",
+					status: "error",
 					message: "Couldn't find the user."
 				});
 			})
@@ -1090,7 +1090,7 @@ export default {
 				if (err && err !== true) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "GET_USER_FROM_ID", `Getting the user from userId "${userId}" failed. "${err}"`);
-					cb({ status: "failure", message: err });
+					cb({ status: "error", message: err });
 				}
 			});
 	}),
@@ -1138,10 +1138,10 @@ export default {
 				if (err && err !== true) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "FIND_BY_SESSION", `User not found. "${err}"`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
-				const data = {
+				const sanitisedUser = {
 					email: {
 						address: user.email.address
 					},
@@ -1152,13 +1152,13 @@ export default {
 					bio: user.bio
 				};
 
-				if (user.services.password && user.services.password.password) data.password = true;
-				if (user.services.github && user.services.github.id) data.github = true;
+				if (user.services.password && user.services.password.password) sanitisedUser.password = true;
+				if (user.services.github && user.services.github.id) sanitisedUser.github = true;
 
 				this.log("SUCCESS", "FIND_BY_SESSION", `User found. "${user.username}".`);
 				return cb({
 					status: "success",
-					data
+					data: { user: sanitisedUser }
 				});
 			}
 		);
@@ -1223,7 +1223,7 @@ export default {
 						`Couldn't update username for user "${updatingUserId}" to username "${newUsername}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				CacheModule.runJob("PUB", {
@@ -1335,7 +1335,7 @@ export default {
 						`Couldn't update email for user "${updatingUserId}" to email "${newEmail}". '${err}'`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1399,7 +1399,7 @@ export default {
 						"UPDATE_NAME",
 						`Couldn't update name for user "${updatingUserId}" to name "${newName}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				ActivitiesModule.runJob("ADD_ACTIVITY", {
@@ -1467,7 +1467,7 @@ export default {
 						`Couldn't update location for user "${updatingUserId}" to location "${newLocation}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				ActivitiesModule.runJob("ADD_ACTIVITY", {
@@ -1531,7 +1531,7 @@ export default {
 						"UPDATE_BIO",
 						`Couldn't update bio for user "${updatingUserId}" to bio "${newBio}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				ActivitiesModule.runJob("ADD_ACTIVITY", {
@@ -1591,7 +1591,7 @@ export default {
 						"UPDATE_AVATAR_TYPE",
 						`Couldn't update avatar type for user "${updatingUserId}" to type "${newAvatar.type}". "${err}"`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				ActivitiesModule.runJob("ADD_ACTIVITY", {
@@ -1656,7 +1656,7 @@ export default {
 						`User "${session.userId}" couldn't update role for user "${updatingUserId}" to role "${newRole}". "${err}"`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1737,7 +1737,7 @@ export default {
 						"UPDATE_PASSWORD",
 						`Failed updating user password of user '${session.userId}'. '${err}'.`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "UPDATE_PASSWORD", `User '${session.userId}' updated their password.`);
@@ -1811,7 +1811,7 @@ export default {
 						`UserId '${session.userId}' failed to request password. '${err}'`
 					);
 
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -1860,7 +1860,7 @@ export default {
 				if (err && err !== true) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "VERIFY_PASSWORD_CODE", `Code '${code}' failed to verify. '${err}'`);
-					cb({ status: "failure", message: err });
+					cb({ status: "error", message: err });
 				} else {
 					this.log("SUCCESS", "VERIFY_PASSWORD_CODE", `Code '${code}' successfully verified.`);
 					cb({
@@ -1934,7 +1934,7 @@ export default {
 				if (err && err !== true) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "ADD_PASSWORD_WITH_CODE", `Code '${code}' failed to add password. '${err}'`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "ADD_PASSWORD_WITH_CODE", `Code '${code}' successfully added password.`);
@@ -1981,7 +1981,7 @@ export default {
 						"UNLINK_PASSWORD",
 						`Unlinking password failed for userId '${session.userId}'. '${err}'`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "UNLINK_PASSWORD", `Unlinking password successful for userId '${session.userId}'.`);
@@ -2028,7 +2028,7 @@ export default {
 						"UNLINK_GITHUB",
 						`Unlinking GitHub failed for userId '${session.userId}'. '${err}'`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "UNLINK_GITHUB", `Unlinking GitHub successful for userId '${session.userId}'.`);
@@ -2108,7 +2108,7 @@ export default {
 						"REQUEST_PASSWORD_RESET",
 						`Email '${email}' failed to request password reset. '${err}'`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(
@@ -2151,7 +2151,7 @@ export default {
 				if (err && err !== true) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "VERIFY_PASSWORD_RESET_CODE", `Code '${code}' failed to verify. '${err}'`);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "VERIFY_PASSWORD_RESET_CODE", `Code '${code}' successfully verified.`);
@@ -2224,7 +2224,7 @@ export default {
 						"CHANGE_PASSWORD_WITH_RESET_CODE",
 						`Code '${code}' failed to change password. '${err}'`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log("SUCCESS", "CHANGE_PASSWORD_WITH_RESET_CODE", `Code '${code}' successfully changed password.`);
@@ -2325,7 +2325,7 @@ export default {
 						"BAN_USER_BY_ID",
 						`User ${session.userId} failed to ban user ${userId} with the reason ${reason}. '${err}'`
 					);
-					return cb({ status: "failure", message: err });
+					return cb({ status: "error", message: err });
 				}
 
 				this.log(

+ 9 - 7
backend/logic/actions/utils.js

@@ -37,13 +37,13 @@ export default {
 				if (err && err !== true) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "GET_MODULES", `User ${session.userId} failed to get modules. '${err}'`);
-					cb({ status: "failure", message: err });
+					cb({ status: "error", message: err });
 				} else {
 					this.log("SUCCESS", "GET_MODULES", `User ${session.userId} has successfully got the modules info.`);
 					cb({
 						status: "success",
 						message: "Successfully got modules.",
-						modules
+						data: { modules }
 					});
 				}
 			}
@@ -62,16 +62,18 @@ export default {
 				if (err && err !== true) {
 					err = await UtilsModule.runJob("GET_ERROR", { error: err }, this);
 					this.log("ERROR", "GET_MODULE", `User ${session.userId} failed to get module. '${err}'`);
-					cb({ status: "failure", message: err });
+					cb({ status: "error", message: err });
 				} else {
 					this.log("SUCCESS", "GET_MODULE", `User ${session.userId} has successfully got the module info.`);
 					cb({
 						status: "success",
 						message: "Successfully got module info.",
-						// runningTasks: module.jobQueue.runningTasks,
-						// pausedTasks: module.jobQueue.pausedTasks,
-						// queuedTasks: module.jobQueue.queue,
-						jobStatistics: module.jobStatistics
+						data: {
+							// runningTasks: module.jobQueue.runningTasks,
+							// pausedTasks: module.jobQueue.pausedTasks,
+							// queuedTasks: module.jobQueue.queue,
+							jobStatistics: module.jobStatistics
+						}
 					});
 				}
 			}

+ 1 - 1
backend/logic/app.js

@@ -472,7 +472,7 @@ class _AppModule extends CoreClass {
 							this.log("ERROR", "VERIFY_EMAIL", `Verifying email failed. "${error}"`);
 
 							return res.json({
-								status: "failure",
+								status: "error",
 								message: error
 							});
 						}

+ 2 - 6
backend/logic/mail/schemas/passwordRequest.js

@@ -27,10 +27,6 @@ export default (to, username, code, cb) => {
 	};
 
 	mail.runJob("SEND_MAIL", { data })
-		.then(() => {
-			cb();
-		})
-		.catch(err => {
-			cb(err);
-		});
+		.then(() => cb())
+		.catch(err => cb(err));
 };

+ 2 - 6
backend/logic/mail/schemas/resetPasswordRequest.js

@@ -27,10 +27,6 @@ export default (to, username, code, cb) => {
 	};
 
 	mail.runJob("SEND_MAIL", { data })
-		.then(() => {
-			cb();
-		})
-		.catch(err => {
-			cb(err);
-		});
+		.then(() => cb())
+		.catch(err => cb(err));
 };

+ 2 - 6
backend/logic/mail/schemas/verifyEmail.js

@@ -28,10 +28,6 @@ export default (to, username, code, cb) => {
 	};
 
 	mail.runJob("SEND_MAIL", { data })
-		.then(() => {
-			cb();
-		})
-		.catch(err => {
-			cb(err);
-		});
+		.then(() => cb())
+		.catch(err => cb(err));
 };

+ 1 - 3
backend/logic/punishments.js

@@ -59,9 +59,7 @@ class _PunishmentsModule extends CoreClass {
 											table: "punishments",
 											key: punishmentId
 										})
-											.then(() => {
-												cb();
-											})
+											.then(() => cb())
 											.catch(next);
 									else cb();
 								});

+ 7 - 5
frontend/src/App.vue

@@ -136,14 +136,16 @@ export default {
 		});
 
 		this.socket.dispatch("users.getPreferences", res => {
+			const { preferences } = res.data;
+
 			if (res.status === "success") {
-				this.changeAutoSkipDisliked(res.data.autoSkipDisliked);
-				this.changeNightmode(res.data.nightmode);
-				this.changeActivityLogPublic(res.data.activityLogPublic);
+				this.changeAutoSkipDisliked(preferences.autoSkipDisliked);
+				this.changeNightmode(preferences.nightmode);
+				this.changeActivityLogPublic(preferences.activityLogPublic);
 				this.changeAnonymousSongRequests(
-					res.data.anonymousSongRequests
+					preferences.anonymousSongRequests
 				);
-				this.changeActivityWatch(res.data.activityWatch);
+				this.changeActivityWatch(preferences.activityWatch);
 
 				if (this.nightmode) this.enableNightMode();
 				else this.disableNightMode();

+ 1 - 2
frontend/src/api/auth.js

@@ -53,7 +53,6 @@ export default {
 			const { email, password } = user;
 
 			ws.socket.dispatch("users.login", email, password, res => {
-				console.log(123, res);
 				if (res.status === "success") {
 					return lofig.get("cookie").then(cookie => {
 						const date = new Date();
@@ -65,7 +64,7 @@ export default {
 						if (cookie.domain !== "localhost")
 							domain = ` domain=${cookie.domain};`;
 						document.cookie = `${cookie.SIDname}=${
-							res.SID
+							res.data.SID
 						}; expires=${date.toGMTString()}; ${domain}${secure}path=/`;
 						return resolve({ status: "success" });
 					});

+ 1 - 1
frontend/src/components/AddToPlaylistDropdown.vue

@@ -73,7 +73,7 @@ export default {
 	mounted() {
 		this.socket.dispatch("playlists.indexMyPlaylists", false, res => {
 			if (res.status === "success") {
-				this.playlists = res.data;
+				this.playlists = res.data.playlists;
 			}
 		});
 

+ 2 - 2
frontend/src/components/UserIdToUsername.vue

@@ -25,8 +25,8 @@ export default {
 		};
 	},
 	mounted() {
-		this.getUsernameFromId(this.$props.userId).then(res => {
-			if (res) this.username = res;
+		this.getUsernameFromId(this.$props.userId).then(username => {
+			if (username) this.username = username;
 		});
 	},
 	methods: {

+ 9 - 9
frontend/src/components/modals/AddSongToQueue.vue

@@ -237,7 +237,7 @@ export default {
 	},
 	mounted() {
 		this.socket.dispatch("playlists.indexMyPlaylists", true, res => {
-			if (res.status === "success") this.playlists = res.data;
+			if (res.status === "success") this.playlists = res.data.playlists;
 		});
 	},
 	methods: {
@@ -261,26 +261,26 @@ export default {
 					"stations.addToQueue",
 					this.station._id,
 					youtubeId,
-					data => {
-						if (data.status !== "success")
-							new Toast(`Error: ${data.message}`);
+					res => {
+						if (res.status !== "success")
+							new Toast(`Error: ${res.message}`);
 						else {
 							this.search.songs.results[
 								index
 							].isAddedToQueue = true;
 
-							new Toast(data.message);
+							new Toast(res.message);
 						}
 					}
 				);
 			} else {
-				this.socket.dispatch("songs.request", youtubeId, data => {
-					if (data.status !== "success")
-						new Toast(`Error: ${data.message}`);
+				this.socket.dispatch("songs.request", youtubeId, res => {
+					if (res.status !== "success")
+						new Toast(`Error: ${res.message}`);
 					else {
 						this.search.songs.results[index].isAddedToQueue = true;
 
-						new Toast(data.message);
+						new Toast(res.message);
 					}
 				});
 			}

+ 1 - 1
frontend/src/components/modals/CreatePlaylist.vue

@@ -77,7 +77,7 @@ export default {
 							sector: "station",
 							modal: "createPlaylist"
 						});
-						this.editPlaylist(res.data._id);
+						this.editPlaylist(res.data.playlistId);
 						this.openModal({
 							sector: "station",
 							modal: "editPlaylist"

+ 1 - 1
frontend/src/components/modals/EditNews.vue

@@ -176,7 +176,7 @@ export default {
 	mounted() {
 		this.socket.dispatch(`news.getNewsFromId`, this.newsId, res => {
 			if (res.status === "success") {
-				const news = res.data;
+				const { news } = res.data;
 				this.editNews(news);
 			} else {
 				new Toast("News with that ID not found");

+ 4 - 4
frontend/src/components/modals/EditPlaylist.vue

@@ -436,9 +436,9 @@ export default {
 	mounted() {
 		this.socket.dispatch("playlists.getPlaylist", this.editing, res => {
 			if (res.status === "success") {
-				this.playlist = res.data;
+				this.playlist = res.data.playlist;
 				this.playlist.songs.sort((a, b) => a.position - b.position);
-				this.playlist.oldId = res.data._id;
+				this.playlist.oldId = res.data.playlist._id;
 			} else new Toast(res.message);
 		});
 
@@ -531,7 +531,7 @@ export default {
 						isImportingPlaylist = false;
 						if (this.search.playlist.isImportingOnlyMusic) {
 							new Toast({
-								content: `${res.stats.songsInPlaylistTotal} of the ${res.stats.videosInPlaylistTotal} videos in the playlist were songs.`,
+								content: `${res.data.stats.songsInPlaylistTotal} of the ${res.data.stats.videosInPlaylistTotal} videos in the playlist were songs.`,
 								timeout: 20000
 							});
 						}
@@ -582,7 +582,7 @@ export default {
 				res => {
 					new Toast(res.message);
 					if (res.status === "success") {
-						this.playlist.songs = res.data.songs.sort(
+						this.playlist.songs = res.data.playlist.songs.sort(
 							(a, b) => a.position - b.position
 						);
 					}

+ 4 - 4
frontend/src/components/modals/EditSong.vue

@@ -1131,21 +1131,21 @@ export default {
 				if (res.status === "success") {
 					if (page === 1)
 						new Toast(
-							`Successfully searched. Got ${res.results.length} results.`
+							`Successfully searched. Got ${res.data.results.length} results.`
 						);
 					else
 						new Toast(
-							`Successfully got ${res.results.length} more results.`
+							`Successfully got ${res.data.results.length} more results.`
 						);
 
 					if (page === 1) {
 						this.discogs.apiResults = [];
 					}
 
-					this.discogs.pages = res.pages;
+					this.discogs.pages = res.data.pages;
 
 					this.discogs.apiResults = this.discogs.apiResults.concat(
-						res.results.map(result => {
+						res.data.results.map(result => {
 							const type =
 								result.type.charAt(0).toUpperCase() +
 								result.type.slice(1);

+ 9 - 9
frontend/src/components/modals/EditStation.vue

@@ -585,7 +585,7 @@ export default {
 	mounted() {
 		this.socket.dispatch(`stations.getStationById`, this.stationId, res => {
 			if (res.status === "success") {
-				const { station } = res;
+				const { station } = res.data;
 				// this.song = { ...song };
 				// if (this.song.discogs === undefined)
 				// 	this.song.discogs = null;
@@ -599,7 +599,7 @@ export default {
 					res => {
 						if (res.status === "success") {
 							this.setGenres(
-								res.playlists.map(playlist => {
+								res.data.playlists.map(playlist => {
 									if (playlist) {
 										if (playlist.type === "genre")
 											return playlist.createdFor;
@@ -621,7 +621,7 @@ export default {
 					res => {
 						if (res.status === "success") {
 							this.setBlacklistedGenres(
-								res.playlists.map(playlist => {
+								res.data.playlists.map(playlist => {
 									if (playlist) {
 										if (playlist.type === "genre")
 											return playlist.createdFor;
@@ -935,10 +935,10 @@ export default {
 				res => {
 					if (res.status === "success") {
 						if (this.originalStation)
-							this.originalStation.locked = res.data;
+							this.originalStation.locked = res.data.locked;
 
 						new Toast(
-							`Toggled queue lock successfully to ${res.data}`
+							`Toggled queue lock successfully to ${res.data.locked}`
 						);
 
 						return this.$refs.saveButton.handleSuccessfulSave();
@@ -1081,13 +1081,13 @@ export default {
 			this.socket.dispatch(
 				"stations.clearAndRefillStationQueue",
 				this.station._id,
-				data => {
-					if (data.status !== "success")
+				res => {
+					if (res.status !== "success")
 						new Toast({
-							content: `Error: ${data.message}`,
+							content: `Error: ${res.message}`,
 							timeout: 8000
 						});
-					else new Toast({ content: data.message, timeout: 4000 });
+					else new Toast({ content: res.message, timeout: 4000 });
 				}
 			);
 		},

+ 8 - 8
frontend/src/components/modals/RequestSong.vue

@@ -168,26 +168,26 @@ export default {
 					"stations.addToQueue",
 					this.station._id,
 					youtubeId,
-					data => {
-						if (data.status !== "success")
-							new Toast(`Error: ${data.message}`);
+					res => {
+						if (res.status !== "success")
+							new Toast(`Error: ${res.message}`);
 						else {
 							this.search.songs.results[
 								index
 							].isAddedToQueue = true;
 
-							new Toast(data.message);
+							new Toast(res.message);
 						}
 					}
 				);
 			} else {
-				this.socket.dispatch("songs.request", youtubeId, data => {
-					if (data.status !== "success")
-						new Toast(`Error: ${data.message}`);
+				this.socket.dispatch("songs.request", youtubeId, res => {
+					if (res.status !== "success")
+						new Toast(`Error: ${res.message}`);
 					else {
 						this.search.songs.results[index].isAddedToQueue = true;
 
-						new Toast(data.message);
+						new Toast(res.message);
 					}
 				});
 			}

+ 1 - 1
frontend/src/components/modals/ViewPunishment.vue

@@ -93,7 +93,7 @@ export default {
 			this.punishmentId,
 			res => {
 				if (res.status === "success") {
-					const punishment = res.data;
+					const { punishment } = res.data;
 					this.viewPunishment(punishment);
 				} else {
 					new Toast("Punishment with that ID not found");

+ 1 - 1
frontend/src/components/modals/ViewReport.vue

@@ -105,7 +105,7 @@ export default {
 
 		this.socket.dispatch(`reports.findOne`, this.reportId, res => {
 			if (res.status === "success") {
-				const report = res.data;
+				const { report } = res.data;
 				this.viewReport(report);
 			} else {
 				new Toast("Report with that ID not found");

+ 9 - 5
frontend/src/components/modals/WhatIsNew.vue

@@ -83,24 +83,28 @@ export default {
 	}),
 	mounted() {
 		this.socket.dispatch("news.newest", res => {
-			this.news = res.data;
+			if (res.status !== "success") return;
+
+			const { news } = res.data;
+
+			this.news = news;
 			if (this.news && localStorage.getItem("firstVisited")) {
 				if (localStorage.getItem("whatIsNew")) {
 					if (
 						parseInt(localStorage.getItem("whatIsNew")) <
-						res.data.createdAt
+						news.createdAt
 					) {
 						this.toggleModal();
-						localStorage.setItem("whatIsNew", res.data.createdAt);
+						localStorage.setItem("whatIsNew", news.createdAt);
 					}
 				} else {
 					if (
 						parseInt(localStorage.getItem("firstVisited")) <
-						res.data.createdAt
+						news.createdAt
 					) {
 						this.toggleModal();
 					}
-					localStorage.setItem("whatIsNew", res.data.createdAt);
+					localStorage.setItem("whatIsNew", news.createdAt);
 				}
 			} else if (!localStorage.getItem("firstVisited"))
 				localStorage.setItem("firstVisited", Date.now());

+ 1 - 1
frontend/src/mixins/SortablePlaylists.vue

@@ -45,7 +45,7 @@ export default {
 				"users.updateOrderOfPlaylists",
 				recalculatedOrder,
 				res => {
-					if (res.status === "failure") return new Toast(res.message);
+					if (res.status === "error") return new Toast(res.message);
 
 					this.orderOfPlaylists = this.calculatePlaylistOrder(); // new order in regards to the database
 					return new Toast(res.message);

+ 14 - 10
frontend/src/pages/Admin/tabs/HiddenSongs.vue

@@ -254,13 +254,15 @@ export default {
 				"songs.getSet",
 				this.position,
 				"hidden",
-				data => {
-					data.forEach(song => {
-						this.addSong(song);
-					});
+				res => {
+					if (res.status === "success") {
+						res.data.songs.forEach(song => {
+							this.addSong(song);
+						});
 
-					this.position += 1;
-					this.isGettingSet = false;
+						this.position += 1;
+						this.isGettingSet = false;
+					}
 				}
 			);
 		},
@@ -282,10 +284,12 @@ export default {
 			if (this.songs.length > 0)
 				this.position = Math.ceil(this.songs.length / 15) + 1;
 
-			this.socket.dispatch("songs.length", "hidden", length => {
-				this.maxPosition = Math.ceil(length / 15) + 1;
-
-				this.getSet();
+			this.socket.dispatch("songs.length", "hidden", res => {
+				if (res.status === "success") {
+					this.maxPosition = Math.ceil(res.data.length / 15) + 1;
+					return this.getSet();
+				}
+				return new Toast(`Error: ${res.mesage}`);
 			});
 
 			this.socket.dispatch("apis.joinAdminRoom", "hiddenSongs", () => {});

+ 16 - 19
frontend/src/pages/Admin/tabs/News.vue

@@ -249,9 +249,10 @@ export default {
 		})
 	},
 	mounted() {
-		this.socket.dispatch("news.index", res =>
-			res.data.forEach(news => this.addNews(news))
-		);
+		this.socket.dispatch("news.index", res => {
+			if (res.status === "success")
+				res.data.news.forEach(news => this.addNews(news));
+		});
 
 		this.socket.on("event:admin.news.created", news => this.addNews(news));
 
@@ -284,22 +285,18 @@ export default {
 			)
 				return new Toast("You must have at least one News Item");
 
-			return this.socket.dispatch(
-				"news.create",
-				this.creating,
-				result => {
-					new Toast(result.message, 4000);
-					if (result.status === "success")
-						this.creating = {
-							title: "",
-							description: "",
-							bugs: [],
-							features: [],
-							improvements: [],
-							upcoming: []
-						};
-				}
-			);
+			return this.socket.dispatch("news.create", this.creating, res => {
+				new Toast(res.message, 4000);
+				if (res.status === "success")
+					this.creating = {
+						title: "",
+						description: "",
+						bugs: [],
+						features: [],
+						improvements: [],
+						upcoming: []
+					};
+			});
 		},
 		remove(news) {
 			this.socket.dispatch(

+ 11 - 22
frontend/src/pages/Admin/tabs/Playlists.vue

@@ -130,7 +130,7 @@ export default {
 		init() {
 			this.socket.dispatch("playlists.index", res => {
 				if (res.status === "success") {
-					this.playlists = res.data;
+					this.playlists = res.data.playlists;
 					// if (this.$route.query.userId) {
 					// 	const user = this.users.find(
 					// 		user => user._id === this.$route.query.userId
@@ -161,11 +161,8 @@ export default {
 			this.socket.dispatch(
 				"playlists.deleteOrphanedStationPlaylists",
 				res => {
-					if (res.status === "success") {
-						new Toast(res.message);
-					} else {
-						new Toast(`Error: ${res.message}`);
-					}
+					if (res.status === "success") new Toast(res.message);
+					else new Toast(`Error: ${res.message}`);
 				}
 			);
 		},
@@ -173,11 +170,8 @@ export default {
 			this.socket.dispatch(
 				"playlists.deleteOrphanedGenrePlaylists",
 				res => {
-					if (res.status === "success") {
-						new Toast(res.message);
-					} else {
-						new Toast(`Error: ${res.message}`);
-					}
+					if (res.status === "success") new Toast(res.message);
+					else new Toast(`Error: ${res.message}`);
 				}
 			);
 		},
@@ -185,11 +179,8 @@ export default {
 			this.socket.dispatch(
 				"playlists.requestOrphanedPlaylistSongs",
 				res => {
-					if (res.status === "success") {
-						new Toast(res.message);
-					} else {
-						new Toast(`Error: ${res.message}`);
-					}
+					if (res.status === "success") new Toast(res.message);
+					else new Toast(`Error: ${res.message}`);
 				}
 			);
 		},
@@ -197,14 +188,13 @@ export default {
 			this.socket.dispatch(
 				"playlists.clearAndRefillAllStationPlaylists",
 				res => {
-					if (res.status === "success") {
+					if (res.status === "success")
 						new Toast({ content: res.message, timeout: 4000 });
-					} else {
+					else
 						new Toast({
 							content: `Error: ${res.message}`,
 							timeout: 4000
 						});
-					}
 				}
 			);
 		},
@@ -212,14 +202,13 @@ export default {
 			this.socket.dispatch(
 				"playlists.clearAndRefillAllGenrePlaylists",
 				res => {
-					if (res.status === "success") {
+					if (res.status === "success")
 						new Toast({ content: res.message, timeout: 4000 });
-					} else {
+					else
 						new Toast({
 							content: `Error: ${res.message}`,
 							timeout: 4000
 						});
-					}
 				}
 			);
 		},

+ 2 - 1
frontend/src/pages/Admin/tabs/Punishments.vue

@@ -151,7 +151,8 @@ export default {
 		},
 		init() {
 			this.socket.dispatch("punishments.index", res => {
-				if (res.status === "success") this.punishments = res.data;
+				if (res.status === "success")
+					this.punishments = res.data.punishments;
 			});
 			this.socket.dispatch("apis.joinAdminRoom", "punishments", () => {});
 		},

+ 2 - 2
frontend/src/pages/Admin/tabs/Reports.vue

@@ -98,7 +98,7 @@ export default {
 		ws.onConnect(() => this.init());
 
 		this.socket.dispatch("reports.index", res => {
-			this.reports = res.data;
+			if (res.status === "success") this.reports = res.data.reports;
 		});
 
 		this.socket.on("event:admin.report.resolved", reportId => {
@@ -116,7 +116,7 @@ export default {
 				"reports.findOne",
 				this.$route.query.id,
 				res => {
-					if (res.status === "success") this.view(res.data);
+					if (res.status === "success") this.view(res.data.report);
 					else new Toast("Report with that ID not found");
 				}
 			);

+ 2 - 5
frontend/src/pages/Admin/tabs/Stations.vue

@@ -319,11 +319,8 @@ export default {
 		},
 		clearEveryStationQueue() {
 			this.socket.dispatch("stations.clearEveryStationQueue", res => {
-				if (res.status === "success") {
-					new Toast(res.message);
-				} else {
-					new Toast(`Error: ${res.message}`);
-				}
+				if (res.status === "success") new Toast(res.message);
+				else new Toast(`Error: ${res.message}`);
 			});
 		},
 		init() {

+ 6 - 11
frontend/src/pages/Admin/tabs/Statistics.vue

@@ -212,25 +212,20 @@ export default {
 	},
 	methods: {
 		init() {
-			this.socket.dispatch("utils.getModules", data => {
-				console.log(data);
-				if (data.status === "success") {
-					this.modules = data.modules;
-				}
+			this.socket.dispatch("utils.getModules", res => {
+				if (res.status === "success") this.modules = res.data.modules;
 			});
 
 			if (this.$route.query.moduleName) {
 				this.socket.dispatch(
 					"utils.getModule",
 					this.$route.query.moduleName,
-					data => {
-						console.log(data);
-						if (data.status === "success") {
+					res => {
+						if (res.status === "success")
 							this.module = {
-								runningJobs: data.runningJobs,
-								jobStatistics: data.jobStatistics
+								runningJobs: res.data.runningJobs,
+								jobStatistics: res.data.jobStatistics
 							};
-						}
 					}
 				);
 			}

+ 13 - 10
frontend/src/pages/Admin/tabs/UnverifiedSongs.vue

@@ -280,13 +280,15 @@ export default {
 				"songs.getSet",
 				this.position,
 				"unverified",
-				data => {
-					data.forEach(song => {
-						this.addSong(song);
-					});
+				res => {
+					if (res.status === "success") {
+						res.data.songs.forEach(song => {
+							this.addSong(song);
+						});
 
-					this.position += 1;
-					this.isGettingSet = false;
+						this.position += 1;
+						this.isGettingSet = false;
+					}
 				}
 			);
 		},
@@ -308,10 +310,11 @@ export default {
 			if (this.songs.length > 0)
 				this.position = Math.ceil(this.songs.length / 15) + 1;
 
-			this.socket.dispatch("songs.length", "unverified", length => {
-				this.maxPosition = Math.ceil(length / 15) + 1;
-
-				this.getSet();
+			this.socket.dispatch("songs.length", "unverified", res => {
+				if (res.status === "success") {
+					this.maxPosition = Math.ceil(res.data.length / 15) + 1;
+					this.getSet();
+				}
 			});
 
 			this.socket.dispatch(

+ 1 - 2
frontend/src/pages/Admin/tabs/Users.vue

@@ -101,9 +101,8 @@ export default {
 		},
 		init() {
 			this.socket.dispatch("users.index", res => {
-				console.log(res);
 				if (res.status === "success") {
-					this.users = res.data;
+					this.users = res.data.users;
 					if (this.$route.query.userId) {
 						const user = this.users.find(
 							user => user._id === this.$route.query.userId

+ 13 - 10
frontend/src/pages/Admin/tabs/VerifiedSongs.vue

@@ -369,13 +369,15 @@ export default {
 				"songs.getSet",
 				this.position,
 				"verified",
-				data => {
-					data.forEach(song => {
-						this.addSong(song);
-					});
+				res => {
+					if (res.status === "success") {
+						res.data.songs.forEach(song => {
+							this.addSong(song);
+						});
 
-					this.position += 1;
-					this.isGettingSet = false;
+						this.position += 1;
+						this.isGettingSet = false;
+					}
 				}
 			);
 		},
@@ -407,10 +409,11 @@ export default {
 			if (this.songs.length > 0)
 				this.position = Math.ceil(this.songs.length / 15) + 1;
 
-			this.socket.dispatch("songs.length", "verified", length => {
-				this.maxPosition = Math.ceil(length / 15) + 1;
-
-				this.getSet();
+			this.socket.dispatch("songs.length", "verified", res => {
+				if (res.status === "success") {
+					this.maxPosition = Math.ceil(res.data.length / 15) + 1;
+					this.getSet();
+				}
 			});
 
 			this.socket.dispatch("apis.joinAdminRoom", "songs", () => {});

+ 4 - 2
frontend/src/pages/News.vue

@@ -102,8 +102,10 @@ export default {
 	}),
 	mounted() {
 		this.socket.dispatch("news.index", res => {
-			this.news = res.data;
-			if (this.news.length === 0) this.noFound = true;
+			if (res.status === "success") {
+				this.news = res.data.news;
+				if (this.news.length === 0) this.noFound = true;
+			}
 		});
 		this.socket.on("event:admin.news.created", news => {
 			this.news.unshift(news);

+ 1 - 2
frontend/src/pages/Profile/index.vue

@@ -160,8 +160,7 @@ export default {
 			"users.findByUsername",
 			this.$route.params.username,
 			res => {
-				if (res.status === "error" || res.status === "failure")
-					this.$router.push("/404");
+				if (res.status === "error") this.$router.push("/404");
 				else {
 					this.user = res.data;
 

+ 1 - 1
frontend/src/pages/Profile/tabs/Playlists.vue

@@ -154,7 +154,7 @@ export default {
 		}
 
 		this.socket.dispatch("playlists.indexForUser", this.userId, res => {
-			if (res.status === "success") this.setPlaylists(res.data);
+			if (res.status === "success") this.setPlaylists(res.data.playlists);
 			this.orderOfPlaylists = this.calculatePlaylistOrder(); // order in regards to the database
 		});
 

+ 8 - 6
frontend/src/pages/Profile/tabs/RecentActivity.vue

@@ -86,14 +86,16 @@ export default {
 				)
 			);
 
-			this.getUsernameFromId(this.userId).then(res => {
-				if (res) this.username = res;
+			this.getUsernameFromId(this.userId).then(username => {
+				if (username) this.username = username;
 			});
 		}
 
-		this.socket.dispatch("activities.length", this.userId, length => {
-			this.maxPosition = Math.ceil(length / 15) + 1;
-			this.getSet();
+		this.socket.dispatch("activities.length", this.userId, res => {
+			if (res.status === "success") {
+				this.maxPosition = Math.ceil(res.data.length / 15) + 1;
+				this.getSet();
+			}
 		});
 
 		this.socket.on("event:activity.create", activity => {
@@ -135,7 +137,7 @@ export default {
 				this.offsettedFromNextSet,
 				res => {
 					if (res.status === "success") {
-						this.activities.push(...res.data);
+						this.activities.push(...res.data.activities);
 						this.position += 1;
 					}
 

+ 2 - 6
frontend/src/pages/ResetPassword.vue

@@ -340,9 +340,7 @@ export default {
 			if (this.mode === "set") {
 				return this.socket.dispatch("users.requestPassword", res => {
 					new Toast(res.message);
-					if (res.status === "success") {
-						this.step = 2;
-					}
+					if (res.status === "success") this.step = 2;
 				});
 			}
 
@@ -368,9 +366,7 @@ export default {
 				this.code,
 				res => {
 					new Toast(res.message);
-					if (res.status === "success") {
-						this.step = 3;
-					}
+					if (res.status === "success") this.step = 3;
 				}
 			);
 		},

+ 2 - 5
frontend/src/pages/Settings/index.vue

@@ -84,11 +84,8 @@ export default {
 		this.localNightmode = this.nightmode;
 
 		this.socket.dispatch("users.findBySession", res => {
-			if (res.status === "success") {
-				this.setUser(res.data);
-			} else {
-				new Toast("You're not currently signed in.");
-			}
+			if (res.status === "success") this.setUser(res.data.user);
+			else new Toast("You're not currently signed in.");
 		});
 
 		this.socket.on("event:user.linkPassword", () =>

+ 7 - 5
frontend/src/pages/Settings/tabs/Preferences.vue

@@ -95,13 +95,15 @@ export default {
 	},
 	mounted() {
 		this.socket.dispatch("users.getPreferences", res => {
+			const { preferences } = res.data;
+
 			if (res.status === "success") {
-				this.localNightmode = res.data.nightmode;
-				this.localAutoSkipDisliked = res.data.autoSkipDisliked;
-				this.localActivityLogPublic = res.data.activityLogPublic;
+				this.localNightmode = preferences.nightmode;
+				this.localAutoSkipDisliked = preferences.autoSkipDisliked;
+				this.localActivityLogPublic = preferences.activityLogPublic;
 				this.localAnonymousSongRequests =
-					res.data.anonymousSongRequests;
-				this.localActivityWatch = res.data.activityWatch;
+					preferences.anonymousSongRequests;
+				this.localActivityWatch = preferences.activityWatch;
 			}
 		});
 

+ 3 - 3
frontend/src/pages/Station/Sidebar/Playlists.vue

@@ -104,7 +104,7 @@ export default {
 	mounted() {
 		/** Get playlists for user */
 		this.socket.dispatch("playlists.indexMyPlaylists", true, res => {
-			if (res.status === "success") this.playlists = res.data;
+			if (res.status === "success") this.playlists = res.data.playlists;
 			this.orderOfPlaylists = this.calculatePlaylistOrder(); // order in regards to the database
 		});
 
@@ -194,7 +194,7 @@ export default {
 					this.station._id,
 					id,
 					res => {
-						if (res.status === "failure") {
+						if (res.status === "error") {
 							new Toast(res.message);
 						} else {
 							this.station.includedPlaylists.push(id);
@@ -214,7 +214,7 @@ export default {
 					this.station._id,
 					id,
 					res => {
-						if (res.status === "failure")
+						if (res.status === "error")
 							return new Toast(res.message);
 
 						this.station.includedPlaylists.splice(

+ 59 - 52
frontend/src/pages/Station/index.vue

@@ -780,13 +780,13 @@ export default {
 			"stations.existsByName",
 			this.stationIdentifier,
 			res => {
-				if (res.status === "failure" || !res.exists) {
+				if (res.status === "error" || !res.data.exists) {
 					// station identifier may be using stationid instead
 					this.socket.dispatch(
 						"stations.existsById",
 						this.stationIdentifier,
 						res => {
-							if (res.status === "failure" || !res.exists) {
+							if (res.status === "error" || !res.data.exists) {
 								this.loading = false;
 								this.exists = false;
 							}
@@ -828,14 +828,17 @@ export default {
 				this.socket.dispatch(
 					"songs.getOwnSongRatings",
 					data.currentSong.youtubeId,
-					song => {
-						if (this.currentSong.youtubeId === song.youtubeId) {
-							this.liked = song.liked;
-							this.disliked = song.disliked;
+					res => {
+						if (
+							res.status === "success" &&
+							this.currentSong.youtubeId === res.data.youtubeId
+						) {
+							this.liked = res.data.liked;
+							this.disliked = res.data.disliked;
 
 							if (
 								this.autoSkipDisliked &&
-								song.disliked === true
+								res.data.disliked === true
 							) {
 								this.voteSkipStation();
 								new Toast(
@@ -872,7 +875,7 @@ export default {
 			// 		this.station._id,
 			// 		res => {
 			// 			if (res.status === "success") {
-			// 				this.updateSongsList(res.queue);
+			// 				this.updateSongsList(res.data.queue);
 			// 			}
 			// 		}
 			// 	);
@@ -1497,18 +1500,18 @@ export default {
 				this.socket.dispatch(
 					"songs.unlike",
 					this.currentSong.youtubeId,
-					data => {
-						if (data.status !== "success")
-							new Toast(`Error: ${data.message}`);
+					res => {
+						if (res.status !== "success")
+							new Toast(`Error: ${res.message}`);
 					}
 				);
 			else
 				this.socket.dispatch(
 					"songs.like",
 					this.currentSong.youtubeId,
-					data => {
-						if (data.status !== "success")
-							new Toast(`Error: ${data.message}`);
+					res => {
+						if (res.status !== "success")
+							new Toast(`Error: ${res.message}`);
 					}
 				);
 		},
@@ -1517,18 +1520,18 @@ export default {
 				return this.socket.dispatch(
 					"songs.undislike",
 					this.currentSong.youtubeId,
-					data => {
-						if (data.status !== "success")
-							new Toast(`Error: ${data.message}`);
+					res => {
+						if (res.status !== "success")
+							new Toast(`Error: ${res.message}`);
 					}
 				);
 
 			return this.socket.dispatch(
 				"songs.dislike",
 				this.currentSong.youtubeId,
-				data => {
-					if (data.status !== "success")
-						new Toast(`Error: ${data.message}`);
+				res => {
+					if (res.status !== "success")
+						new Toast(`Error: ${res.message}`);
 				}
 			);
 		},
@@ -1545,23 +1548,24 @@ export default {
 					this.socket.dispatch(
 						"playlists.getFirstSong",
 						this.privatePlaylistQueueSelected,
-						data => {
-							if (data.status === "success") {
-								if (data.song) {
-									if (data.song.duration < 15 * 60) {
+						res => {
+							if (res.status === "success") {
+								const { song } = res.data;
+								if (song) {
+									if (song.duration < 15 * 60) {
 										this.automaticallyRequestedYoutubeId =
-											data.song.youtubeId;
+											song.youtubeId;
 										this.socket.dispatch(
 											"stations.addToQueue",
 											this.station._id,
-											data.song.youtubeId,
+											song.youtubeId,
 											data2 => {
 												if (data2.status === "success")
 													this.socket.dispatch(
 														"playlists.moveSongToBottom",
 														this
 															.privatePlaylistQueueSelected,
-														data.song.youtubeId
+														song.youtubeId
 													);
 											}
 										);
@@ -1573,7 +1577,7 @@ export default {
 										this.socket.dispatch(
 											"playlists.moveSongToBottom",
 											this.privatePlaylistQueueSelected,
-											data.song.youtubeId,
+											song.youtubeId,
 											data3 => {
 												if (data3.status === "success")
 													setTimeout(
@@ -1676,13 +1680,14 @@ export default {
 							this.socket.dispatch(
 								"songs.getOwnSongRatings",
 								res.data.currentSong.youtubeId,
-								song => {
+								res => {
 									if (
+										res.status === "success" &&
 										this.currentSong.youtubeId ===
-										song.youtubeId
+											res.data.youtubeId
 									) {
-										this.liked = song.liked;
-										this.disliked = song.disliked;
+										this.liked = res.data.liked;
+										this.disliked = res.data.disliked;
 									}
 								}
 							);
@@ -1693,7 +1698,7 @@ export default {
 
 						this.socket.dispatch("stations.getQueue", _id, res => {
 							if (res.status === "success") {
-								this.updateSongsList(res.queue);
+								this.updateSongsList(res.data.queue);
 								let nextSong = null;
 								if (this.songsList[0]) {
 									nextSong = this.songsList[0].youtubeId
@@ -1805,28 +1810,30 @@ export default {
 
 						// UNIX client time before ping
 						const beforePing = Date.now();
-						this.socket.dispatch("apis.ping", pong => {
-							// UNIX client time after ping
-							const afterPing = Date.now();
-							// Average time in MS it took between the server responding and the client receiving
-							const connectionLatency =
-								(afterPing - beforePing) / 2;
-							console.log(
-								connectionLatency,
-								beforePing - afterPing
-							);
-							// UNIX server time
-							const serverDate = pong.date;
-							// Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
-							const difference =
-								serverDate + connectionLatency - afterPing;
-							console.log("Difference: ", difference);
-							if (difference > 3000 || difference < -3000) {
+						this.socket.dispatch("apis.ping", res => {
+							if (res.status === "success") {
+								// UNIX client time after ping
+								const afterPing = Date.now();
+								// Average time in MS it took between the server responding and the client receiving
+								const connectionLatency =
+									(afterPing - beforePing) / 2;
 								console.log(
-									"System time difference is bigger than 3 seconds."
+									connectionLatency,
+									beforePing - afterPing
 								);
+								// UNIX server time
+								const serverDate = res.data.date;
+								// Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
+								const difference =
+									serverDate + connectionLatency - afterPing;
+								console.log("Difference: ", difference);
+								if (difference > 3000 || difference < -3000) {
+									console.log(
+										"System time difference is bigger than 3 seconds."
+									);
+								}
+								this.systemDifference = difference;
 							}
-							this.systemDifference = difference;
 						});
 					} else {
 						this.loading = false;

+ 5 - 3
frontend/src/store/modules/user.js

@@ -121,19 +121,21 @@ const modules = {
 								"users.getUsernameFromId",
 								userId,
 								res => {
+									const { username } = res.data;
+
 									if (res.status === "success") {
 										commit("mapUserId", {
 											userId,
-											username: res.data
+											username
 										});
 
 										state.pendingUserIdCallbacks[
 											`Z${userId}`
-										].forEach(cb => cb(res.data));
+										].forEach(cb => cb(username));
 
 										commit("clearPendingCallbacks", userId);
 
-										return resolve(res.data);
+										return resolve(username);
 									}
 									return resolve();
 								}