| 958 | |
| 959 | #[tracing::instrument(level = "debug", skip(self))] |
| 960 | pub fn remove_from_playlist(&self, id: String, songs: Vec<String>) -> Result<()> { |
| 961 | trace!("Removing from playlist"); |
| 962 | self.pool |
| 963 | .get() |
| 964 | .unwrap() |
| 965 | .transaction::<(), MoosyncError, _>(|conn| { |
| 966 | for s in songs { |
| 967 | delete(playlist_bridge) |
| 968 | .filter(schema::playlist_bridge::playlist.eq(id.clone())) |
| 969 | .filter(schema::playlist_bridge::song.eq(s.clone())) |
| 970 | .execute(conn)?; |
| 971 | } |
| 972 | Ok(()) |
| 973 | })?; |
| 974 | info!("Removed from playlist"); |
| 975 | Ok(()) |
| 976 | } |
| 977 | |
| 978 | #[tracing::instrument(level = "debug", skip(self))] |
| 979 | pub fn remove_playlist(&self, id: String) -> Result<()> { |