Add API Groups endpoints
Add the API endpoint for groups to get ALL groups.
https://foodsharing.de/api/doc/
Currently, it only includes:
/api/groups/{groupId}
/api/groups/{groupId}/conference
/api/groups/{groupId}/members/{memberId}
/api/groups/{groupId}/members/{memberId}
Endpoint:
-
/api/groups/
– to get all groups -
/api/user/current/groups
– to get all current signup groups
The backend generates the data like that:
foreach ($groups as $group) {
$groupId = $group['id'];
$groupType = $group['type'];
$group = array_merge($group, [
'mayHandleFoodsaverRegionMenu' => $this->regionPermissions->mayHandleFoodsaverRegionMenu($groupId),
'hasConference' => $this->regionPermissions->hasConference($groupType)
]);
if (Type::isRegion($groupType)) {
$group['isAdmin'] = $this->session->isAdminFor($groupId);
$group['mayAccessReportGroupReports'] = $this->reportPermissions->mayAccessReportGroupReports($groupId);
$group['mayAccessArbitrationGroupReports'] = $this->reportPermissions->mayAccessArbitrationReports($groupId);
$group['maySetRegionOptions'] = $this->regionPermissions->maySetRegionOptions($groupId);
$group['maySetRegionPin'] = $this->regionPermissions->maySetRegionPin($groupId);
$regions[] = $group;
} else {
$group['isAdmin'] = $this->workGroupPermissions->mayEdit($group);
$workingGroups[] = $group;
}
}
Required data and current use
Each Group
-
id
—number - navigation/dashboard -
name
—string - navigation/dashboard -
hasConference
—boolean - navigation -
permissions
—object - navigation
Permissions (maybe a unified name)
-
isAdmin
—boolean - navigation
If the backend has additional information, it would be cool to indicate them.
Edited by MS