From 62730273ba3ff38583ee0b461e35ca7e8324f6d0 Mon Sep 17 00:00:00 2001 From: Nick Chaloult Date: Sat, 7 May 2022 21:05:25 -0400 Subject: [PATCH] Make account name a route param for set allowance admin endpoint --- backend/api/admin/adminController.js | 5 ++--- backend/api/admin/index.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/api/admin/adminController.js b/backend/api/admin/adminController.js index 112ec1f..d9e9da5 100644 --- a/backend/api/admin/adminController.js +++ b/backend/api/admin/adminController.js @@ -80,17 +80,16 @@ const updatePermissions = async (req, res) => { // Request body: // ``` // { -// accountName: string, // allowance: number, // } // ``` const setAccountAllowance = async (req, res) => { try { // TODO: Input verification logic? - const accountName = req.body.accountName; + const accountName = req.params.username; const newAllowance = req.body.allowance; const response = await adminService.setAccountAllowance(accountName, newAllowance); - debug.info(`Response for updating a family member's permissions: ${JSON.stringify(response)}`); + debug.info(`Response for setting a family member's allowance: ${JSON.stringify(response)}`); if (!response.success) res.status(500).json(response); else res.status(200).json(response); diff --git a/backend/api/admin/index.js b/backend/api/admin/index.js index fd81543..a73d5ed 100644 --- a/backend/api/admin/index.js +++ b/backend/api/admin/index.js @@ -7,6 +7,6 @@ router.get('/balances', getAllBalances); router.post('/add', addNewAccount); router.post('/transfer', keysend); router.post('/account/:username/permissions', updatePermissions) -router.post('/allowance', setAccountAllowance) +router.post('/account/:username/allowance', setAccountAllowance) module.exports = router;