From f9d62c7c5d434b87900a7242d2c3375b75f18c6b Mon Sep 17 00:00:00 2001 From: lganzzzo Date: Sat, 23 May 2020 23:50:16 +0300 Subject: [PATCH] Update to the latest oatpp API. --- src/controller/MyController.hpp | 4 ++-- src/dto/MyDTOs.hpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/controller/MyController.hpp b/src/controller/MyController.hpp index 4b4c1a6..458e93c 100644 --- a/src/controller/MyController.hpp +++ b/src/controller/MyController.hpp @@ -82,10 +82,10 @@ class MyController : public oatpp::web::server::api::ApiController { ENDPOINT_ASYNC_INIT(EchoDtoBody) Action act() override { - return request->readBodyToDtoAsync(controller->getDefaultObjectMapper()).callbackTo(&EchoDtoBody::returnResponse); + return request->readBodyToDtoAsync>(controller->getDefaultObjectMapper()).callbackTo(&EchoDtoBody::returnResponse); } - Action returnResponse(const MessageDto::ObjectWrapper& body){ + Action returnResponse(const oatpp::Object& body){ return _return(controller->createDtoResponse(Status::CODE_200, body)); } diff --git a/src/dto/MyDTOs.hpp b/src/dto/MyDTOs.hpp index d50c432..39700b0 100644 --- a/src/dto/MyDTOs.hpp +++ b/src/dto/MyDTOs.hpp @@ -11,9 +11,9 @@ * 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); @@ -21,9 +21,9 @@ class HelloDto : public oatpp::Object { }; -class MessageDto : public oatpp::Object { +class MessageDto : public oatpp::DTO { - DTO_INIT(MessageDto, Object) + DTO_INIT(MessageDto, DTO) DTO_FIELD(String, message);