#ifndef __LOGINDB_H__ #define __LOGINDB_H__ #include #include #include #include #include "json.hpp" #include "utils.hpp" #include "sqlite_orm.h" #include "magic_enum.hpp" namespace login { struct User { int id; std::string username; std::string password_hash; std::string last_login; std::string created_at; // SQLite stores DATETIME as TEXT }; inline User newUser(const std::string& username, std::string password_hash){ return User {-1, username, password_hash, utils::currentTime(), utils::currentTime()}; } NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(User, id, username, password_hash, last_login, created_at) int createUser(const std::string& username, const std::string& password_hash); std::optional getUser(const std::string& username); } #endif // __LOGINDB_H__