ADD: metadata when user created
This commit is contained in:
parent
d1de8cf447
commit
1aa9827e1c
@ -71,6 +71,10 @@ export class User {
|
|||||||
await this._saveUserToDatabase();
|
await this._saveUserToDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async saveMetadata(metadata) {
|
||||||
|
return await this._redis.set('metadata_for_' + this._userid, JSON.stringify(metadata));
|
||||||
|
}
|
||||||
|
|
||||||
async loadByLoginAndPassword(login, password) {
|
async loadByLoginAndPassword(login, password) {
|
||||||
let userid = await this._redis.get('user_' + login + '_' + this._hash(password));
|
let userid = await this._redis.get('user_' + login + '_' + this._hash(password));
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ router.post('/create', async function(req, res) {
|
|||||||
|
|
||||||
let u = new User(redis);
|
let u = new User(redis);
|
||||||
await u.create();
|
await u.create();
|
||||||
|
await u.saveMetadata({ partnerid: req.body.partnerid, accounttype: req.body.accounttype, created_at: new Date().toISOString() });
|
||||||
res.send({ login: u.getLogin(), password: u.getPassword() });
|
res.send({ login: u.getLogin(), password: u.getPassword() });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -19,6 +19,6 @@ User storage schema
|
|||||||
* balance_for_{userid} = {int}
|
* balance_for_{userid} = {int}
|
||||||
* txs_for_{userid} = [] `serialized paid lnd invoices in a list`
|
* txs_for_{userid} = [] `serialized paid lnd invoices in a list`
|
||||||
* imported_txids_for_{userid} = [] `list of txids processed for this user`
|
* imported_txids_for_{userid} = [] `list of txids processed for this user`
|
||||||
|
* metadata_for_{userid}= {serialized json}
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user