Factoring
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#ifndef DIRECTORY_MANAGER_H_
|
||||
#define DIRECTORY_MANAGER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "models/models.h"
|
||||
|
||||
class directory_manager
|
||||
{
|
||||
public:
|
||||
|
||||
std::string create_directory_process(Song, const std::string&);
|
||||
// Return Cover instead
|
||||
std::string read_cover_art(const std::string&);
|
||||
|
||||
|
||||
void copy_stock_to_root(const std::string&, const std::string&);
|
||||
void copy_song_to_path(const std::string&, const std::string&);
|
||||
void delete_cover_art_file(const std::string&, const std::string&);
|
||||
void delete_directories(Song, const std::string&);
|
||||
|
||||
private:
|
||||
void delete_song(const Song);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "models.h"
|
||||
#include "models/models.h"
|
||||
|
||||
class song_manager
|
||||
{
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef TOKEN_MANAGER_H_
|
||||
#define TOKEN_MANAGER_H_
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <jwt-cpp/jwt.h>
|
||||
|
||||
#include "models/models.h"
|
||||
#include "types/scopes.h"
|
||||
|
||||
class token_manager
|
||||
{
|
||||
public:
|
||||
token_manager();
|
||||
|
||||
loginResult retrieve_token();
|
||||
loginResult retrieve_token(std::string_view);
|
||||
|
||||
bool is_token_valid(std::string&, Scope);
|
||||
private:
|
||||
auth_credentials parse_auth_credentials(std::string_view);
|
||||
|
||||
std::vector<std::string> extract_scopes(const jwt::decoded_jwt&&);
|
||||
std::pair<bool, std::vector<std::string>> fetch_auth_header(const std::string&);
|
||||
|
||||
bool token_supports_scope(const std::vector<std::string>, const std::string&&);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user