Browse Source

refactor: Set station currentSong default to null in schema

Owen Diffey 10 months ago
parent
commit
753959c685
2 changed files with 17 additions and 13 deletions
  1. 2 1
      backend/logic/actions/stations.js
  2. 15 12
      backend/logic/db/schemas/station.js

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

@@ -1854,7 +1854,8 @@ export default {
 								type,
 								privacy: "private",
 								owner: session.userId,
-								queue: []
+								queue: [],
+								currentSong: null
 							},
 							next
 						);

+ 15 - 12
backend/logic/db/schemas/station.js

@@ -7,18 +7,21 @@ export default {
 	description: { type: String, minlength: 2, maxlength: 128, trim: true, required: true },
 	paused: { type: Boolean, default: false, required: true },
 	currentSong: {
-		_id: { type: mongoose.Schema.Types.ObjectId },
-		mediaSource: { type: String },
-		title: { type: String },
-		artists: [{ type: String }],
-		duration: { type: Number },
-		skipDuration: { type: Number },
-		thumbnail: { type: String },
-		skipVotes: [{ type: String }],
-		requestedBy: { type: String },
-		requestedAt: { type: Date },
-		requestedType: { type: String, enum: ["manual", "autorequest", "autofill"] },
-		verified: { type: Boolean }
+		type: {
+			_id: { type: mongoose.Schema.Types.ObjectId },
+			mediaSource: { type: String },
+			title: { type: String },
+			artists: [{ type: String }],
+			duration: { type: Number },
+			skipDuration: { type: Number },
+			thumbnail: { type: String },
+			skipVotes: [{ type: String }],
+			requestedBy: { type: String },
+			requestedAt: { type: Date },
+			requestedType: { type: String, enum: ["manual", "autorequest", "autofill"] },
+			verified: { type: Boolean }
+		},
+		default: null
 	},
 	currentSongIndex: { type: Number, default: 0, required: true },
 	timePaused: { type: Number, default: 0, required: true },