Can fetch cover art records and download a single cover art

This commit is contained in:
kdeng00
2019-09-06 22:13:52 -04:00
parent ada50b3d5c
commit de838da040
3 changed files with 94 additions and 4 deletions
+2 -4
View File
@@ -41,7 +41,6 @@ namespace controller
#include OATPP_CODEGEN_BEGIN(ApiController)
/**
// endpoint for retrieving all cover art records in json format
ENDPOINT("GET", "/api/v1/coverart", coverArtRecords,
REQUEST(std::shared_ptr<IncomingRequest>, request))
@@ -54,14 +53,13 @@ namespace controller
for (auto& covDb : covsDb) {
auto cov = dto::CoverArtDto::createShared();
cov->id = covDb.id;
cov->Title = covDb.songTitle.c_str();
cov->songTitle = covDb.songTitle.c_str();
coverArts->pushBack(cov);
}
return createDtoResponse(Status::CODE_200, songs);
return createDtoResponse(Status::CODE_200, coverArts);
}
*/
// endpoint for retrieving single cover art record by the cover art id in json format
ENDPOINT("GET", "/api/v1/coverart/{id}", coverArtRecord,
+6
View File
@@ -1,6 +1,8 @@
#ifndef COVERARTREPOSITORY_H_
#define COVERARTREPOSITORY_H_
#include <vector>
#include <mysql/mysql.h>
#include "database/BaseRepository.h"
@@ -15,6 +17,8 @@ namespace database
CoverArtRepository(const std::string&);
CoverArtRepository(const model::BinaryPath&);
std::vector<model::Cover> retrieveRecords();
model::Cover retrieveRecord(model::Cover&, type::CoverFilter);
bool doesCoverArtExist(const model::Cover&, type::CoverFilter);
@@ -22,6 +26,8 @@ namespace database
void deleteRecord(const model::Cover&);
void saveRecord(const model::Cover&);
private:
std::vector<model::Cover> parseRecords(MYSQL_STMT*);
// TODO: After parseRecord(MYSQL_STMT*) is implemented
// remove parseRecord(MYSQL_RES*)
model::Cover parseRecord(MYSQL_RES*);