generated from Sithas/conan_template
DAO - работает изменение данных
This commit is contained in:
@@ -93,7 +93,16 @@ pair<bool, vector<User>> MySQLUserDAO::GetAll(size_t limit, size_t offset)
|
|||||||
|
|
||||||
bool MySQLUserDAO::Update(const User& u)
|
bool MySQLUserDAO::Update(const User& u)
|
||||||
{
|
{
|
||||||
return false;
|
auto schema = session_.getSchema("up_and_down");
|
||||||
|
auto table = schema.getTable("users");
|
||||||
|
mysqlx::Result res = table.update()
|
||||||
|
.set("login", u.GetLogin())
|
||||||
|
.set("hashed_password", u.GetHashedPassword())
|
||||||
|
.where("uuid = :uuid")
|
||||||
|
.bind("uuid", u.GetUUID())
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
return res.getAffectedItemsCount() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MySQLUserDAO::Delete(string id)
|
bool MySQLUserDAO::Delete(string id)
|
||||||
|
|||||||
@@ -97,6 +97,15 @@ public:
|
|||||||
|
|
||||||
const auto uuid_stringified = user_dao_->Create(user);
|
const auto uuid_stringified = user_dao_->Create(user);
|
||||||
|
|
||||||
|
{
|
||||||
|
User updated_user;
|
||||||
|
updated_user.SetUUID("c792bbe6-2bf2-4fe0-a781-ba96bfeaa3b6");
|
||||||
|
updated_user.SetLogin("login56");
|
||||||
|
updated_user.SetPassword("Qwerty123456");
|
||||||
|
|
||||||
|
user_dao_->Update(updated_user);
|
||||||
|
}
|
||||||
|
|
||||||
http::response<ResponseType> res{
|
http::response<ResponseType> res{
|
||||||
http::status::created, req.version()
|
http::status::created, req.version()
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user