Finished clean on recommendation engines

This commit is contained in:
emeric
2021-09-30 19:02:49 +02:00
parent 4e9cf0d77f
commit 6baf0d313d
29 changed files with 648 additions and 634 deletions
+7
View File
@@ -66,6 +66,13 @@ Artist::getById(Session& session, ArtistId id)
return session.getDboSession().find<Artist>().where("id = ?").bind(id).resultValue();
}
bool
Artist::exists(Session& session, ArtistId id)
{
session.checkSharedLocked();
return session.getDboSession().query<int>("SELECT 1 FROM artist").where("id = ?").bind(id).resultValue() == 1;
}
Artist::pointer
Artist::create(Session& session, const std::string& name, const std::optional<UUID>& MBID)
{
+7
View File
@@ -114,6 +114,13 @@ Release::getById(Session& session, ReleaseId id)
.resultValue();
}
bool
Release::exists(Session& session, ReleaseId id)
{
session.checkSharedLocked();
return session.getDboSession().query<int>("SELECT 1 FROM release").where("id = ?").bind(id).resultValue() == 1;
}
Release::pointer
Release::create(Session& session, const std::string& name, const std::optional<UUID>& MBID)
{
+8
View File
@@ -156,6 +156,14 @@ Track::getById(Session& session, TrackId id)
.resultValue();
}
bool
Track::exists(Session& session, TrackId id)
{
session.checkSharedLocked();
return session.getDboSession().query<int>("SELECT 1 from track").where("id = ?").bind(id).resultValue() == 1;
}
std::vector<Track::pointer>
Track::getByRecordingMBID(Session& session, const UUID& mbid)
{