MCPcopy Create free account
hub / github.com/Moosync/Moosync / update_album

Method update_album

src-tauri/database/src/database.rs:1020–1045  ·  view source on GitHub ↗
(&self, mut album: QueryableAlbum)

Source from the content-addressed store, hash-verified

1018
1019 #[tracing::instrument(level = "debug", skip(self))]
1020 pub fn update_album(&self, mut album: QueryableAlbum) -> Result<()> {
1021 trace!("Updating album");
1022 let mut conn = self.pool.get().unwrap();
1023
1024 let existing_album_info = self
1025 .get_albums(
1026 QueryableAlbum {
1027 album_id: album.album_id.clone(),
1028 ..Default::default()
1029 },
1030 false,
1031 &mut conn,
1032 )?
1033 .first()
1034 .and_then(|a| a.album_extra_info.clone());
1035
1036 album.album_extra_info = self.merge_extra_info(existing_album_info, album.album_extra_info);
1037
1038 update(albums)
1039 .filter(schema::albums::album_id.eq(album.album_id.clone()))
1040 .set(album)
1041 .execute(&mut conn)?;
1042
1043 info!("Updated album");
1044 Ok(())
1045 }
1046
1047 #[tracing::instrument(level = "debug", skip(self))]
1048 pub fn update_artist(&self, mut artist: QueryableArtist) -> Result<()> {

Callers 2

test_album_operationsFunction · 0.80
update_songsMethod · 0.80

Calls 6

getMethod · 0.80
get_albumsMethod · 0.80
cloneMethod · 0.80
merge_extra_infoMethod · 0.80
setMethod · 0.80
eqMethod · 0.45

Tested by 1

test_album_operationsFunction · 0.64