Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user creation flow #9

Merged
merged 4 commits into from
Apr 2, 2017
Merged

Add user creation flow #9

merged 4 commits into from
Apr 2, 2017

Conversation

Shastel
Copy link
Member

@Shastel Shastel commented Mar 22, 2017

No description provided.

package.json Outdated
@@ -22,7 +22,7 @@
"express": "^4.14.0",
"express-session": "^1.15.0",
"lru-native": "^0.4.0",
"message-factory": "21-23/message-factory#v2.4.0",
"message-factory": "21-23/message-factory#v2.5.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In yarn lock file the version is still 2.4.0. Use yarn remove message-factory + yarn add 21-23/message-factory#v2.5.0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx

Copy link
Member Author

@Shastel Shastel Mar 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #10

function processServerMessage(message) {
// TODO: move participant validation here
switch (message.name) {
case MESSAGE_NAME.participantJoined:
return participantIdentified(message.participantId, message.sessionId, message.role);
case MESSAGE_NAME.solutionEvaluated:
return solutionEvaluated(message);
case MESSAGE_NAME.createParticipant:
return createNewParticipant(message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO return createNewParticipant(message.userData); is better - createNewParticipant doesn't need the whole message

@@ -217,13 +219,25 @@ function processNewConnection(ws) {
});
}

function createNewParticipant(message) {
return UserService.create(message.userData)
.then((user) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As agreed - it user service operation will never throw but the error fact is 'null' in then callback. Please add a check for user

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@@ -9,6 +9,8 @@ const config = require('../../config');
const Server = WebSocketClient.Server;
const phoenix = createPhoenix(WebSocketClient, { uri: config.get('ARNAUX_URL'), timeout: 500 });

const UserService = require('../services/user-service');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly believe that ws-server will become a separate service in (near) future. So please pass the dependency into createWsServer (similar to parseCookie and loadProfiles)

@humanamburu
Copy link
Member

Conflicts

@Shastel
Copy link
Member Author

Shastel commented Mar 24, 2017

@humanamburu done

@DaQuirm
Copy link
Member

DaQuirm commented Mar 26, 2017

LGTM

@DaQuirm DaQuirm merged commit 6677066 into master Apr 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants