#ifndef DB_H #define DB_H #include #include #include #include #include #include "post.h" struct User { uint64_t id = 0; std::string name = ""; std::string passwordHash = ""; User(uint64_t id, const std::string& name, const std::string& passwordHash) : id(id), name(name), passwordHash(passwordHash) {} }; class Database { sqlite3* db; public: Database() = delete; Database(const std::string& path); ~Database(); std::optional getPost(uint64_t id); std::vector getUserPosts(uint64_t userId); std::vector getTopPosts(uint64_t amount); void addPost(const Post& post); void addLike(uint64_t postId, uint64_t userId); std::optional getUser(uint64_t id); std::optional getUserByName(const std::string& name); // this will modify the user to have their user ID void addUser(User& user); }; #endif