Working on HTTP endpoint to delete songs. Finished with album. Need to work on the Artist, Genre, and Year aspects
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef ALBUMREPOSITORY_H_
|
||||
#define ALBUMREPOSITORY_H_
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "database/BaseRepository.h"
|
||||
@@ -16,14 +17,19 @@ namespace database
|
||||
|
||||
std::vector<model::Album> retrieveRecords();
|
||||
|
||||
std::pair<model::Album, int> retrieveRecordWithSongCount(model::Album&, type::AlbumFilter);
|
||||
|
||||
model::Album retrieveRecord(model::Album&, type::AlbumFilter);
|
||||
|
||||
bool doesAlbumExists(const model::Album&, type::AlbumFilter);
|
||||
|
||||
void saveAlbum(const model::Album&);
|
||||
void deleteAlbum(const model::Album&, type::AlbumFilter);
|
||||
private:
|
||||
std::vector<model::Album> parseRecords(MYSQL_STMT*);
|
||||
|
||||
std::pair<model::Album, int> parseRecordWithSongCount(MYSQL_STMT*);
|
||||
|
||||
// TODO: after parseRecord(MYSQL_STMT*) is implemented remove
|
||||
// parseRecord(MYSQL_RES*)
|
||||
model::Album parseRecord(MYSQL_RES*);
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace manager
|
||||
model::Album retrieveAlbum(model::Album&);
|
||||
model::Album saveAlbum(const model::Song&);
|
||||
|
||||
void deleteAlbum(const model::Song&);
|
||||
|
||||
static void printAlbum(const model::Album&);
|
||||
private:
|
||||
model::BinaryPath m_bConf;
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace manager
|
||||
CoverArtManager(const model::BinaryPath& bConf);
|
||||
|
||||
model::Cover saveCover(const model::Song&, std::string&, const std::string&);
|
||||
|
||||
void deleteCover(const model::Song&);
|
||||
private:
|
||||
model::BinaryPath m_bConf;
|
||||
std::string path;
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace manager
|
||||
private:
|
||||
void saveSongTemp(model::Song&);
|
||||
void saveMisc(model::Song&);
|
||||
void deleteMisc(const model::Song&);
|
||||
|
||||
model::BinaryPath m_bConf;
|
||||
std::string exe_path;
|
||||
|
||||
@@ -32,6 +32,11 @@ namespace model
|
||||
struct Artist
|
||||
{
|
||||
Artist() = default;
|
||||
Artist(const Song& song)
|
||||
{
|
||||
id = song.artistId;
|
||||
artist = song.artist;
|
||||
}
|
||||
Artist(const int id) : id(id) { }
|
||||
|
||||
int id;
|
||||
@@ -41,6 +46,12 @@ namespace model
|
||||
struct Album
|
||||
{
|
||||
Album() = default;
|
||||
Album(const Song& song)
|
||||
{
|
||||
id = song.albumId;
|
||||
title = song.album;
|
||||
year = song.year;
|
||||
}
|
||||
Album(const int id) : id(id) { }
|
||||
|
||||
int id;
|
||||
@@ -52,6 +63,11 @@ namespace model
|
||||
struct Genre
|
||||
{
|
||||
Genre() = default;
|
||||
Genre(const Song& song)
|
||||
{
|
||||
id = song.genreId;
|
||||
category = song.genre;
|
||||
}
|
||||
Genre(const int id) : id(id) { }
|
||||
|
||||
int id;
|
||||
@@ -62,6 +78,11 @@ namespace model
|
||||
struct Year
|
||||
{
|
||||
Year() = default;
|
||||
Year(const Song& song)
|
||||
{
|
||||
id = song.yearId;
|
||||
year = song.year;
|
||||
}
|
||||
Year(const int id) : id(id) { }
|
||||
|
||||
int id;
|
||||
@@ -71,6 +92,11 @@ namespace model
|
||||
struct Cover
|
||||
{
|
||||
Cover() = default;
|
||||
Cover(const Song& song)
|
||||
{
|
||||
id = song.coverArtId;
|
||||
songTitle = song.title;
|
||||
}
|
||||
Cover(const int id) : id(id) { }
|
||||
|
||||
int id;
|
||||
|
||||
Reference in New Issue
Block a user