summaryrefslogtreecommitdiff
path: root/bot/src/schemas/user.hpp
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-07-02 03:31:54 +0500
committerilotterytea <iltsu@alright.party>2025-07-02 03:31:54 +0500
commit79be89ad0491bfdd110b2c612e21a0f28c29fa87 (patch)
tree589daab514de11cc87e424b62d87f8cac12494ab /bot/src/schemas/user.hpp
parentfea3c12d6b621796bb239cebb57a5a5014dfe350 (diff)
feat: MARIADB SUPPORT!!!!
Diffstat (limited to 'bot/src/schemas/user.hpp')
-rw-r--r--bot/src/schemas/user.hpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/bot/src/schemas/user.hpp b/bot/src/schemas/user.hpp
index e9d7e0f..ee9bd10 100644
--- a/bot/src/schemas/user.hpp
+++ b/bot/src/schemas/user.hpp
@@ -2,26 +2,26 @@
#include <chrono>
#include <optional>
-#include <pqxx/pqxx>
#include <sol/sol.hpp>
#include <string>
#include "../utils/chrono.hpp"
+#include "database.hpp"
namespace bot::schemas {
class User {
public:
- User(const pqxx::row &row) {
- this->id = row[0].as<int>();
- this->alias_id = row[1].as<int>();
- this->alias_name = row[2].as<std::string>();
+ User(const db::DatabaseRow &row) {
+ this->id = std::stoi(row.at("id"));
+ this->alias_id = std::stoi(row.at("alias_id"));
+ this->alias_name = row.at("alias_name");
this->joined_at =
- utils::chrono::string_to_time_point(row[3].as<std::string>());
+ utils::chrono::string_to_time_point(row.at("joined_at"));
- if (!row[4].is_null()) {
+ if (!row.at("opted_out_at").empty()) {
this->opted_out_at =
- utils::chrono::string_to_time_point(row[4].as<std::string>());
+ utils::chrono::string_to_time_point(row.at("opted_out_at"));
}
}
@@ -54,11 +54,11 @@ namespace bot::schemas {
class UserRights {
public:
- UserRights(const pqxx::row &row) {
- this->id = row[0].as<int>();
- this->user_id = row[1].as<int>();
- this->channel_id = row[2].as<int>();
- this->level = static_cast<PermissionLevel>(row[3].as<int>());
+ UserRights(const db::DatabaseRow &row) {
+ this->id = std::stoi(row.at("id"));
+ this->user_id = std::stoi(row.at("user_id"));
+ this->channel_id = std::stoi(row.at("channel_id"));
+ this->level = static_cast<PermissionLevel>(std::stoi(row.at("level")));
}
~UserRights() = default;