From bbd8186114b9821de086e73df815f70f39b8f3da Mon Sep 17 00:00:00 2001 From: kdeng00 Date: Sun, 18 Aug 2019 16:44:59 -0400 Subject: [PATCH] Added songcontroller, work on uploading a song --- CMakeLists.txt | 1 + src/controller/loginController.hpp | 3 ++- src/controller/songController.hpp | 39 ++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/controller/songController.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c15d95..2fddb0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ set(CMAKE_CXX_STANDARD 17) set(SOURCES src/appComponent.hpp src/controller/loginController.hpp + src/controller/songController.hpp src/database/base_repository.cpp src/directory_manager.cpp src/dto/loginResultDto.hpp diff --git a/src/controller/loginController.hpp b/src/controller/loginController.hpp index 772a17d..a8f6c2b 100644 --- a/src/controller/loginController.hpp +++ b/src/controller/loginController.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "oatpp/core/macro/codegen.hpp" #include "oatpp/core/macro/component.hpp" @@ -18,7 +19,7 @@ class loginController : public oatpp::web::server::api::ApiController { public: loginController(std::string p, OATPP_COMPONENT(std::shared_ptr, objectMapper)) - : oatpp::web::server::api::ApiController(objectMapper), exe_path(std::move(p)) + : oatpp::web::server::api::ApiController(objectMapper), exe_path(p) { } diff --git a/src/controller/songController.hpp b/src/controller/songController.hpp new file mode 100644 index 0000000..999185c --- /dev/null +++ b/src/controller/songController.hpp @@ -0,0 +1,39 @@ +#ifndef SONGCONTROLLER_H_ +#define SONGCONTROLLER_H_ + +#include +#include +#include +#include + +#include "oatpp/core/macro/codegen.hpp" +#include "oatpp/core/macro/component.hpp" +#include "oatpp/web/mime/multipart/InMemoryPartReader.hpp" +#include "oatpp/web/mime/multipart/Reader.hpp" +#include "oatpp/web/server/api/ApiController.hpp" + +//#include "../dto/DTO.h" + +class songController : public oatpp::web::server::api::ApiController +{ +public: + songController(std::string p, OATPP_COMPONENT(std::shared_ptr, objectMapper)) + : oatpp::web::server::api::ApiController(objectMapper), exe_path(p) + { } + + #include OATPP_CODEGEN_BEGIN(ApiController) + + // TODO: work on uploading a song + ENDPOINT("POST", "/api/v1/song/data", songUpload, + REQUEST(std::shared_ptr, request)) + { + + return createResonse(Status::CODE_200, "OK"); + } + + #include OATPP_CODEGEN_END(ApiController) +private: + std::string exe_path; +}; + +#endif