|
@@ -461,9 +461,6 @@ export default {
|
|
return cb({ status: "failure", message: err });
|
|
return cb({ status: "failure", message: err });
|
|
}
|
|
}
|
|
|
|
|
|
- const sortedSongs = playlist.songs.sort((a, b) => a.position - b.position);
|
|
|
|
- playlist.songs = sortedSongs;
|
|
|
|
-
|
|
|
|
this.log(
|
|
this.log(
|
|
"SUCCESS",
|
|
"SUCCESS",
|
|
"PLAYLIST_GET",
|
|
"PLAYLIST_GET",
|
|
@@ -588,13 +585,8 @@ export default {
|
|
* @param {Function} cb - gets called with the result
|
|
* @param {Function} cb - gets called with the result
|
|
*/
|
|
*/
|
|
shuffle: isLoginRequired(async function shuffle(session, playlistId, cb) {
|
|
shuffle: isLoginRequired(async function shuffle(session, playlistId, cb) {
|
|
- const playlistModel = await DBModule.runJob(
|
|
|
|
- "GET_MODEL",
|
|
|
|
- {
|
|
|
|
- modelName: "playlist"
|
|
|
|
- },
|
|
|
|
- this
|
|
|
|
- );
|
|
|
|
|
|
+ const playlistModel = await DBModule.runJob("GET_MODEL", { modelName: "playlist" }, this);
|
|
|
|
+
|
|
async.waterfall(
|
|
async.waterfall(
|
|
[
|
|
[
|
|
next => {
|
|
next => {
|
|
@@ -616,9 +608,7 @@ export default {
|
|
|
|
|
|
(res, next) => {
|
|
(res, next) => {
|
|
PlaylistsModule.runJob("UPDATE_PLAYLIST", { playlistId }, this)
|
|
PlaylistsModule.runJob("UPDATE_PLAYLIST", { playlistId }, this)
|
|
- .then(playlist => {
|
|
|
|
- next(null, playlist);
|
|
|
|
- })
|
|
|
|
|
|
+ .then(playlist => next(null, playlist))
|
|
.catch(next);
|
|
.catch(next);
|
|
}
|
|
}
|
|
],
|
|
],
|
|
@@ -632,11 +622,13 @@ export default {
|
|
);
|
|
);
|
|
return cb({ status: "failure", message: err });
|
|
return cb({ status: "failure", message: err });
|
|
}
|
|
}
|
|
|
|
+
|
|
this.log(
|
|
this.log(
|
|
"SUCCESS",
|
|
"SUCCESS",
|
|
"PLAYLIST_SHUFFLE",
|
|
"PLAYLIST_SHUFFLE",
|
|
`Successfully updated private playlist "${playlistId}" for user "${session.userId}".`
|
|
`Successfully updated private playlist "${playlistId}" for user "${session.userId}".`
|
|
);
|
|
);
|
|
|
|
+
|
|
return cb({
|
|
return cb({
|
|
status: "success",
|
|
status: "success",
|
|
message: "Successfully shuffled playlist.",
|
|
message: "Successfully shuffled playlist.",
|