Skip to content

Commit

Permalink
Merge 74c3fcb into 4319eb6
Browse files Browse the repository at this point in the history
  • Loading branch information
mariano-aguero committed Jun 28, 2019
2 parents 4319eb6 + 74c3fcb commit fc79c4c
Show file tree
Hide file tree
Showing 26 changed files with 226 additions and 480 deletions.
3 changes: 0 additions & 3 deletions index.route.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const express = require('express')
const subscribersRouters = require('./server/subscriber/subscriber.route')
const earningsRouters = require('./server/earning/earning.route')
const telegramRouters = require('./server/telegram/telegram.route')
const roundRouters = require('./server/round/round.route')
const delegateRouters = require('./server/delegate/delegate.route')
Expand All @@ -12,8 +11,6 @@ router.get('/health-check', (req, res) => res.send('OK'))

router.use('/subscribers', subscribersRouters)

router.use('/earnings', earningsRouters)

router.use('/telegrams', telegramRouters)

router.use('/rounds', roundRouters)
Expand Down
27 changes: 7 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
},
"scripts": {
"start": "nodemon --harmony index.js",
"start:telegram-bot": "nodemon --harmony server/jobs/running-bot-telegram.js",
"start:worker-did-reward": "node --harmony ./server/jobs/worker-notification-delegate-did-reward-call.js",
"start:worker-claim-reward": "node --harmony ./server/jobs/worker-notification-delegator-claim-reward-call.js",
"lint": "esw *.js server config --color",
"lint:watch": "npm run lint -- --watch",
"test": "NODE_ENV=test ./node_modules/.bin/mocha test/*.test.js --timeout=1200000 --ui bdd --reporter spec --colors server --harmony --exit",
Expand Down
18 changes: 0 additions & 18 deletions server/earning/earning.controller.js

This file was deleted.

97 changes: 0 additions & 97 deletions server/earning/earning.model.js

This file was deleted.

11 changes: 0 additions & 11 deletions server/earning/earning.route.js

This file was deleted.

3 changes: 1 addition & 2 deletions server/helpers/sdk/delegator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const LivepeerSDK = require('@mariano-aguero/sdk')
const { MathBN } = require('../utils')

const getLivepeerDelegatorAccount = async address => {
if (!address) {
return null
Expand Down Expand Up @@ -31,6 +29,7 @@ const getLivepeerDelegatorStake = async address => {

const getTotalStakeFromSummary = summary => {
const { bondedAmount = 0, pendingStake = 0 } = summary
const { MathBN } = require('../utils')
return MathBN.max(bondedAmount, pendingStake)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {
sendgridTemplateIdDidRewardCallPayAttention
} = config

const sendEmailDidRewardCall = async data => {
const sendEmail = async data => {
const { email, templateId } = data

sgMail.setApiKey(sendgridAPIKEY)
Expand All @@ -29,19 +29,19 @@ const sendEmailDidRewardCall = async data => {
unsubscribeEmailUrl: unsubscribeEmailUrl
}
}

if (!['test'].includes(config.env)) {
try {
await sgMail.send(msg)
console.log(`Email sended to ${email} successfully`)
} catch (err) {
console.log('error on email')
console.log(err)
}
}
return
}

const sendNotificationEmail = async data => {
const sendDelegateNotificationEmail = async data => {
try {
const { subscriber, delegateCalledReward } = data

Expand All @@ -55,7 +55,7 @@ const sendNotificationEmail = async data => {
templateId
}

await sendEmailDidRewardCall(emailData)
await sendEmail(emailData)

// Save last email sent
subscriber.lastEmailSent = Date.now()
Expand All @@ -66,4 +66,4 @@ const sendNotificationEmail = async data => {
}
}

module.exports = { sendNotificationEmail }
module.exports = { sendDelegateNotificationEmail }
Loading

0 comments on commit fc79c4c

Please sign in to comment.