generated from Sithas/conan_template
База для ручки PostUserMedicationsExecutor.h
This commit is contained in:
@@ -13,7 +13,7 @@ MySQLUserTreatmentSchemesDAO::MySQLUserTreatmentSchemesDAO(mysqlx::Session& sess
|
||||
std::vector<user_treatment_scheme_dto> MySQLUserTreatmentSchemesDAO::FindByUserLogin(
|
||||
const std::string& login)
|
||||
{
|
||||
const std::string query = R"(
|
||||
static const std::string query = R"(
|
||||
SELECT
|
||||
uts.uuid,
|
||||
uts.treatment_name,
|
||||
@@ -28,10 +28,7 @@ std::vector<user_treatment_scheme_dto> MySQLUserTreatmentSchemesDAO::FindByUserL
|
||||
ORDER BY uts.uuid
|
||||
)";
|
||||
|
||||
mysqlx::SqlStatement stmt = session_.sql(query);
|
||||
stmt.bind(login);
|
||||
|
||||
mysqlx::SqlResult result = stmt.execute();
|
||||
mysqlx::SqlResult result = session_.sql(query).bind(login).execute();
|
||||
|
||||
std::unordered_map<std::string, user_treatment_scheme_dto> scheme_map;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "../db/mysql_connector.h"
|
||||
#include "../DAO/IUserDAO.h"
|
||||
#include "../DAO/IMedicationsDAO.h"
|
||||
#include "../DAO/MySQLUserTreatmentSchemesDAO.h"
|
||||
#include "AuthRegistrationExecutor.h"
|
||||
#include "RootExecutor.h"
|
||||
#include "../DAO/MemoryAuthDAO.h"
|
||||
@@ -22,12 +23,14 @@ void HandleRequest(
|
||||
static std::shared_ptr<IUserDAO> user_dao = std::make_shared<MySQLUserDAO>(GetMySqlSession());
|
||||
static std::shared_ptr<IAuthDAO> auth_dao = std::make_shared<MemoryAuthDAO>(GetMySqlSession());
|
||||
static std::shared_ptr<IMedicationsDAO> medications_dao = std::make_shared<MySQLMedicationsDAO>(GetMySqlSession());
|
||||
static std::shared_ptr<IUserTreatmentSchemeDAO> user_treatment_schemes_dao = std::make_shared<MySQLUserTreatmentSchemesDAO>(GetMySqlSession());
|
||||
|
||||
static RootExecutor<Body, Allocator, boost::beast::http::string_body, Send> root_executor(
|
||||
GetMySqlSession(),
|
||||
user_dao,
|
||||
auth_dao,
|
||||
medications_dao
|
||||
medications_dao,
|
||||
user_treatment_schemes_dao
|
||||
);
|
||||
|
||||
root_executor(doc_root, std::move(req), std::forward<Send>(send));
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "../DAO/IUserDAO.h"
|
||||
#include "../DAO/IAuthDAO.h"
|
||||
#include "../DAO/IMedicationsDAO.h"
|
||||
#include "../DAO/IUserTreatmentSchemesDAO.h"
|
||||
#include "./../helpers/helpers.h"
|
||||
#include "./../exceptions/session_exception.h"
|
||||
|
||||
@@ -45,14 +46,19 @@ private:
|
||||
const std::shared_ptr<IUserDAO>& user_dao_;
|
||||
const std::shared_ptr<IAuthDAO>& auth_dao_;
|
||||
const std::shared_ptr<IMedicationsDAO>& medications_dao_;
|
||||
const std::shared_ptr<IUserTreatmentSchemeDAO>& user_treatment_scheme_dao_;
|
||||
|
||||
public:
|
||||
RootExecutor(
|
||||
mysqlx::Session& session,
|
||||
const std::shared_ptr<IUserDAO>& user_dao,
|
||||
const std::shared_ptr<IAuthDAO>& auth_dao,
|
||||
const std::shared_ptr<IMedicationsDAO>& medications_dao) :
|
||||
session_(session), user_dao_(user_dao), auth_dao_(auth_dao), medications_dao_(medications_dao)
|
||||
const std::shared_ptr<IMedicationsDAO>& medications_dao,
|
||||
const std::shared_ptr<IUserTreatmentSchemeDAO>& user_treatment_scheme_dao
|
||||
) :
|
||||
session_(session), user_dao_(user_dao),
|
||||
auth_dao_(auth_dao), medications_dao_(medications_dao),
|
||||
user_treatment_scheme_dao_(user_treatment_scheme_dao)
|
||||
{
|
||||
routes_pathes_["/api/v1/Auth/Register"] = std::make_unique<RouteController>(
|
||||
typename RouteController::HTTPMethodsToExecutors{
|
||||
|
||||
Reference in New Issue
Block a user