База для ручки PostUserMedicationsExecutor.h

This commit is contained in:
2026-01-09 13:45:16 +03:00
parent a3e69b65fb
commit c79ec099e9
16 changed files with 47 additions and 47 deletions
+4 -4
View File
@@ -10,20 +10,20 @@ MySQLMedicationsDAO::MySQLMedicationsDAO(mysqlx::Session& session): session_(ses
{
}
std::vector<medication> MySQLMedicationsDAO::GetAll() const
std::vector<medication_dto> MySQLMedicationsDAO::GetAll() const
{
static const string sql_script = "SELECT uuid, name, dose, unit, is_urgent FROM up_and_down.medications;";
mysqlx::SqlResult sql_result = session_.sql(sql_script).execute();
list<mysqlx::Row> rows = sql_result.fetchAll();
vector<medication> ret;
vector<medication_dto> ret;
if (rows.empty()) return ret;
for (const auto& row : rows)
{
medication m;
medication_dto m;
m.uuid = row[0].get<string>();
m.name = row[1].get<string>();
@@ -37,7 +37,7 @@ std::vector<medication> MySQLMedicationsDAO::GetAll() const
return ret;
}
std::string MySQLMedicationsDAO::Create(const medication& m) const
std::string MySQLMedicationsDAO::Create(const medication_dto& m) const
{
boost::uuids::random_generator generator;
boost::uuids::uuid uuid = generator();