Browse Source

Changed weird mongoose naming, fixed other mongoose issue

Kristian Vos 5 years ago
parent
commit
95680bf3f4

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

@@ -115,7 +115,7 @@ module.exports = {
 	//TODO Pass in an id, not an object
 	//TODO Fix this
 	remove: hooks.adminRequired((session, news, cb, userId) => {
-		db.models.news.removeOne({ _id: news._id }, err => {
+		db.models.news.deleteOne({ _id: news._id }, err => {
 			if (err) {
 				err = utils.getError(err);
 				logger.error("NEWS_REMOVE", `Removing news "${news._id}" failed for user "${userId}". "${err}"`);

+ 1 - 1
backend/logic/actions/queueSongs.js

@@ -116,7 +116,7 @@ let lib = {
 	remove: hooks.adminRequired((session, songId, cb, userId) => {
 		async.waterfall([
 			(next) => {
-				db.models.queueSong.removeOne({_id: songId}, next);
+				db.models.queueSong.deleteOne({_id: songId}, next);
 			}
 		], (err) => {
 			if (err) {

+ 2 - 2
backend/logic/actions/songs.js

@@ -150,7 +150,7 @@ module.exports = {
 	remove: hooks.adminRequired((session, songId, cb) => {
 		async.waterfall([
 			(next) => {
-				db.models.song.removeOne({_id: songId}, next);
+				db.models.song.deleteOne({_id: songId}, next);
 			},
 
 			(res, next) => {//TODO Check if res gets returned from above
@@ -194,7 +194,7 @@ module.exports = {
 				newSong.save(next);
 			},
 
-			(next) => {
+			(res, next) => {
 				queueSongs.remove(session, song._id, () => {
 					next();
 				});

+ 1 - 1
backend/logic/actions/stations.js

@@ -781,7 +781,7 @@ module.exports = {
 	remove: hooks.ownerRequired((session, stationId, cb) => {
 		async.waterfall([
 			(next) => {
-				db.models.station.removeOne({ _id: stationId }, err => next(err));
+				db.models.station.deleteOne({ _id: stationId }, err => next(err));
 			},
 
 			(next) => {

+ 1 - 1
backend/logic/playlists.js

@@ -142,7 +142,7 @@ module.exports = {
 		async.waterfall([
 
 			(next) => {
-				db.models.playlist.removeOne({ _id: playlistId }, next);
+				db.models.playlist.deleteOne({ _id: playlistId }, next);
 			},
 
 			(res, next) => {

+ 1 - 1
backend/logic/songs.js

@@ -148,7 +148,7 @@ module.exports = {
 		async.waterfall([
 
 			(next) => {
-				db.models.song.removeOne({ songId }, next);
+				db.models.song.deleteOne({ songId }, next);
 			},
 
 			(next) => {