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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user