Skip to content

Commit

Permalink
Make account name a route param for set allowance admin endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
nchaloult committed May 8, 2022
1 parent 06a209c commit 6273027
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions backend/api/admin/adminController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion backend/api/admin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 6273027

Please sign in to comment.