mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add balance also to new User, for replacing old user model in CheckTransactionPage
This commit is contained in:
parent
ed0aa38813
commit
07ff9be91e
@ -37,6 +37,10 @@ Poco::JSON::Object* JsonTransaction::handle(Poco::Dynamic::Var params)
|
|||||||
if (u) {
|
if (u) {
|
||||||
u->setBalance(balance);
|
u->setBalance(balance);
|
||||||
}
|
}
|
||||||
|
auto nu = session->getNewUser();
|
||||||
|
if (!nu.isNull()) {
|
||||||
|
nu->setBalance(balance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
namespace controller {
|
namespace controller {
|
||||||
User::User(model::table::User* dbModel)
|
User::User(model::table::User* dbModel)
|
||||||
: mPassword(nullptr), mGradidoKeyPair(nullptr), mCanDecryptPrivateKey(false)
|
: mPassword(nullptr), mGradidoKeyPair(nullptr), mCanDecryptPrivateKey(false), mGradidoCurrentBalance(0)
|
||||||
{
|
{
|
||||||
mDBModel = dbModel;
|
mDBModel = dbModel;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,6 +108,9 @@ namespace controller {
|
|||||||
std::shared_lock<std::shared_mutex> _lock(mSharedMutex);
|
std::shared_lock<std::shared_mutex> _lock(mSharedMutex);
|
||||||
return mGradidoKeyPair;
|
return mGradidoKeyPair;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void setBalance(int gradidoBalance) { std::unique_lock<std::shared_mutex> _lock(mSharedMutex); mGradidoCurrentBalance = gradidoBalance; }
|
||||||
|
inline int getBalance() { std::shared_lock<std::shared_mutex> _lock(mSharedMutex); return mGradidoCurrentBalance; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -120,6 +123,10 @@ namespace controller {
|
|||||||
|
|
||||||
bool mCanDecryptPrivateKey;
|
bool mCanDecryptPrivateKey;
|
||||||
|
|
||||||
|
//! get this from community-server, later maybe from gradido-node
|
||||||
|
//! use it for showing balance in menu in check transaction
|
||||||
|
int mGradidoCurrentBalance;
|
||||||
|
|
||||||
mutable std::shared_mutex mSharedMutex;
|
mutable std::shared_mutex mSharedMutex;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user