-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
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", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #10
src/ws/ws-server.js
Outdated
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); |
There was a problem hiding this comment.
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
src/ws/ws-server.js
Outdated
@@ -217,13 +219,25 @@ function processNewConnection(ws) { | |||
}); | |||
} | |||
|
|||
function createNewParticipant(message) { | |||
return UserService.create(message.userData) | |||
.then((user) => { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
src/ws/ws-server.js
Outdated
@@ -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'); |
There was a problem hiding this comment.
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
)
Conflicts |
@humanamburu done |
LGTM |
No description provided.