aboutsummaryrefslogtreecommitdiffstats
path: root/routes/admin.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2021-06-10 11:28:04 -0700
committerAdam Soltys <[email protected]>2021-06-10 11:28:04 -0700
commit0718bb82f64381c7b119dedd3c510d2a18412296 (patch)
tree7af15f3fe043dd6a1e2c109b19d36f5502580d79 /routes/admin.js
parent0e16d7754e41e718ea0fd6879ea5f22c762d8c52 (diff)
downloadcoinos-server-0718bb82f64381c7b119dedd3c510d2a18412296.tar.gz
coinos-server-0718bb82f64381c7b119dedd3c510d2a18412296.zip
missing updates
Diffstat (limited to 'routes/admin.js')
-rw-r--r--routes/admin.js120
1 files changed, 87 insertions, 33 deletions
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: <list of users }
+/**
+ * @api {get} /users Retrieve user list
+ * @apiName getUsers
+ * @apiGroup Admin
+ *
+ * @apiPermission admin
+ *
+ * @apiSuccess {token: referral_code, expiry: expiry} Token and expiry if applicable.
+ * @apiSuccessExample {json} Success-Response:
+ * HTTP/1.1 200 OK
+ * {
+ * "users" : [
+ * { "username": 'John Doe', "email": '[email protected]', ...},
+ * { "username": 'Jane Doe', "email": '[email protected]', ...}
+ * ]
+ * }
+ */
router.get(
"/users",
auth,
@@ -29,10 +42,23 @@ router.get(
})
);
-// usage: GET '/referrals'
-//
-// Returns:
-// { referrals: <list of referral tokens> }
+/**
+ * @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: <list of referral tokens> }
+/**
+ * @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: [
-// <user attributes>,
-// Invoices:
-// <invoice attributes>,
-// Payments:
-// <invoice attributes>,
-// Orders:
-// <invoice attributes>,
-// ], ...
-// }
+/**
+ * @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": '[email protected]', invoices: 1, orders: 0, payments: 2 },
+ ...
+ * ]
+ * }
+ */
router.get(
"/user_transactions",
auth,
@@ -143,14 +187,24 @@ router.get(
})
);
-// usage: GET '/user_kyc'
-//
-// Returns:
-// {
-// users: [
-// <list of user attributes>,
-// kyc: <list of kyc attributes for this user>
-// ]
+/**
+ * @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": '[email protected]', ... kyc_data... },
+ ...
+ * ]
+ * }
+ */
router.get(
"/user_kyc",
auth,