ADD: metadata when user created

This commit is contained in:
igor 2018-12-10 12:39:54 +00:00
parent d1de8cf447
commit 1aa9827e1c
3 changed files with 6 additions and 1 deletions

View File

@ -71,6 +71,10 @@ export class User {
await this._saveUserToDatabase();
}
async saveMetadata(metadata) {
return await this._redis.set('metadata_for_' + this._userid, JSON.stringify(metadata));
}
async loadByLoginAndPassword(login, password) {
let userid = await this._redis.get('user_' + login + '_' + this._hash(password));

View File

@ -59,6 +59,7 @@ router.post('/create', async function(req, res) {
let u = new User(redis);
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() });
});

View File

@ -19,6 +19,6 @@ User storage schema
* balance_for_{userid} = {int}
* txs_for_{userid} = [] `serialized paid lnd invoices in a list`
* imported_txids_for_{userid} = [] `list of txids processed for this user`
* metadata_for_{userid}= {serialized json}