Skip to content

Commit 2ff2fd7

Browse files
move oldId check to joi validation
1 parent 19f0763 commit 2ff2fd7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/services/GroupService.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,6 @@ updateGroup.schema = {
308308
* @returns {Object} the updated group
309309
*/
310310
async function patchGroup(currentUser, groupId, data) {
311-
if (!data.oldId) {
312-
throw new errors.BadRequestError('Can not Patch without oldId')
313-
}
314311
const session = helper.createDBSession()
315312
const tx = session.beginTransaction()
316313
try {
@@ -357,9 +354,9 @@ async function patchGroup(currentUser, groupId, data) {
357354
patchGroup.schema = {
358355
currentUser: Joi.any(),
359356
groupId: Joi.string(), // defined in app-bootstrap
360-
data: Joi.object()
357+
data: Joi.object().required()
361358
.keys({
362-
oldId: Joi.string(),
359+
oldId: Joi.string().required(),
363360
})
364361
}
365362

0 commit comments

Comments
 (0)