Skip to content
Repos

DevPlaceApp

C++ 523 B25 lines Opens in site

Directory Raw Download

#pragma once
// Spec: models.md ArticleDetail.
#include <cstdint>
#include <string>
#include <vector>

#include "core/Json.hpp"
#include "model/Article.hpp"
#include "model/Comment.hpp"

namespace dp {

struct ArticleDetail {
  Article::Data article;
  std::string canonicalSlug;
  std::string imageUrl;
  std::int64_t grade = 0;
  std::vector<Comment> comments;
  bool bookmarked = false;

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

}  // namespace dp
34.6ms