-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from arieldk1212/dev
dev --> main Merge
- Loading branch information
Showing
44 changed files
with
573 additions
and
626 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"TEST_DATABASE": { | ||
"username": "ci", | ||
"password": "password", | ||
"host": "localhost", | ||
"port": "5432", | ||
"dbname": "live_view_ci_test" | ||
}, | ||
|
||
"LOGGING": { | ||
"path": "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ class Geo { | |
std::string m_Latitude; | ||
}; | ||
|
||
#endif // GEO_H | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,57 @@ | ||
#ifndef RESPONSE_H | ||
#ifndef RESPONSE_H | ||
#define RESPONSE_H | ||
|
||
// INFO: this class is all about the response classes from different classes across the project. | ||
// meaning -> from db model a model returns a certain reponse from the db, due to that we will | ||
// create a class that will handle different reponse cases and return the right response, i.e: | ||
// virtual DBResponse WriteToDB(); -> it will hold data, codes, general info about the response. | ||
// Entity | ||
// TODO: add logic for the data separation from the full address to entity | ||
// block. INFO: when i get the address from the Address Class, it will be passed | ||
// down to Entity and the logic of the address separation to entities will be | ||
// dealt here, meaning i probably want to change the Entity Ctor to the address | ||
// itself, and the separate to Entities ( Data Structures ). INFO: the address | ||
// class will inherit from entity due to the need use of the private entity | ||
// members and their functionality. | ||
|
||
#include "Config/Logger.h" | ||
|
||
#include <chrono> | ||
#include <pqxx/pqxx> | ||
|
||
template <typename ResType> class Response { | ||
public: | ||
using Clock = std::chrono::high_resolution_clock; | ||
using DoubleDuration = std::chrono::duration<double>; | ||
|
||
public: | ||
virtual ~Response() = 0; | ||
|
||
virtual const std::string GetResponseQuery() const = 0; | ||
virtual const size_t GetResponseSize() const = 0; | ||
|
||
virtual DoubleDuration RunBenchmark(std::function<void()> Func) = 0; | ||
virtual const std::string ResponseType() = 0; | ||
}; | ||
|
||
class DBResponse : Response<pqxx::result> { | ||
public: | ||
explicit DBResponse(const pqxx::result &ResponseData); | ||
explicit DBResponse(pqxx::result &&ResponseData); | ||
|
||
[[nodiscard]] const std::string GetResponseQuery() const override { | ||
return m_ResponseData.query(); | ||
} | ||
[[nodiscard]] const size_t GetResponseSize() const override { return m_ResponseSize; } | ||
|
||
DoubleDuration RunBenchmark(std::function<void()> Func) override; | ||
const std::string ResponseType() override { return "Response: Database"; } | ||
|
||
private: | ||
size_t m_ResponseSize; | ||
pqxx::result m_ResponseData; | ||
}; | ||
|
||
/** | ||
* @brief | ||
* DBResponse x = Manager->AddModel; -> copy ctor | ||
* return DBReponse(CreateTable(Args...)); -> ctor | ||
*/ | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef ADDRESS_MODEL_H | ||
#define ADDRESS_MODEL_H | ||
|
||
#include "BaseModel.h" | ||
#include "Config/DatabaseCommands.h" | ||
|
||
class AddressModel : BaseModel { | ||
public: | ||
explicit AddressModel(std::shared_ptr<DatabaseManager> &Manager); | ||
~AddressModel() override; | ||
|
||
const std::string GetTableName() const override { return m_TableName; } | ||
|
||
pqxx::result Init() override; | ||
pqxx::result Add(const StringUnMap &Fields) override; | ||
// pqxx::result Update(const StringUnMap &Fields) override; | ||
// pqxx::result Delete(const StringUnMap &Fields) override; | ||
|
||
private: | ||
std::shared_ptr<DatabaseManager> m_DatabaseManager; | ||
|
||
private: | ||
std::string m_TableName; | ||
StringUnMap m_AddressFields = { | ||
{"addressname", | ||
DatabaseCommandToString(DatabaseFieldCommands::VarChar100Field)}, | ||
{"addressnumber", | ||
DatabaseCommandToString(DatabaseFieldCommands::IntField)}}; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef BASE_MODEL_H | ||
#define BASE_MODEL_H | ||
|
||
#include "Config/DatabaseManager.h" | ||
#include <nlohmann/json.hpp> | ||
#include <pqxx/pqxx> | ||
|
||
using Json = nlohmann::json; | ||
|
||
class BaseModel { | ||
public: | ||
virtual ~BaseModel() = 0; | ||
virtual const std::string GetTableName() const = 0; | ||
virtual pqxx::result Init() = 0; | ||
virtual pqxx::result Add(const StringUnMap &Fields) = 0; | ||
// virtual pqxx::result Update(const StringUnMap &Fields) = 0; | ||
// virtual pqxx::result Delete(const StringUnMap &Fields) = 0; | ||
|
||
// virtual Json SerializeModel(const std::string &Data) = 0; | ||
// virtual std::string DeserializeModel(const Json &JsonData) = 0; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.