Skip to content
Repos

DevPlaceApp

C++ 871 B35 lines Opens in site

Directory Raw Download

#include "screens/post/PostDetailAdapter.hpp"

namespace dp {

PostDetail PostDetailAdapter::fromPost(const Post& post) {
  PostDetail d;
  d.post = post.data;
  d.author = post.author;
  d.isOwner = true;
  d.starCount = post.data.stars;
  d.myVote = post.myVote;
  d.comments = post.recentComments;
  d.attachments = post.attachments;
  d.bookmarked = post.bookmarked;
  d.poll = post.poll;
  d.commentCount = post.commentCount;
  d.reactions = post.reactions;
  return d;
}

Post PostDetailAdapter::toPost(const PostDetail& detail) {
  Post p;
  p.data = detail.post;
  p.author = detail.author;
  p.myVote = detail.myVote;
  p.commentCount = detail.commentCount;
  p.recentComments = detail.comments;
  p.bookmarked = detail.bookmarked;
  p.attachments = detail.attachments;
  p.poll = detail.poll;
  p.reactions = detail.reactions;
  return p;
}

}  // namespace dp
36.8ms