database stuff

This commit is contained in:
kdeng00
2019-08-18 11:57:08 -04:00
parent 5230e69832
commit d26c16aa69
11 changed files with 211 additions and 48 deletions
+8 -8
View File
@@ -18,32 +18,32 @@ class loginController : public oatpp::web::server::api::ApiController
{
public:
loginController(std::string p, OATPP_COMPONENT(std::shared_ptr<ObjectMapper>, objectMapper))
: oatpp::web::server::api::ApiController(objectMapper), exe_path(fs::canonical(p.c_str()).parent_path().string())
{
std::cout << "p is " << p << std::endl;
std::cout << "working path " << exe_path.string() << std::endl;
}
: oatpp::web::server::api::ApiController(objectMapper), exe_path(std::move(p))
{ }
#include OATPP_CODEGEN_BEGIN(ApiController)
ENDPOINT("POST", "/api/v1/login", root)
ENDPOINT("POST", "/api/v1/login", data, BODY_DTO(userDto::ObjectWrapper, usr))
{
OATPP_LOGI("icarus", "logging in");
std::cout << "user: " << usr->username->c_str() << std::endl;
token_manager tok;
auto token = tok.retrieve_token();
auto token = tok.retrieve_token(exe_path);
auto logRes = loginResultDto::createShared();
logRes->access_token = token.access_token.c_str();
logRes->token_type = token.token_type.c_str();
logRes->expiration = token.expiration;
return createDtoResponse(Status::CODE_200, logRes);
}
#include OATPP_CODEGEN_END(ApiController)
private:
fs::path exe_path;
std::string exe_path;
};
#endif