This file contains 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
export default client => { | |
const create = user => { | |
return new Promise((resolve, reject) => { | |
client.put({ | |
TableName: 'users', | |
Item: user | |
}, (err, data) => { | |
if (err) { | |
return reject(err) | |
} |
This file contains 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
// | |
// websocket implementation using deepstream client | |
// | |
const db = new Db('testdb') | |
const ds = deepstream( '<DEEPSTREAM SERVER URL>' ) | |
ds.login() | |
const userRepository = UserRepositoryMongo(db) |
This file contains 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
// | |
// Email service interface implemented | |
// | |
async function updateUser ({userRepository, emailService, updateParams}) { | |
const { userId, userName, userEmail } = updateParams | |
// validate params | |
if (!userId || !userName || !userEmail) { | |
throw new InvalidParamsException('Missing required params') | |
} |
This file contains 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
export default ses => { | |
const send = params => { | |
return new Promise((resolve, reject) => { | |
const params = { | |
Destination: { | |
ToAddresses: [params.to] | |
}, | |
Message: { | |
Body: { | |
Text: { |
This file contains 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
// | |
// Express controller | |
// EmailServiceSES adapter | |
// | |
router.put('/user', async (req, res) => { | |
const conn = req.conn | |
// ses - aws ses instance (AWS.SES) | |
const ses = req.ses | |
const { userId, userName, userEmail } = req.body | |
OlderNewer