Browse Source

refactor: Tweaked migration 20

Owen Diffey 2 years ago
parent
commit
7bf94a7acf
1 changed files with 10 additions and 3 deletions
  1. 10 3
      backend/logic/migration/migrations/migration20.js

+ 10 - 3
backend/logic/migration/migrations/migration20.js

@@ -39,17 +39,24 @@ export default async function migrate(MigrationModule) {
 													locked: ""
 												},
 												$set: {
+													queue: station.queue.map(song => {
+														if (!song.requestedAt) song.requestedAt = Date.now();
+														return song;
+													}),
 													autofill: {
 														enabled: !station.partyMode,
 														playlists: station.includedPlaylists.map(playlist =>
 															mongoose.Types.ObjectId(playlist)
 														),
 														limit: 30,
-														mode: station.playMode
+														mode: station.playMode ? station.playMode : "random"
 													},
 													requests: {
-														enabled: station.partyMode,
-														access: station.locked ? "owner" : "user",
+														enabled: !!station.partyMode,
+														access:
+															station.locked || station.type === "official"
+																? "owner"
+																: "user",
 														limit: 5
 													},
 													blacklist: station.excludedPlaylists.map(playlist =>