generated from Sithas/conan_template
Рабочая сборка второго executor'а
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
- Покрыть тестами класс User и AuthRegistrationExecutor
|
||||
- ~~Добавить clang-format(через CLion)~~
|
||||
- Перевести GetByUUID GetByLogin на const ref/string_view в IUserDAO - также не vector, а span(погуглить)
|
||||
- Привести к единоу виду функции IUserDAO
|
||||
- Пройтись по коду и максимально наставить const
|
||||
- Привести к единому виду функции IUserDAO
|
||||
- ~~Пройтись по коду и максимально наставить const~~
|
||||
- Указать возможные исключения в интерфейсах DAO
|
||||
- Вынести User в структуру. Hashed Password структура должна изначально состоять в другой структуре
|
||||
- SharedPtr - передавать по константной ссылке.
|
||||
|
||||
+3
-3
@@ -13,15 +13,15 @@ class IUserDAO
|
||||
public:
|
||||
virtual std::string Create(const User& created_user) = 0;
|
||||
|
||||
virtual std::optional<User> GetByUUID(std::string uuid) = 0;
|
||||
virtual std::optional<User> GetByUUID(const std::string& uuid) = 0;
|
||||
|
||||
virtual std::optional<User> GetByLogin(std::string login) = 0;
|
||||
virtual std::optional<User> GetByLogin(const std::string& login) = 0;
|
||||
|
||||
virtual std::pair<bool, std::vector<User>> GetAll(size_t limit, size_t offset) = 0;
|
||||
|
||||
virtual bool Update(const User& u) = 0;
|
||||
|
||||
virtual bool Delete(std::string uuid) = 0;
|
||||
virtual bool Delete(const std::string& uuid) = 0;
|
||||
|
||||
virtual ~IUserDAO() = default;
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ string MySQLUserDAO::Create(const User& created_user)
|
||||
return uuid_str;
|
||||
}
|
||||
|
||||
optional<User> MySQLUserDAO::GetByUUID(string uuid)
|
||||
optional<User> MySQLUserDAO::GetByUUID(const string& uuid)
|
||||
{
|
||||
mysqlx::SqlResult sql_result = session_.
|
||||
sql("SELECT * FROM `up_and_down`.`users` WHERE (uuid = '" + uuid +
|
||||
@@ -38,7 +38,7 @@ optional<User> MySQLUserDAO::GetByUUID(string uuid)
|
||||
return GetSingleUserBySQLResult(std::move(sql_result));
|
||||
}
|
||||
|
||||
optional<User> MySQLUserDAO::GetByLogin(string login)
|
||||
optional<User> MySQLUserDAO::GetByLogin(const string& login)
|
||||
{
|
||||
mysqlx::SqlResult sql_result = session_.
|
||||
sql("SELECT * FROM `up_and_down`.`users` WHERE (login = '" + login
|
||||
@@ -105,7 +105,7 @@ bool MySQLUserDAO::Update(const User& u)
|
||||
return !!res.getAffectedItemsCount();
|
||||
}
|
||||
|
||||
bool MySQLUserDAO::Delete(string uuid)
|
||||
bool MySQLUserDAO::Delete(const string& uuid)
|
||||
{
|
||||
auto schema = session_.getSchema("up_and_down");
|
||||
auto table = schema.getTable("users");
|
||||
|
||||
@@ -12,15 +12,15 @@ public:
|
||||
|
||||
std::string Create(const User& created_user) override;
|
||||
|
||||
std::optional<User> GetByUUID(std::string uuid) override;
|
||||
std::optional<User> GetByUUID(const std::string& uuid) override;
|
||||
|
||||
std::optional<User> GetByLogin(std::string login) override;
|
||||
std::optional<User> GetByLogin(const std::string& login) override;
|
||||
|
||||
std::pair<bool, std::vector<User>> GetAll(size_t limit, size_t offset) override;
|
||||
|
||||
bool Update(const User& u) override;
|
||||
|
||||
bool Delete(std::string uuid) override;
|
||||
bool Delete(const std::string& uuid) override;
|
||||
|
||||
private:
|
||||
std::optional<User> GetSingleUserBySQLResult(mysqlx::SqlResult&& sql_result);
|
||||
|
||||
Reference in New Issue
Block a user