Skip to content

Commit

Permalink
Update to the latest oatpp API.
Browse files Browse the repository at this point in the history
  • Loading branch information
lganzzzo committed May 23, 2020
1 parent 5bd9c91 commit f9d62c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/controller/MyController.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ class MyController : public oatpp::web::server::api::ApiController {
ENDPOINT_ASYNC_INIT(EchoDtoBody)

Action act() override {
return request->readBodyToDtoAsync<MessageDto>(controller->getDefaultObjectMapper()).callbackTo(&EchoDtoBody::returnResponse);
return request->readBodyToDtoAsync<oatpp::Object<MessageDto>>(controller->getDefaultObjectMapper()).callbackTo(&EchoDtoBody::returnResponse);
}

Action returnResponse(const MessageDto::ObjectWrapper& body){
Action returnResponse(const oatpp::Object<MessageDto>& body){
return _return(controller->createDtoResponse(Status::CODE_200, body));
}

Expand Down
8 changes: 4 additions & 4 deletions src/dto/MyDTOs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
* Data Transfer Object. Object containing fields only.
* Used in API for serialization/deserialization and validation
*/
class HelloDto : public oatpp::Object {
class HelloDto : public oatpp::DTO {

DTO_INIT(HelloDto, Object)
DTO_INIT(HelloDto, DTO)

DTO_FIELD(String, userAgent, "user-agent");
DTO_FIELD(String, message);
DTO_FIELD(String, server);

};

class MessageDto : public oatpp::Object {
class MessageDto : public oatpp::DTO {

DTO_INIT(MessageDto, Object)
DTO_INIT(MessageDto, DTO)

DTO_FIELD(String, message);

Expand Down

0 comments on commit f9d62c7

Please sign in to comment.