Introduce proper HandlerFactory and reduce dependencies of RequestWorker

This commit is contained in:
2019-09-29 20:57:46 +02:00
джерело 0ccc20454b
коміт 8364ace683
5 змінених файлів з 46 додано та 55 видалено

@@ -9,27 +9,25 @@
#include "urlprovider.h"
#include "database/sessiondao.h"
#include "cache/fscache.h"
#include "handlers/handlerfactory.h"
class RequestWorker
{
Database *db;
Template *templ;
UrlProvider *urlProvider;
ICache *cache;
HandlerConfig *handlerConfig;
std::unique_ptr<SessionDao> sessionDao;
HandlerFactory *handlerFactory;
SessionDao *sessionDao;
private:
Session retrieveSession(std::string token) const;
public:
RequestWorker(HandlerConfig &handlerConfig, Database &db, Template &templ, UrlProvider &provider, ICache &cache)
RequestWorker(HandlerFactory &handlerFactory, SessionDao &sessionDao, Template &templ)
{
this->handlerConfig = &handlerConfig;
this->db = &db;
this->handlerFactory = &handlerFactory;
this->templ = &templ;
this->urlProvider = &provider;
this->sessionDao = db.createSessionDao();
this->cache = &cache;
this->sessionDao = &sessionDao;
}
Response processRequest(const Request &r);