quick refactor
This commit is contained in:
@ -32,7 +32,7 @@ public class Gruppen2Application {
|
||||
public Docket productAPI() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.select()
|
||||
.paths(PathSelectors.ant("/gruppen2/**"))
|
||||
.paths(PathSelectors.ant("/gruppen2/api/**"))
|
||||
.apis(RequestHandlerSelectors.basePackage("mops.gruppen2"))
|
||||
.build()
|
||||
.apiInfo(apiMetadata());
|
||||
|
||||
@ -19,7 +19,7 @@ import java.util.List;
|
||||
* Ein Beispiel für eine API mit Swagger.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/gruppen2")
|
||||
@RequestMapping("/gruppen2/api")
|
||||
public class APIController {
|
||||
|
||||
private final SerializationService serializationService;
|
||||
@ -34,7 +34,7 @@ public class APIController {
|
||||
|
||||
@GetMapping("/updateGroups/{status}")
|
||||
@ApiOperation(value = "Gibt alle Gruppen zurück in denen sich etwas geändert hat")
|
||||
public UpdatedGroupRequestMapper updateGroup(@ApiParam("Status des Anfragestellers") @PathVariable Long status) throws EventException {
|
||||
public UpdatedGroupRequestMapper updateGroup(@ApiParam("Letzter Status des Anfragestellers") @PathVariable Long status) throws EventException {
|
||||
List<Event> events = eventService.getNewEvents(status);
|
||||
UpdatedGroupRequestMapper updatedGroupRequestMapper = APIFormatterService.wrapp(eventService.getMaxEvent_id(), groupService.projectEventList(events));
|
||||
|
||||
@ -43,13 +43,13 @@ public class APIController {
|
||||
|
||||
@GetMapping("/getGroupIdsOfUser/{teilnehmer}")
|
||||
@ApiOperation(value = "Gibt alle Gruppen zurück in denen sich ein Teilnehmer befindet")
|
||||
public List<Long> getGroupsOfUser(@ApiParam("Der Teilnehmer") @PathVariable String teilnehmer) throws EventException {
|
||||
public List<Long> getGroupsOfUser(@ApiParam("Teilnehmer dessen groupIds zurückgegeben werden sollen") @PathVariable String teilnehmer) throws EventException {
|
||||
return eventService.getGroupsOfUser(teilnehmer);
|
||||
}
|
||||
|
||||
@GetMapping("/getGroup/{groupId}")
|
||||
@ApiOperation(value = "Gibt alle die Gruppe mit der als Parameter mitgegebenden groupId zurück")
|
||||
public Group getGroupFromId(@ApiParam("Die GruppenId der gefordeten Gruppe") @PathVariable Long groupId) throws EventException{
|
||||
@ApiOperation(value = "Gibt die Gruppe mit der als Parameter mitgegebenden groupId zurück")
|
||||
public Group getGroupFromId(@ApiParam("GruppenId der gefordeten Gruppe") @PathVariable Long groupId) throws EventException{
|
||||
List<Event> eventList = eventService.getEventsOfGroup(groupId);
|
||||
|
||||
List<Group> groups = groupService.projectEventList(eventList);
|
||||
|
||||
@ -17,7 +17,7 @@ public class Group extends Aggregate {
|
||||
private String title;
|
||||
private String description;
|
||||
private final List<User> members;
|
||||
private final Map<User, Role> roles;
|
||||
private final Map<String, Role> roles;
|
||||
|
||||
private GroupType type;
|
||||
private Visibility visibility;
|
||||
@ -51,7 +51,7 @@ public class Group extends Aggregate {
|
||||
if (roles.containsKey(user) && event.getNewRole() == Role.MEMBER) {
|
||||
roles.remove(user);
|
||||
} else {
|
||||
roles.put(user, event.getNewRole());
|
||||
roles.put(user.getUser_id(), event.getNewRole());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ class GroupTest {
|
||||
|
||||
// Assert
|
||||
assertThat(group.getRoles())
|
||||
.containsOnlyKeys(group.getMembers().get(0))
|
||||
.containsOnlyKeys(group.getMembers().get(0).getUser_id())
|
||||
.containsValue(Role.ADMIN);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user