Skip to content

Commit

Permalink
merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
b1acksun committed Mar 23, 2020
2 parents 2003b7d + a3e488b commit ac3ca7c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.1
1.4.0
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "registration-service",
"version": "1.3.1",
"version": "1.4.0",
"description": "Commun registration service",
"main": "./src/index.js",
"scripts": {
Expand Down
8 changes: 6 additions & 2 deletions src/controllers/Registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Registration extends Basic {
return { currentState: States.SET_USERNAME };
}

async setUsername({ phone, username, identity }) {
async setUsername({ phone, username, identity, referralId }) {
const userModel = await this._getUserModel(phone, identity);

if (!userModel) {
Expand All @@ -150,8 +150,12 @@ class Registration extends Basic {

const userId = await this.blockchain.generateNewUserId();

if (referralId || !env.GLS_ALLOW_NON_REFERRALS) {
await this.checkReferredUserExists({ referralId });
}

const query = identity ? { identity } : { phone };
await User.updateOne(query, { userId, username, state: States.TO_BLOCK_CHAIN });
await User.updateOne(query, { userId, username, state: States.TO_BLOCK_CHAIN, referralId });

return { userId, currentState: States.TO_BLOCK_CHAIN };
}
Expand Down
3 changes: 3 additions & 0 deletions src/services/Connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ class Connector extends BasicConnector {
username: {
type: 'string',
},
referralId: {
type: 'string',
},
},
},
},
Expand Down

0 comments on commit ac3ca7c

Please sign in to comment.