From 06a209c69c5480e8fd0b19625ef628a66e5f5713 Mon Sep 17 00:00:00 2001 From: Nick Chaloult Date: Sat, 7 May 2022 21:03:47 -0400 Subject: [PATCH] Make account name a route param for update permissions admin endpoint --- backend/api/admin/adminController.js | 3 +-- backend/api/admin/index.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/api/admin/adminController.js b/backend/api/admin/adminController.js index d28b4b0..112ec1f 100644 --- a/backend/api/admin/adminController.js +++ b/backend/api/admin/adminController.js @@ -54,7 +54,6 @@ const keysend = async (req, res) => { // Request body: // ``` // { -// accountName: string, // permissions: { // isAdmin: boolean, // hasAllowance: boolean, @@ -65,7 +64,7 @@ const keysend = async (req, res) => { const updatePermissions = async (req, res) => { try { // TODO: Input verification logic? - const accountName = req.body.accountName; + const accountName = req.params.username; const newPermissions = req.body.permissions; const response = await adminService.updatePermissions(accountName, newPermissions); debug.info(`Response for updating a family member's permissions: ${JSON.stringify(response)}`); diff --git a/backend/api/admin/index.js b/backend/api/admin/index.js index 660491b..fd81543 100644 --- a/backend/api/admin/index.js +++ b/backend/api/admin/index.js @@ -6,7 +6,7 @@ const { getAllBalances, addNewAccount, keysend, updatePermissions, setAccountAll router.get('/balances', getAllBalances); router.post('/add', addNewAccount); router.post('/transfer', keysend); -router.post('/permissions', updatePermissions) +router.post('/account/:username/permissions', updatePermissions) router.post('/allowance', setAccountAllowance) module.exports = router;