diff --git a/src/queries/wanted.rs b/src/queries/wanted.rs index 3f9d965..faf4261 100644 --- a/src/queries/wanted.rs +++ b/src/queries/wanted.rs @@ -69,6 +69,18 @@ pub async fn update_status( Ok(active.update(db).await?) } +pub async fn update_mbid( + db: &DatabaseConnection, + id: i32, + musicbrainz_id: &str, +) -> DbResult { + let existing = get_by_id(db, id).await?; + let mut active: ActiveModel = existing.into(); + active.musicbrainz_id = Set(Some(musicbrainz_id.to_string())); + active.updated_at = Set(Utc::now().naive_utc()); + Ok(active.update(db).await?) +} + pub async fn find_by_mbid( db: &DatabaseConnection, musicbrainz_id: &str,