summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-05-01 00:34:39 +0500
committerilotterytea <iltsu@alright.party>2024-05-01 00:34:39 +0500
commit93f29bc557d178650928a2027370ae0823940110 (patch)
tree515a3769e9317e72e3fbbdafc43bfcf0ec36545b /src
parent6a05c1bc5990eb4b10cc2454b7f2679b0e51d4b9 (diff)
feat: UserRights model
Diffstat (limited to 'src')
-rw-r--r--src/schemas/user.hpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/schemas/user.hpp b/src/schemas/user.hpp
index 993ed34..909062c 100644
--- a/src/schemas/user.hpp
+++ b/src/schemas/user.hpp
@@ -63,4 +63,27 @@ namespace bot::schemas {
std::chrono::system_clock::time_point joined_at;
std::optional<std::chrono::system_clock::time_point> opted_out_at;
};
+
+ enum PermissionLevel { SUSPENDED, USER, VIP, MODERATOR, BROADCASTER };
+
+ 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() = default;
+
+ const int &get_id() const { return this->id; }
+ const int &get_user_id() const { return this->user_id; }
+ const int &get_channel_id() const { return this->channel_id; }
+ const PermissionLevel &get_level() const { return this->level; }
+
+ private:
+ int id, user_id, channel_id;
+ PermissionLevel level;
+ };
}