Created
May 13, 2019 21:11
-
-
Save jobelenus/61d1eadf41c0fc88773f5dd8442fac22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (identityUser.mobile == participantNum) { | |
console.log('identity does exist') | |
const participantEntry = new SideChatParticipants(participant) | |
// eslint-disable-next-line no-return-await | |
try { | |
return await participantEntry.save() | |
} catch(err) { | |
console.log(err) | |
return false // or -1, or something you can check for your error condition, or even re-reaise `err` | |
} | |
}) | |
// eslint-disable-next-line no-else-return | |
} else { | |
//if identity doesn't exist create in sql table and in dynamo table | |
console.log('identity doesnt exist') | |
let res = await rp.post({ | |
uri: `http://${ROUTER_HOST}/identity-service/identity`, | |
body: newParticipant, | |
json: true | |
}) | |
//creating an side chat participant in the dynamo db table | |
let participant.Id = res.id | |
const participantEntry = new SideChatParticipants(participant) | |
try { | |
return await participantEntry.save() | |
} catch (err) { | |
console.log(err) | |
return false // or -1, or something you can check for your error condition, or even re-reaise `err` | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment