fix wrong oatpp version problems
This commit is contained in:
parent
33df6f9f22
commit
87dee59a55
6
.gitignore
vendored
6
.gitignore
vendored
@ -35,3 +35,9 @@
|
||||
# third party
|
||||
third_party
|
||||
|
||||
# build
|
||||
build
|
||||
|
||||
# bin
|
||||
bin
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"host": "localhost",
|
||||
"host": "0.0.0.0",
|
||||
"port": 8280,
|
||||
"database": {
|
||||
"host": "localhost",
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <controller/AnswerController.h>
|
||||
#include <controller/QuestionController.h>
|
||||
#include <iostream>
|
||||
#include <oatpp-swagger/Controller.hpp>
|
||||
#include <oatpp/core/base/CommandLineArguments.hpp>
|
||||
#include <oatpp/network/Server.hpp>
|
||||
|
||||
@ -30,6 +31,8 @@ void run(const oatpp::base::CommandLineArguments &args) {
|
||||
oatpp::web::server::api::Endpoints swaggerDocEndpoints;
|
||||
swaggerDocEndpoints.append(answerController->getEndpoints());
|
||||
swaggerDocEndpoints.append(questionController->getEndpoints());
|
||||
|
||||
router->addController(oatpp::swagger::Controller::createShared(swaggerDocEndpoints));
|
||||
#endif
|
||||
|
||||
oatpp::network::Server server(serviceComponent.serverConnectionProvider.getObject(),
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <dto/Answer.h>
|
||||
#include <oatpp/core/macro/codegen.hpp>
|
||||
#include <oatpp/core/macro/component.hpp>
|
||||
#include <oatpp/parser/json/mapping/ObjectMapper.hpp>
|
||||
@ -20,7 +21,7 @@ class AnswerController : public ApiController {
|
||||
public:
|
||||
typedef std::shared_ptr<AnswerController> Ptr;
|
||||
explicit AnswerController(const std::shared_ptr<ObjectMapper> &objectMapper)
|
||||
: ApiController(objectMapper) {
|
||||
: ApiController(objectMapper, "/api/answer") {
|
||||
this->objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
@ -32,6 +33,14 @@ private:
|
||||
std::shared_ptr<ObjectMapper> objectMapper;
|
||||
|
||||
public:
|
||||
ENDPOINT("POST", "/create", createAnswer, BODY_DTO(Object<dto::Answer>, request)) {
|
||||
return createResponse(Status::CODE_200);
|
||||
}
|
||||
ENDPOINT_INFO(createAnswer) {
|
||||
info->summary = "Create Answer";
|
||||
info->addConsumes<Object<dto::Answer>>("application/json");
|
||||
info->addResponse(Status::CODE_200);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace QuickExam::controller
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <dto/Question.h>
|
||||
#include <oatpp/core/macro/codegen.hpp>
|
||||
#include <oatpp/core/macro/component.hpp>
|
||||
#include <oatpp/parser/json/mapping/ObjectMapper.hpp>
|
||||
@ -20,7 +21,7 @@ class QuestionController : public ApiController {
|
||||
public:
|
||||
typedef std::shared_ptr<QuestionController> Ptr;
|
||||
explicit QuestionController(const std::shared_ptr<ObjectMapper> &objectMapper)
|
||||
: ApiController(objectMapper) {
|
||||
: ApiController(objectMapper, "/api/queation") {
|
||||
this->objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
@ -32,6 +33,14 @@ private:
|
||||
std::shared_ptr<ObjectMapper> objectMapper;
|
||||
|
||||
public:
|
||||
ENDPOINT("POST", "/create", createQuestion, BODY_DTO(Object<dto::Question>, request)) {
|
||||
return createResponse(Status::CODE_200);
|
||||
}
|
||||
ENDPOINT_INFO(createQuestion) {
|
||||
info->summary = "Create Question";
|
||||
info->addConsumes<Object<dto::Question>>("application/json");
|
||||
info->addResponse(Status::CODE_200);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace QuickExam::controller
|
||||
|
@ -33,9 +33,7 @@ execute() {
|
||||
cd "$CACHE_PATH" || exit 1
|
||||
execute "cloning oatpp" "failed to install oatpp" \
|
||||
git clone https://ssl.lunadeer.cn:14446/mirror/oatpp.git && \
|
||||
cd oatpp
|
||||
execute "checkout oatpp 1.3.0" "failed to checkout oatpp 1.3.0" \
|
||||
git checkout 1.3.0 && \
|
||||
cd oatpp && \
|
||||
mkdir build && \
|
||||
cd build
|
||||
execute "cmake oatpp" "failed to cmake oatpp" \
|
||||
@ -49,9 +47,7 @@ execute "installing oatpp" "failed to make install oatpp" \
|
||||
cd "$CACHE_PATH" || exit 1
|
||||
execute "cloning oatpp-swagger" "failed to install oatpp-swagger" \
|
||||
git clone https://ssl.lunadeer.cn:14446/mirror/oatpp-swagger.git && \
|
||||
cd oatpp-swagger
|
||||
execute "checkout oatpp-swagger 1.3.0" "failed to checkout oatpp-swagger 1.3.0" \
|
||||
git checkout 1.3.0 && \
|
||||
cd oatpp-swagger && \
|
||||
mkdir build && \
|
||||
cd build
|
||||
execute "cmake oatpp-swagger" "failed to cmake oatpp-swagger" \
|
||||
|
Loading…
Reference in New Issue
Block a user