Skip to content

Commit

Permalink
Merge pull request #3766 from advplyr/remove-old-playlist
Browse files Browse the repository at this point in the history
Remove old Playlist object + remove unnecessary toasts
  • Loading branch information
advplyr authored Dec 31, 2024
2 parents 6780ef9 + 25b7f00 commit ee310d9
Show file tree
Hide file tree
Showing 9 changed files with 495 additions and 520 deletions.
3 changes: 0 additions & 3 deletions client/components/modals/playlists/AddCreateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ export default {
.$post(`/api/playlists/${playlist.id}/batch/remove`, { items: itemObjects })
.then((updatedPlaylist) => {
console.log(`Items removed from playlist`, updatedPlaylist)
this.$toast.success(this.$strings.ToastPlaylistUpdateSuccess)
this.processing = false
})
.catch((error) => {
Expand All @@ -148,7 +147,6 @@ export default {
.$post(`/api/playlists/${playlist.id}/batch/add`, { items: itemObjects })
.then((updatedPlaylist) => {
console.log(`Items added to playlist`, updatedPlaylist)
this.$toast.success(this.$strings.ToastPlaylistUpdateSuccess)
this.processing = false
})
.catch((error) => {
Expand All @@ -174,7 +172,6 @@ export default {
.$post('/api/playlists', newPlaylist)
.then((data) => {
console.log('New playlist created', data)
this.$toast.success(this.$strings.ToastPlaylistCreateSuccess + ': ' + data.name)
this.processing = false
this.newPlaylistName = ''
})
Expand Down
1 change: 0 additions & 1 deletion client/components/tables/playlist/ItemTableRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ export default {
this.$toast.success(this.$strings.ToastPlaylistRemoveSuccess)
} else {
console.log(`Item removed from playlist`, updatedPlaylist)
this.$toast.success(this.$strings.ToastPlaylistUpdateSuccess)
}
})
.catch((error) => {
Expand Down
10 changes: 0 additions & 10 deletions server/Database.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,16 +406,6 @@ class Database {
return Promise.all(oldBooks.map((oldBook) => this.models.book.saveFromOld(oldBook)))
}

createPlaylistMediaItem(playlistMediaItem) {
if (!this.sequelize) return false
return this.models.playlistMediaItem.create(playlistMediaItem)
}

createBulkPlaylistMediaItems(playlistMediaItems) {
if (!this.sequelize) return false
return this.models.playlistMediaItem.bulkCreate(playlistMediaItems)
}

async createLibraryItem(oldLibraryItem) {
if (!this.sequelize) return false
await oldLibraryItem.saveMetadata()
Expand Down
3 changes: 3 additions & 0 deletions server/controllers/CollectionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class CollectionController {
if (!reqBody.name || !reqBody.libraryId) {
return res.status(400).send('Invalid collection data')
}
if (reqBody.description && typeof reqBody.description !== 'string') {
return res.status(400).send('Invalid collection description')
}
const libraryItemIds = (reqBody.books || []).filter((b) => !!b && typeof b == 'string')
if (!libraryItemIds.length) {
return res.status(400).send('Invalid collection data. No books')
Expand Down
Loading

0 comments on commit ee310d9

Please sign in to comment.