Skip to content
Snippets Groups Projects
Verified Commit b87beca7 authored by Damien's avatar Damien
Browse files

FEAT Group Reassign users route

parent 189548f4
No related branches found
No related tags found
No related merge requests found
...@@ -146,16 +146,16 @@ class GroupController ...@@ -146,16 +146,16 @@ class GroupController
return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']); return $response->withStatus(403)->withJson(['errors' => 'Service forbidden']);
} }
$group = GroupModel::getById(['id' => $aArgs['id']]); $group = GroupModel::getById(['id' => $aArgs['id'], 'select' => ['group_id']]);
if (empty($group)) { if (empty($group)) {
return $response->withStatus(400)->withJson(['errors' => 'Group not found']); return $response->withStatus(400)->withJson(['errors' => 'Group not found']);
} }
$newGroup = GroupModel::getByGroupId(['id' => $aArgs['newGroupId']]); $newGroup = GroupModel::getById(['id' => $aArgs['newGroupId'], 'select' => ['group_id']]);
if (empty($newGroup)) { if (empty($newGroup)) {
return $response->withStatus(400)->withJson(['errors' => 'Group not found']); return $response->withStatus(400)->withJson(['errors' => 'Group not found']);
} }
GroupModel::reassignUsers(['groupId' => $group['group_id'], 'newGroupId' => $aArgs['newGroupId']]); GroupModel::reassignUsers(['groupId' => $group['group_id'], 'newGroupId' => $newGroup['group_id']]);
return $response->withJson(['success' => 'success']); return $response->withJson(['success' => 'success']);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment