Skip to content
Repos

DevPlaceApp

C++ 841 B35 lines Opens in site

Directory Raw Download

#pragma once
// Spec: models.md ProjectDetail. platforms and forked_from are not decoded.
#include <cstdint>
#include <vector>

#include "core/Json.hpp"
#include "model/Attachment.hpp"
#include "model/Comment.hpp"
#include "model/Project.hpp"
#include "model/Reactions.hpp"
#include "model/User.hpp"
#include "model/Vote.hpp"

namespace dp {

struct ProjectDetail {
  Project::Data project;
  User author;
  bool isOwner = false;
  std::int64_t starCount = 0;
  Vote myVote;
  std::vector<Comment> comments;
  std::vector<Attachment> attachments;
  bool bookmarked = false;
  bool isPrivate = false;
  bool readOnly = false;
  std::int64_t forkCount = 0;
  std::int64_t fileCount = 0;
  Reactions reactions;

  static ProjectDetail fromJson(const Json& j);
  std::string id() const { return "project:" + project.id; }
};

}  // namespace dp
23.5ms