Almost done with updating metadata of song, just need to handle records that have no related records associated with them

This commit is contained in:
kdeng00
2019-09-15 00:23:08 -04:00
parent a82e66ff83
commit 9a894487ad
21 changed files with 589 additions and 29 deletions
+19
View File
@@ -36,6 +36,7 @@ model::Artist manager::ArtistManager::saveArtist(const model::Song& song)
return artist;
}
void manager::ArtistManager::deleteArtist(const model::Song& song)
{
model::Artist artist(song);
@@ -53,6 +54,24 @@ void manager::ArtistManager::deleteArtist(const model::Song& song)
artRepo.deleteArtist(artist, type::ArtistFilter::id);
}
void manager::ArtistManager::updateArtist(model::Song& updatedSong,
const model::Song& currSong)
{
model::Artist artist;
artist.artist = updatedSong.artist;
database::ArtistRepository artRepo(m_bConf);
if (!artRepo.doesArtistExist(artist, type::ArtistFilter::artist)) {
std::cout << "artist record does not exist" << std::endl;
artRepo.saveRecord(artist);
} else {
std::cout << "artist record already exists" << std::endl;
}
artist = artRepo.retrieveRecord(artist, type::ArtistFilter::artist);
updatedSong.artistId = artist.id;
}
void manager::ArtistManager::printArtist(const model::Artist& artist)
{
std::cout << "\nartist record" << std::endl;