| 
														
															@@ -452,10 +452,10 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				}, 
														 | 
														
														 | 
														
															 				}, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				(playlist, next) => { 
														 | 
														
														 | 
														
															 				(playlist, next) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					UtilsModule.runJob("SHUFFLE", { array: playlist.songs }, this) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-						.then(result => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-							next(null, result.array); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-						}) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					if (!playlist.isUserModifiable) return next("Playlist cannot be shuffled."); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					return UtilsModule.runJob("SHUFFLE", { array: playlist.songs }, this) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+						.then(result => next(null, result.array)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						.catch(next); 
														 | 
														
														 | 
														
															 						.catch(next); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				}, 
														 | 
														
														 | 
														
															 				}, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -690,6 +690,8 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				(playlist, next) => { 
														 | 
														
														 | 
														
															 				(playlist, next) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					if (!playlist || playlist.createdBy !== session.userId) return next("Playlist not found."); 
														 | 
														
														 | 
														
															 					if (!playlist || playlist.createdBy !== session.userId) return next("Playlist not found."); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					if (!playlist.isUserModifiable) return next("Playlist cannot be modified."); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					return next(null, playlist); 
														 | 
														
														 | 
														
															 					return next(null, playlist); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				} 
														 | 
														
														 | 
														
															 				} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			], 
														 | 
														
														 | 
														
															 			], 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -820,6 +822,17 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		); 
														 | 
														
														 | 
														
															 		); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		async.waterfall( 
														 | 
														
														 | 
														
															 		async.waterfall( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			[ 
														 | 
														
														 | 
														
															 			[ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				next => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					PlaylistsModule.runJob("GET_PLAYLIST", { playlistId }, this) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+						.then(playlist => next(null, playlist)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+						.catch(next); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				}, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				(playlist, next) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					if (!playlist.isUserModifiable) return next("Playlist cannot be modified."); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					return next(null); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				}, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				next => { 
														 | 
														
														 | 
														
															 				next => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					playlistModel.updateOne( 
														 | 
														
														 | 
														
															 					playlistModel.updateOne( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						{ _id: playlistId, createdBy: session.userId }, 
														 | 
														
														 | 
														
															 						{ _id: playlistId, createdBy: session.userId }, 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -896,6 +909,8 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				(playlist, next) => { 
														 | 
														
														 | 
														
															 				(playlist, next) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					if (!playlist || playlist.createdBy !== session.userId) return next("Playlist not found"); 
														 | 
														
														 | 
														
															 					if (!playlist || playlist.createdBy !== session.userId) return next("Playlist not found"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					if (!playlist.isUserModifiable) return next("Playlist cannot be modified."); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					return async.each( 
														 | 
														
														 | 
														
															 					return async.each( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						playlist.songs, 
														 | 
														
														 | 
														
															 						playlist.songs, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						(song, next) => { 
														 | 
														
														 | 
														
															 						(song, next) => { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -1001,6 +1016,8 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				(playlist, next) => { 
														 | 
														
														 | 
														
															 				(playlist, next) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					if (!playlist || playlist.createdBy !== session.userId) return next("Playlist not found"); 
														 | 
														
														 | 
														
															 					if (!playlist || playlist.createdBy !== session.userId) return next("Playlist not found"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					if (!playlist.isUserModifiable) return next("Playlist cannot be modified."); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					return async.each( 
														 | 
														
														 | 
														
															 					return async.each( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						playlist.songs, 
														 | 
														
														 | 
														
															 						playlist.songs, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 						(song, next) => { 
														 | 
														
														 | 
														
															 						(song, next) => { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -1093,6 +1110,17 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		async.waterfall( 
														 | 
														
														 | 
														
															 		async.waterfall( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			[ 
														 | 
														
														 | 
														
															 			[ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				next => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					PlaylistsModule.runJob("GET_PLAYLIST", { playlistId }, this) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+						.then(playlist => next(null, playlist)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+						.catch(next); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				}, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				(playlist, next) => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					if (!playlist.isUserModifiable) return next("Playlist cannot be removed."); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					return next(null); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				}, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				next => { 
														 | 
														
														 | 
														
															 				next => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					PlaylistsModule.runJob("DELETE_PLAYLIST", { playlistId }, this).then(next).catch(next); 
														 | 
														
														 | 
														
															 					PlaylistsModule.runJob("DELETE_PLAYLIST", { playlistId }, this).then(next).catch(next); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				}, 
														 | 
														
														 | 
														
															 				}, 
														 |