34 lines
915 B
C++
34 lines
915 B
C++
#pragma once
|
|
|
|
#include <nlohmann/json.hpp>
|
|
|
|
#include <mutex>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace lm {
|
|
|
|
class Database;
|
|
|
|
class PathStore
|
|
{
|
|
public:
|
|
explicit PathStore(Database& db);
|
|
|
|
nlohmann::json list(const std::string& site_id = "") const;
|
|
std::optional<nlohmann::json> find(const std::string& id) const;
|
|
std::optional<nlohmann::json> findBetween(const std::string& map_id,
|
|
const std::string& from_position_id,
|
|
const std::string& to_position_id) const;
|
|
std::optional<nlohmann::json> upsert(const nlohmann::json& payload, std::string& err);
|
|
bool remove(const std::string& id, std::string& err);
|
|
int removeForMap(const std::string& map_id);
|
|
int removeForPosition(const std::string& map_id, const std::string& position_id);
|
|
|
|
private:
|
|
Database& db_;
|
|
mutable std::mutex mu_;
|
|
};
|
|
|
|
} // namespace lm
|