Skip to content

Commit

Permalink
Updated api endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
MoneroOcean committed May 10, 2020
1 parent b82aad5 commit e834f5d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,16 +507,6 @@ app.get('/miner/:address/stats', cache('1 minute'), function (req, res) {
});
});

app.post('/miner/:address/unsubscribeEmail', function (req, res) {
global.mysql.query("UPDATE users SET enable_email = 0 WHERE username = ?", [req.params.address]).then(function (result) {
if (!result.hasOwnProperty("affectedRows") || result.affectedRows != 1) {
return res.json({'msg': 'Unknown XMR address provided or it was already unsubscribed from emails'});
} else {
return res.json({'msg': 'Your email was unsubscribed from further notifications'});
}
});
});

app.get('/user/:address', function (req, res) {
global.mysql.query("SELECT payout_threshold, enable_email FROM users WHERE username = ? LIMIT 1", [req.params.address]).then(function(row){
if (row.length == 1) {
Expand All @@ -535,6 +525,16 @@ app.post('/user/subscribeEmail', function (req, res) {
});
});

app.get('/user/:address/unsubscribeEmail', function (req, res) {
global.mysql.query("UPDATE users SET enable_email = 0 WHERE username = ?", [req.params.address]).then(function (result) {
if (!result.hasOwnProperty("affectedRows") || result.affectedRows != 1) {
return res.json({'msg': 'Unknown XMR address provided or it was already unsubscribed from emails'});
} else {
return res.json({'msg': 'Your email was unsubscribed from further notifications'});
}
});
});

app.post('/user/updateThreshold', function (req, res) {
const threshold = req.body.threshold;
if (!threshold) return res.status(401).send({'success': false, 'msg': "Can't set threshold to a wrong value"});
Expand Down

0 comments on commit e834f5d

Please sign in to comment.