mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
extends classes with additional access functions needed for next step
This commit is contained in:
parent
c13c39e42b
commit
3cffee31ce
@ -77,6 +77,23 @@ namespace controller {
|
||||
}
|
||||
return resultVector;
|
||||
}
|
||||
|
||||
JsonRequest Group::createJsonRequest()
|
||||
{
|
||||
int port = 0;
|
||||
port = ServerConfig::g_serverPort;
|
||||
if (!port) {
|
||||
if (ServerConfig::SERVER_TYPE_PRODUCTION == ServerConfig::g_ServerSetupType ||
|
||||
ServerConfig::SERVER_TYPE_STAGING == ServerConfig::g_ServerSetupType) {
|
||||
port = 443;
|
||||
}
|
||||
else {
|
||||
port = 80;
|
||||
}
|
||||
}
|
||||
auto model = getModel();
|
||||
return JsonRequest(model->getUrl(), port);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,8 @@
|
||||
|
||||
#include "../model/table/Group.h"
|
||||
|
||||
#include "../lib/JsonRequest.h"
|
||||
|
||||
#include "Poco/SharedPtr.h"
|
||||
|
||||
#include "TableControllerBase.h"
|
||||
@ -23,7 +25,7 @@ namespace controller {
|
||||
inline bool deleteFromDB() { return mDBModel->deleteFromDB(); }
|
||||
|
||||
inline Poco::AutoPtr<model::table::Group> getModel() { return _getModel<model::table::Group>(); }
|
||||
|
||||
JsonRequest createJsonRequest();
|
||||
|
||||
protected:
|
||||
Group(model::table::Group* dbModel);
|
||||
|
||||
@ -591,4 +591,13 @@ namespace controller {
|
||||
return mGroupBaseUrl;
|
||||
}
|
||||
|
||||
Poco::AutoPtr<controller::Group> User::getGroup()
|
||||
{
|
||||
auto model = getModel();
|
||||
if (!model->getGroupId()) {
|
||||
return nullptr;
|
||||
}
|
||||
return controller::Group::load(model->getGroupId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
#include <shared_mutex>
|
||||
|
||||
#include "TableControllerBase.h"
|
||||
#include "Group.h"
|
||||
|
||||
enum UserState
|
||||
{
|
||||
@ -147,6 +148,7 @@ namespace controller {
|
||||
inline int getBalance() { std::shared_lock<std::shared_mutex> _lock(mSharedMutex); return mGradidoCurrentBalance; }
|
||||
|
||||
std::string getGroupBaseUrl();
|
||||
Poco::AutoPtr<controller::Group> getGroup();
|
||||
|
||||
// connection to other tables
|
||||
|
||||
|
||||
@ -40,6 +40,9 @@ namespace DataTypeConverter {
|
||||
|
||||
std::string binToBase64(const unsigned char* data, size_t size, int variant = sodium_base64_VARIANT_ORIGINAL);
|
||||
inline std::string binToBase64(const MemoryBin* data, int variant = sodium_base64_VARIANT_ORIGINAL) { return binToBase64(data->data(), data->size(), variant); }
|
||||
inline std::string binToBase64(const std::string& proto_bin, int variant = sodium_base64_VARIANT_ORIGINAL) {
|
||||
return binToBase64((const unsigned char*)proto_bin.data(), proto_bin.size(), variant);
|
||||
}
|
||||
|
||||
std::string binToHex(const unsigned char* data, size_t size);
|
||||
std::string binToHex(const Poco::Nullable<Poco::Data::BLOB>& nullableBin);
|
||||
|
||||
@ -319,5 +319,15 @@ namespace model {
|
||||
}
|
||||
return BLOCKCHAIN_UNKNOWN;
|
||||
}
|
||||
|
||||
const char* TransactionBody::getBlockchainTypeString() const
|
||||
{
|
||||
switch (mBlockchainType) {
|
||||
case BLOCKCHAIN_HEDERA: return "hedera";
|
||||
case BLOCKCHAIN_MYSQL: return "mysql";
|
||||
case BLOCKCHAIN_UNKNOWN: return "unknown";
|
||||
}
|
||||
return "invalid";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,6 +82,9 @@ namespace model {
|
||||
|
||||
static BlockchainType blockchainTypeFromString(const std::string& blockainTypeString);
|
||||
inline void setBlockchainType(BlockchainType blockchainType) { mBlockchainType = blockchainType;}
|
||||
inline bool isHederaBlockchain() { return mBlockchainType == BLOCKCHAIN_HEDERA; }
|
||||
inline bool isMysqlBlockchain() { return mBlockchainType == BLOCKCHAIN_MYSQL; }
|
||||
const char* getBlockchainTypeString() const;
|
||||
|
||||
protected:
|
||||
TransactionBody();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user