Рабочая сборка с третьей ручкой

This commit is contained in:
Антон
2025-09-28 08:25:16 +03:00
parent 7469a61ca4
commit 2acd382f0c
+7 -14
View File
@@ -25,9 +25,7 @@ string MySQLUserDAO::Create(const user& created_user)
"INSERT INTO `up_and_down`.`users` (`uuid`, `login`, `hashed_password`) VALUES ('" "INSERT INTO `up_and_down`.`users` (`uuid`, `login`, `hashed_password`) VALUES ('"
+ uuid_str + "', '" + created_user.login +"', '" + created_user.hashed_password + "');"s; + uuid_str + "', '" + created_user.login +"', '" + created_user.hashed_password + "');"s;
session_.sql(sql_script) session_.sql(sql_script).execute();
.bind(uuid_str, created_user.login, created_user.hashed_password)
.execute();
return uuid_str; return uuid_str;
} }
@@ -89,10 +87,7 @@ pair<bool, vector<user>> MySQLUserDAO::GetAll(size_t limit, size_t offset)
const string user_uuid = row[0].get<string>(); const string user_uuid = row[0].get<string>();
const string user_login = row[1].get<string>(); const string user_login = row[1].get<string>();
user.login = user_login; ret.second.push_back({.uuid = user_uuid, .login = user_login});
user.uuid = user_uuid;
ret.second.push_back(std::move(user));
--limit; --limit;
} }
@@ -133,12 +128,10 @@ std::optional<user> MySQLUserDAO::GetSingleUserBySQLResult(mysqlx::SqlResult&& s
const string user_login = row_data[1].get<string>(); const string user_login = row_data[1].get<string>();
const string user_hashed_password = row_data[2].get<string>(); const string user_hashed_password = row_data[2].get<string>();
user single_user; return optional<user>({
.uuid = user_uuid,
single_user.uuid = user_uuid; .login = user_login,
single_user.login = user_login; .hashed_password = user_hashed_password
single_user.hashed_password = user_hashed_password; });
return optional<user>(std::move(single_user));
} }
} // uad } // uad