Files
App/src/storage/sound_store.hpp
HiepLM 098e1b2b69
Some checks failed
Test / test (push) Has been cancelled
Chuyển lưu trữ dữ liệu sang data base
2026-06-17 11:16:30 +07:00

34 lines
809 B
C++

#pragma once
#include <nlohmann/json.hpp>
#include <filesystem>
#include <mutex>
#include <optional>
#include <string>
namespace lm {
class Database;
class SoundStore
{
public:
SoundStore(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::optional<std::filesystem::path> filePath(const std::string& id) const;
bool saveFile(const std::string& id, const std::string& filename, const std::string& bytes, std::string& err);
private:
Database& db_;
mutable std::mutex mu_;
};
} // namespace lm