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) {
|
||||
u->setBalance(balance);
|
||||
}
|
||||
auto nu = session->getNewUser();
|
||||
if (!nu.isNull()) {
|
||||
nu->setBalance(balance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
namespace controller {
|
||||
User::User(model::table::User* dbModel)
|
||||
: mPassword(nullptr), mGradidoKeyPair(nullptr), mCanDecryptPrivateKey(false)
|
||||
: mPassword(nullptr), mGradidoKeyPair(nullptr), mCanDecryptPrivateKey(false), mGradidoCurrentBalance(0)
|
||||
{
|
||||
mDBModel = dbModel;
|
||||
}
|
||||
|
||||
@ -109,6 +109,9 @@ namespace controller {
|
||||
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:
|
||||
|
||||
User(model::table::User* dbModel);
|
||||
@ -120,6 +123,10 @@ namespace controller {
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user