generated from Sithas/conan_template
Post Diary
This commit is contained in:
@@ -48,15 +48,63 @@ std::vector<diary_dto> MySqlDiariesDAO::GetDiariesByUserUUID(const std::string&
|
||||
dto.dream_level = row[7].get<int>();
|
||||
dto.anxiety_level = row[8].get<int>();
|
||||
|
||||
dto.comment =
|
||||
row[9].isNull() ? "" : row[9].get<std::string>();
|
||||
dto.comment = row[9].get<std::string>();
|
||||
|
||||
dto.user_treatment_scheme_uuid =
|
||||
row[10].isNull() ? "" : row[10].get<std::string>();
|
||||
dto.user_treatment_scheme_uuid = row[10].get<std::string>();
|
||||
|
||||
diaries.push_back(std::move(dto));
|
||||
}
|
||||
|
||||
return diaries;
|
||||
}
|
||||
|
||||
void MySqlDiariesDAO::СreateDiary(const std::string& user_uuid, const diary_dto& dto) const
|
||||
{
|
||||
auto stmt = session_.sql(R"(
|
||||
INSERT INTO `up_and_down`.`diaries` (
|
||||
uuid,
|
||||
user_uuid,
|
||||
time,
|
||||
mania_level,
|
||||
depression_level,
|
||||
mood_level,
|
||||
activity_level,
|
||||
appetite_level,
|
||||
dream_level,
|
||||
anxiety_level,
|
||||
comment,
|
||||
user_treatment_schemes_uuid
|
||||
) VALUES (
|
||||
?,
|
||||
?,
|
||||
FROM_UNIXTIME(? / 1000),
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?
|
||||
)
|
||||
)");
|
||||
|
||||
stmt.bind(
|
||||
dto.uuid,
|
||||
user_uuid,
|
||||
dto.time_ms,
|
||||
dto.mania_level,
|
||||
dto.depression_level,
|
||||
dto.mood_level,
|
||||
dto.activity_level,
|
||||
dto.appetite_level,
|
||||
dto.dream_level,
|
||||
dto.anxiety_level,
|
||||
dto.comment,
|
||||
dto.user_treatment_scheme_uuid
|
||||
);
|
||||
|
||||
stmt.execute();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user