From c55d8261a2fd179d52e0d215f4cc3abf5d5ee85f Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Mon, 2 Sep 2019 20:16:30 -0400 Subject: [PATCH] Added TODO in the albumRepository.cpp on where to pick up from. Short story: duplicate related records --- include/database/albumRepository.h | 2 ++ src/database/albumRepository.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/database/albumRepository.h b/include/database/albumRepository.h index d2b7be0..e9e9dfe 100644 --- a/include/database/albumRepository.h +++ b/include/database/albumRepository.h @@ -18,6 +18,8 @@ namespace Database Model::Album retrieveRecord(Model::Album&, Type::albumFilter); + bool doesAlbumExists(const Model::Album&, Type::albumFilter); + void saveAlbum(const Model::Album&); private: std::vector parseRecords(MYSQL_RES*); diff --git a/src/database/albumRepository.cpp b/src/database/albumRepository.cpp index 239a1ce..57b7190 100644 --- a/src/database/albumRepository.cpp +++ b/src/database/albumRepository.cpp @@ -53,6 +53,19 @@ Model::Album Database::albumRepository::retrieveRecord(Model::Album& album, Type return album; } +bool Database::albumRepository::doesAlbumExists(const Model::Album& album, Type::albumFilter filter) +{ + // TODO: continue working on this part. + // Reason: there should be a check to see if an album record already exists + // at the moment there is no check and every time a song is uploaded + // a new album record is created, even for songs that are on the + // same album. This should not happen. There should be one album + // record for songs on the same album. After fixing this, do the + // same for Artist, Genre, and Year records + + return false; +} + void Database::albumRepository::saveAlbum(const Model::Album& album) { std::cout << "beginning to insert album record" << std::endl;