generated from Sithas/conan_template
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <boost/beast.hpp>
|
|
|
|
#include "../db/mysql_connector.h"
|
|
#include "../DAO/IUserDAO.h"
|
|
#include "../DAO/IMedicationsDAO.h"
|
|
#include "AuthRegistrationExecutor.h"
|
|
#include "RootExecutor.h"
|
|
#include "../DAO/MemoryAuthDAO.h"
|
|
#include "../DAO/MySQLUserDAO.h"
|
|
#include "../DAO/MySQLMedicationsDAO.h"
|
|
|
|
namespace uad
|
|
{
|
|
template <class Body, class Allocator, class Send>
|
|
void HandleRequest(
|
|
boost::beast::string_view doc_root,
|
|
boost::beast::http::request<Body, boost::beast::http::basic_fields<Allocator>>&& req,
|
|
Send&& send)
|
|
{
|
|
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 RootExecutor<Body, Allocator, boost::beast::http::string_body, Send> root_executor(
|
|
GetMySqlSession(),
|
|
user_dao,
|
|
auth_dao,
|
|
medications_dao
|
|
);
|
|
|
|
root_executor(doc_root, std::move(req), std::forward<Send>(send));
|
|
}
|
|
}
|