@@ -17,7 +17,7 @@ Article Article::Parse(const models::TaggedArticleWithProfile& model) {
1717 article.profile .bio = model.authorProfile .bio ;
1818 article.profile .image = model.authorProfile .image ;
1919 article.profile .username = model.authorProfile .username ;
20- article.profile .isFollowing = model.authorProfile .isFollowing ;
20+ article.profile .following = model.authorProfile .following ;
2121 return article;
2222}
2323
@@ -41,31 +41,13 @@ Article Article::Parse(const models::FullArticleInfo& model,
4141 article.profile .bio = model.authorInfo .bio ;
4242 article.profile .image = model.authorInfo .image ;
4343 article.profile .username = model.authorInfo .username ;
44- article.profile .isFollowing =
44+ article.profile .following =
4545 authUserId ? model.authorFollowedByUsersIds .find (authUserId.value ()) !=
4646 model.authorFollowedByUsersIds .end ()
4747 : false ;
4848 return article;
4949}
5050
51- CreateArticleRequest CreateArticleRequest::Parse (
52- const userver::formats::json::Value& json) {
53- return CreateArticleRequest{
54- json[" title" ].As <std::optional<std::string>>(),
55- json[" description" ].As <std::optional<std::string>>(),
56- json[" body" ].As <std::optional<std::string>>(),
57- json[" tagList" ].As <std::optional<std::vector<std::string>>>()};
58- }
59-
60- UpdateArticleRequest UpdateArticleRequest::Parse (
61- const userver::formats::json::Value& json,
62- const userver::server::http::HttpRequest& request) {
63- return UpdateArticleRequest{
64- json[" title" ].As <std::optional<std::string>>(),
65- json[" description" ].As <std::optional<std::string>>(),
66- json[" body" ].As <std::optional<std::string>>()};
67- }
68-
6951userver::formats::json::Value Serialize (
7052 const Article& article,
7153 userver::formats::serialize::To<userver::formats::json::Value>) {
@@ -74,11 +56,11 @@ userver::formats::json::Value Serialize(
7456 builder[" title" ] = article.title ;
7557 builder[" description" ] = article.description ;
7658 builder[" body" ] = article.body ;
77- builder[" tagList " ] = userver::formats::common::Type::kArray ;
59+ builder[" tags " ] = userver::formats::common::Type::kArray ;
7860 if (article.tags ) {
7961 std::for_each (
8062 article.tags ->begin (), article.tags ->end (),
81- [&builder](const auto & tag) { builder[" tagList " ].PushBack (tag); });
63+ [&builder](const auto & tag) { builder[" tags " ].PushBack (tag); });
8264 }
8365 builder[" createdAt" ] = article.createdAt ;
8466 builder[" updatedAt" ] = article.updatedAt ;
0 commit comments