Files
App/src/storage/path_store.hpp
HiepLM 2ce8a23ce9
Some checks failed
Test / test (push) Has been cancelled
thêm phần paths
2026-06-23 17:51:54 +07:00

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