Implemented deletion functionality, and lingering records are removed fixes #49

This commit is contained in:
kdeng00
2019-09-10 22:27:28 -04:00
parent 8c1c2340b2
commit a00a70029e
17 changed files with 489 additions and 17 deletions
+17
View File
@@ -36,6 +36,23 @@ model::Artist manager::ArtistManager::saveArtist(const model::Song& song)
return artist;
}
void manager::ArtistManager::deleteArtist(const model::Song& song)
{
model::Artist artist(song);
database::ArtistRepository artRepo(m_bConf);
auto artWSC = artRepo.retrieveRecordWithSongCount(artist, type::ArtistFilter::id);
if (artWSC.second > 1) {
std::cout << "artist still contain songs related to it";
std::cout << ", not delete" << std::endl;
return;
}
std::cout << "safe to delete the artist record" << std::endl;
artRepo.deleteArtist(artist, type::ArtistFilter::id);
}
void manager::ArtistManager::printArtist(const model::Artist& artist)
{
std::cout << "\nartist record" << std::endl;