From 0718bb82f64381c7b119dedd3c510d2a18412296 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 10 Jun 2021 11:28:04 -0700 Subject: missing updates --- routes/admin.js | 120 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 87 insertions(+), 33 deletions(-) (limited to 'routes/admin.js') diff --git a/routes/admin.js b/routes/admin.js index 566de322..b02b6b6e 100644 --- a/routes/admin.js +++ b/routes/admin.js @@ -7,10 +7,23 @@ const Op = Sequelize.Op; const { v4: uuidv4 } = require('uuid'); -// usage: GET '/users' -// -// Returns: -// { users: } +/** + * @api {get} /referrals Retrieve list of referral tokens + * @apiName referrals + * @apiGroup Admin + * + * @apiPermission admin + * + * @apiSuccess returns list of referral tokens + * @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 }, + * ] + * } + */ router.get( "/referrals", auth, @@ -63,10 +89,23 @@ router.get( }) ); -// usage: GET '/accounts' -// -// Returns: -// { referrals: } +/** + * @api {get} /accounts Retrieve list of accounts + * @apiName accounts + * @apiGroup Admin + * + * @apiPermission admin + * + * @apiSuccess returns list of accounts + * @apiSuccessExample {json} Success-Response: + * HTTP/1.1 200 OK + * { + * "accounts" : [ + * { "user": 'Adam', "account_id": '123', balance: 500 ... }, + * ... + * ] + * } + */ router.get( "/accounts", auth, @@ -89,19 +128,24 @@ router.get( }) ); -// usage: GET '/user/transactions' -// -// Returns: -// { users: [ -// , -// Invoices: -// , -// Payments: -// , -// Orders: -// , -// ], ... -// } +/** + * @api {get} /user_transactions Retrieve summary of user transactions + * + * @apiName user_transactions + * @apiGroup Admin + * + * @apiPermission admin + * + * @apiSuccess returns list of invoices, payments, orders for users + * @apiSuccessExample {json} Success-Response: + * HTTP/1.1 200 OK + * { + * "transactions" : [ + * { "username": 'Adam', "email": 'adam@gmail.com', invoices: 1, orders: 0, payments: 2 }, + ... + * ] + * } + */ router.get( "/user_transactions", auth, @@ -143,14 +187,24 @@ router.get( }) ); -// usage: GET '/user_kyc' -// -// Returns: -// { -// users: [ -// , -// kyc: -// ] +/** + * @api {get} /user_kyc Retrieve user kyc details + * + * @apiName user_kyc + * @apiGroup Admin + * + * @apiPermission admin + * + * @apiSuccess returns list of kyc details for each user + * @apiSuccessExample {json} Success-Response: + * HTTP/1.1 200 OK + * { + * "users" : [ + * { "username": 'Adam', "email": 'adam@gmail.com', ... kyc_data... }, + ... + * ] + * } + */ router.get( "/user_kyc", auth, -- cgit v1.2.3