Saving changes. Updated oatpp version has some breaking changes

This commit is contained in:
kdeng00
2020-12-18 03:18:23 -05:00
parent ff78baf3b9
commit ae58b60339
5 changed files with 83 additions and 63 deletions
+26 -24
View File
@@ -1,43 +1,45 @@
#ifndef LOGINRESULTDTO_H_
#define LOGINRESULTDTO_H_
#include "oatpp/core/data/mapping/type/Object.hpp"
#include "oatpp/core/macro/codegen.hpp"
// #include <oatpp/core/data/mapping/type/Object.hpp>
#include <oatpp/core/Types.hpp>
#include <oatpp/core/macro/codegen.hpp>
#include "model/Models.h"
namespace dto {
#include OATPP_CODEGEN_BEGIN(DTO)
class LoginResultDto : public oatpp::data::mapping::type::Object {
DTO_INIT(LoginResultDto, Object)
// class LoginResultDto : public oatpp::data::mapping::type::Object {
class LoginResultDto : public oatpp::DTO {
DTO_INIT(LoginResultDto, DTO)
DTO_FIELD(Int32, id);
DTO_FIELD(String, username);
DTO_FIELD(String, token);
DTO_FIELD(String, token_type);
DTO_FIELD(Int32, expiration);
DTO_FIELD(String, message);
DTO_FIELD(oatpp::Int32, id);
DTO_FIELD(oatpp::String, username);
DTO_FIELD(oatpp::String, token);
DTO_FIELD(oatpp::String, token_type);
DTO_FIELD(oatpp::Int32, expiration);
DTO_FIELD(oatpp::String, message);
};
class RegisterResultDto : public oatpp::data::mapping::type::Object {
DTO_INIT(RegisterResultDto, Object)
class RegisterResultDto : public oatpp::DTO {
DTO_INIT(RegisterResultDto, DTO)
DTO_FIELD(String, username);
DTO_FIELD(Boolean, registered);
DTO_FIELD(String, message);
DTO_FIELD(oatpp::String, username);
DTO_FIELD(oatpp::Boolean, registered);
DTO_FIELD(oatpp::String, message);
};
class UserDto : public oatpp::data::mapping::type::Object {
DTO_INIT(UserDto, Object)
class UserDto : public oatpp::DTO {
DTO_INIT(UserDto, DTO)
DTO_FIELD(Int32, userId);
DTO_FIELD(String, firstname);
DTO_FIELD(String, lastname);
DTO_FIELD(String, phone);
DTO_FIELD(String, email);
DTO_FIELD(String, username);
DTO_FIELD(String, password);
DTO_FIELD(oatpp::Int32, userId);
DTO_FIELD(oatpp::String, firstname);
DTO_FIELD(oatpp::String, lastname);
DTO_FIELD(oatpp::String, phone);
DTO_FIELD(oatpp::String, email);
DTO_FIELD(oatpp::String, username);
DTO_FIELD(oatpp::String, password);
};
#include OATPP_CODEGEN_END(DTO)
+16 -15
View File
@@ -1,28 +1,29 @@
#ifndef SONGDTO_H_
#define SONGDTO_H_
#include "oatpp/core/data/mapping/type/Object.hpp"
#include "oatpp/core/macro/codegen.hpp"
#include <oatpp/core/Types.hpp>
// #include <oatpp/core/data/mapping/type/Object.hpp>
#include <oatpp/core/macro/codegen.hpp>
#include "model/Models.h"
namespace dto {
#include OATPP_CODEGEN_BEGIN(DTO)
class SongDto : public oatpp::data::mapping::type::Object {
DTO_INIT(SongDto, Object)
class SongDto : public oatpp::DTO {
DTO_INIT(SongDto, DTO)
DTO_FIELD(Int32, id);
DTO_FIELD(String, title);
DTO_FIELD(String, artist);
DTO_FIELD(String, album_artist);
DTO_FIELD(String, album);
DTO_FIELD(String, genre);
DTO_FIELD(Int32, track);
DTO_FIELD(Int32, disc);
DTO_FIELD(Int32, year);
DTO_FIELD(Int32, duration);
DTO_FIELD(Int32, coverart_id);
DTO_FIELD(oatpp::Int32, id);
DTO_FIELD(oatpp::String, title);
DTO_FIELD(oatpp::String, artist);
DTO_FIELD(oatpp::String, album_artist);
DTO_FIELD(oatpp::String, album);
DTO_FIELD(oatpp::String, genre);
DTO_FIELD(oatpp::Int32, track);
DTO_FIELD(oatpp::Int32, disc);
DTO_FIELD(oatpp::Int32, year);
DTO_FIELD(oatpp::Int32, duration);
DTO_FIELD(oatpp::Int32, coverart_id);
};
#include OATPP_CODEGEN_END(DTO)
+11 -6
View File
@@ -9,18 +9,23 @@
namespace dto { namespace conversion {
class DtoConversions {
public:
static dto::LoginResultDto::ObjectWrapper toLoginResultDto(const model::User&, const model::Token&);
// static dto::LoginResultDto::ObjectWrapper toLoginResultDto(const model::User&, const model::Token&);
static dto::LoginResultDto toLoginResultDto(const model::User&, const model::Token&);
static dto::RegisterResultDto::ObjectWrapper toRegisterResultDto(
// static dto::RegisterResultDto::ObjectWrapper toRegisterResultDto(
static dto::RegisterResultDto toRegisterResultDto(
const model::RegisterResult&);
static dto::AlbumDto::ObjectWrapper toAlbumDto(const model::Album&);
// static dto::AlbumDto::ObjectWrapper toAlbumDto(const model::Album&);
static dto::AlbumDto toAlbumDto(const model::Album&);
static dto::SongDto::ObjectWrapper toSongDto(const model::Song&);
static dto::SongDto toSongDto(const model::Song&);
static model::Song toSong(dto::SongDto::ObjectWrapper&);
// static model::Song toSong(dto::SongDto::ObjectWrapper&);
static model::Song toSong(dto::SongDto*);
static model::User toUser(dto::UserDto::ObjectWrapper&);
// static model::User toUser(dto::UserDto::ObjectWrapper&);
static model::User toUser(dto::UserDto&);
};
}}