Skip to content

Commit 15de2d4

Browse files
committed
fix return in map
1 parent ceef005 commit 15de2d4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/controller/registry-org.controller/registry-org.controller.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,14 @@ async function createUserByOrg (req, res, next) {
417417
return res.status(400).json(error.userExists(username))
418418
}
419419

420+
const bodyKeys = Object.keys(body).map(k => k.toLowerCase())
421+
if (bodyKeys.includes('uuid')) {
422+
return res.status(400).json(error.uuidProvided('user'))
423+
}
424+
420425
// Creating a new user under specific org
421426
const newUser = new RegistryUser()
422-
Object.keys(body).map(k => k.toLowerCase()).forEach(k => {
427+
bodyKeys.forEach(k => {
423428
if (k === 'user_id' || k === 'username') {
424429
newUser.user_id = body[k]
425430
} else if (k === 'name') {
@@ -463,8 +468,6 @@ async function createUserByOrg (req, res, next) {
463468
...rest
464469
}
465470
})
466-
} else if (k === 'uuid') {
467-
return res.status(400).json(error.uuidProvided('user'))
468471
}
469472
})
470473

0 commit comments

Comments
 (0)