aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRan Guin <[email protected]>2021-08-21 12:19:26 -0700
committerRan Guin <[email protected]>2021-08-21 12:19:26 -0700
commitfaf60d3057cf4a9d691141e568e6255005de2e79 (patch)
tree403777b0938a947c6715aad0353a33a31368178f
parent6724a8660b9d47dcbac362122006cf454f13512f (diff)
downloadcoinos-server-faf60d3057cf4a9d691141e568e6255005de2e79.tar.gz
coinos-server-faf60d3057cf4a9d691141e568e6255005de2e79.zip
fix referrals route
-rw-r--r--routes/admin.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/routes/admin.js b/routes/admin.js
index c7b7578d..d12e3ecf 100644
--- a/routes/admin.js
+++ b/routes/admin.js
@@ -73,7 +73,7 @@ router.get(
"/referrals",
auth,
ah(async (req, res) => {
- var referrals = await knex
+ var referrals = knex
.select(
'token',
'users.username as user',
@@ -93,20 +93,25 @@ router.get(
// ]
// })
- var timeCondition = parseInput.addTimeSearch(req.query, 'referrals.updatedAt')
+ var timeCondition = parseInput.addTimeSearch(req.query, 'referrals.updated_at')
var userCondition = parseInput.addUserSearch(req.query, 'sponsor')
- if (timeCondition) referrals = referrals.whereRaw(timeCondition)
- if (userCondition) referrals = referrals.whereRaw(userCondition)
+ if (userCondition) {
+ referrals = referrals.whereRaw(userCondition)
+ }
+ if (timeCondition) {
+ referrals = referrals.whereRaw(timeCondition)
+ }
- debug('Referrals: ' + JSON.stringify(referrals))
- return res.send({referrals: referrals})
+ var found = await referrals
+ debug('Referrals: ' + JSON.stringify(found))
+ return res.send({referrals: found})
})
);
/**
- * @api {get} /referrals Retrieve list of referral tokens
- * @apiName referrals
+ * @api {get} /waiting_list Retrieve waiting_list
+ * @apiName waiting_list
* @apiGroup Admin
*
* @apiPermission admin
@@ -115,9 +120,9 @@ router.get(
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* {
- * "referrals" : [
- * { "token": '***', "status": 'pending', sponsor: 'Adam', user: 'newUsername1', expiry: null },
- * { "token": '***', "status": 'pending', sponsor: 'Adam', user: 'newUsername2', expiry: null },
+ * "waiting_list" : [
+ * { email: "[email protected]", phone: '604 123-4567 },
+ * { email: "[email protected]", phone: '604 246-8910 },
* ]
* }
*/