31 lines
639 B
C++
31 lines
639 B
C++
#pragma once
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
#include <mutex>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace lm {
|
|
|
|
class Database;
|
|
|
|
class SiteStore
|
|
{
|
|
public:
|
|
explicit SiteStore(Database& db);
|
|
|
|
nlohmann::json list() const;
|
|
std::optional<nlohmann::json> find(const std::string& id) const;
|
|
std::optional<nlohmann::json> create(const nlohmann::json& payload, std::string& err);
|
|
bool update(const std::string& id, const nlohmann::json& payload, std::string& err);
|
|
bool remove(const std::string& id, std::string& err);
|
|
std::string ensureDefaultSiteId();
|
|
|
|
private:
|
|
Database& db_;
|
|
mutable std::mutex mu_;
|
|
};
|
|
|
|
} // namespace lm
|