minor cleanup

This commit is contained in:
emeric
2019-08-02 15:39:00 +02:00
parent 9d4fdd9a00
commit faca3a499a
4 changed files with 12 additions and 10 deletions
+4 -3
View File
@@ -1024,10 +1024,10 @@ handleGetGenresRequest(RequestContext& context)
auto transaction {context.dbSession.createSharedTransaction()};
auto clusterType {ClusterType::getByName(context.dbSession, genreClusterName)};
const ClusterType::pointer clusterType {ClusterType::getByName(context.dbSession, genreClusterName)};
if (clusterType)
{
auto clusters {clusterType->getClusters()};
const auto clusters {clusterType->getClusters()};
for (const Cluster::pointer& cluster : clusters)
genresNode.addArrayChild("genre", clusterToResponseNode(cluster));
@@ -1759,6 +1759,7 @@ static std::map<std::string, RequestEntryPointInfo> requestEntryPoints
{"/rest/getUser.view", {handleGetUserRequest, false}},
{"/rest/getUsers.view", {handleGetUsersRequest, true}},
{"/rest/ping.view", {handlePingRequest, false}},
{"/rest/savePlayQueue.view", {handleNotImplementedRequest, false}},
{"/rest/scrobble.view", {handleNotImplementedRequest, false}},
{"/rest/search2.view", {handleSearch2Request, false}},
{"/rest/search3.view", {handleSearch3Request, false}},
@@ -1784,7 +1785,7 @@ SubsonicResource::handleRequest(const Wt::Http::Request &request, Wt::Http::Resp
const std::size_t requestId {curRequestId++};
LMS_LOG(API_SUBSONIC, DEBUG) << "Handling request " << requestId << " '" << request.path() << "', params = " << parameterMapToDebugString(request.getParameterMap());
LMS_LOG(API_SUBSONIC, DEBUG) << "Handling request " << requestId << " '" << request.path() << "', continuation = " << (request.continuation() ? "true" : "false") << ", params = " << parameterMapToDebugString(request.getParameterMap());
const Wt::Http::ParameterMap& parameters {request.getParameterMap()};
+3 -3
View File
@@ -139,7 +139,7 @@ ClusterType::getAllOrphans(Session& session)
ClusterType::pointer
ClusterType::getByName(Session& session, std::string name)
ClusterType::getByName(Session& session, const std::string& name)
{
session.checkSharedLocked();
@@ -165,7 +165,7 @@ ClusterType::getAll(Session& session)
}
ClusterType::pointer
ClusterType::create(Session& session, std::string name)
ClusterType::create(Session& session, const std::string& name)
{
session.checkUniqueLocked();
@@ -176,7 +176,7 @@ ClusterType::create(Session& session, std::string name)
}
Cluster::pointer
ClusterType::getCluster(std::string name) const
ClusterType::getCluster(const std::string& name) const
{
assert(self());
assert(IdIsValid(self()->id()));
+4 -4
View File
@@ -91,17 +91,17 @@ class ClusterType : public Wt::Dbo::Dbo<ClusterType>
ClusterType(std::string name);
static std::vector<pointer> getAllOrphans(Session& session);
static pointer getByName(Session& session, std::string name);
static pointer getByName(Session& session, const std::string& name);
static pointer getById(Session& session, IdType id);
static std::vector<pointer> getAll(Session& session);
static pointer create(Session& session, std::string name);
static void remove(Session& session, std::string name);
static pointer create(Session& session, const std::string& name);
static void remove(Session& session, const std::string& name);
// Accessors
const std::string& getName(void) const { return _name; }
std::vector<Cluster::pointer> getClusters() const;
Cluster::pointer getCluster(std::string name) const;
Cluster::pointer getCluster(const std::string& name) const;
template<class Action>
void persist(Action& a)
+1
View File
@@ -213,6 +213,7 @@ Session::prepareTables()
_session.execute("CREATE INDEX IF NOT EXISTS artist_sort_name_nocase_idx ON artist(sort_name COLLATE NOCASE)");
_session.execute("CREATE INDEX IF NOT EXISTS artist_mbid_idx ON artist(mbid)");
_session.execute("CREATE INDEX IF NOT EXISTS auth_token_user_idx ON auth_token(user_id)");
_session.execute("CREATE INDEX IF NOT EXISTS auth_token_expiry_idx ON auth_token(expiry)");
_session.execute("CREATE INDEX IF NOT EXISTS auth_token_value_idx ON auth_token(value)");
_session.execute("CREATE INDEX IF NOT EXISTS cluster_name_idx ON cluster(name)");
_session.execute("CREATE INDEX IF NOT EXISTS cluster_cluster_type_idx ON cluster(cluster_type_id)");