Added manager classes for song metadata

This commit is contained in:
kdeng00
2019-09-01 15:10:46 -04:00
parent d16b8dc3c9
commit f75ebe14a7
26 changed files with 127 additions and 36 deletions
View File
+18
View File
@@ -0,0 +1,18 @@
#ifndef ARTISTREPOSITORY_H_
#define ARTISTREPOSITORY_H_
#include "database/base_repository.h"
#include "models/models.h"
#include "types/coverFilter.h"
namespace Database
{
class artistRepository : public base_repository
{
public:
artistRepository(const Model::BinaryPath&);
private:
};
}
#endif
+18 -13
View File
@@ -7,22 +7,27 @@
#include "models/models.h"
class base_repository
namespace Database
{
public:
base_repository();
base_repository(const std::string&);
protected:
MYSQL* setup_mysql_connection();
MYSQL* setup_mysql_connection(Model::database_connection);
class base_repository
{
public:
base_repository();
base_repository(const std::string&);
base_repository(const BinaryPath&);
protected:
MYSQL* setup_mysql_connection();
MYSQL* setup_mysql_connection(Model::database_connection);
MYSQL_RES* perform_mysql_query(MYSQL*, const std::string&);
MYSQL_RES* perform_mysql_query(MYSQL*, const std::string&);
Model::database_connection details;
private:
void intitalizeDetails();
Model::database_connection details;
private:
void intitalizeDetails();
std::string path;
};
std::string path;
Model::BinaryPath m_binConf;
};
}
#endif
View File
View File
View File
View File
View File
+2
View File
@@ -20,10 +20,12 @@ namespace Manager
Model::loginResult retrieve_token();
Model::loginResult retrieve_token(std::string_view);
Model::loginResult retrieve_token(const BinaryPath&);
bool is_token_valid(std::string&, Scope);
private:
Model::auth_credentials parse_auth_credentials(std::string_view);
Model::auth_credentials parse_auth_credentials(const BinaryPath&);
std::vector<std::string> extract_scopes(const jwt::decoded_jwt&&);
std::pair<bool, std::vector<std::string>> fetch_auth_header(const std::string&);
View File
+28 -10
View File
@@ -20,6 +20,16 @@ namespace Model
std::string songPath;
std::vector<unsigned char> data;
int coverArtId;
int artistId;
int albumId;
int genreId;
int yearId;
};
struct Artist
{
int id;
std::string artist;
};
struct Album
@@ -30,6 +40,19 @@ namespace Model
std::vector<Song> songs;
};
struct Genre
{
int id;
std::string category;
};
struct Year
{
int id;
int year;
};
struct Cover
{
int id;
@@ -39,16 +62,6 @@ namespace Model
std::vector<unsigned char> data;
};
struct LoginRes
{
int UserId;
char Username[1024];
char Token[1024];
char TokenType[1024];
char Message[1024];
int Expiration;
};
struct loginResult
{
int user_id;
@@ -76,6 +89,11 @@ namespace Model
std::string password;
std::string database;
};
struct BinaryPath
{
std::string path;
};
}
#endif