Skip to content
Repos

DevPlaceApp

C++ 762 B31 lines Opens in site

Directory Raw Download

#pragma once
// Spec: models.md Feed (+ Model Updates replacingPosts). daily_topic is intentionally not decoded.
#include <cstdint>
#include <optional>
#include <string>
#include <vector>

#include "core/Date.hpp"
#include "core/Json.hpp"
#include "model/Post.hpp"
#include "model/User.hpp"

namespace dp {

struct Feed {
  std::vector<Post> posts;
  std::string currentTab;
  std::optional<std::string> currentTopic;
  std::string search;
  std::optional<Date> nextCursor;
  std::int64_t totalMembers = 0;
  std::int64_t postsToday = 0;
  std::int64_t totalProjects = 0;
  std::int64_t totalGists = 0;
  std::vector<User> topAuthors;

  static Feed fromJson(const Json& j);
  Feed replacingPosts(const std::vector<Post>& newPosts) const;
};

}  // namespace dp
30.1ms