From 93f29bc557d178650928a2027370ae0823940110 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Wed, 1 May 2024 00:34:39 +0500 Subject: feat: UserRights model --- src/schemas/user.hpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/schemas') 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 opted_out_at; }; + + enum PermissionLevel { SUSPENDED, USER, VIP, MODERATOR, BROADCASTER }; + + class UserRights { + public: + UserRights(const pqxx::row &row) { + this->id = row[0].as(); + this->user_id = row[1].as(); + this->channel_id = row[2].as(); + this->level = static_cast(row[3].as()); + } + + ~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; + }; } -- cgit v1.2.3