1

Impletended SwaggerApi with all provisionally funktiontionallitys

This commit is contained in:
LukasEttel
2020-03-13 13:50:49 +01:00
parent 1754486625
commit d1f296129d
4 changed files with 30 additions and 31 deletions

View File

@ -1,23 +1,18 @@
package mops.gruppen2.controller;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.javafaker.Faker;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import mops.gruppen2.domain.Exceptions.EventException;
import mops.gruppen2.domain.Group;
import mops.gruppen2.domain.ProductSwaggerExample;
import mops.gruppen2.domain.apiWrapper.UpdatedGroupRequestMapper;
import mops.gruppen2.domain.event.Event;
import mops.gruppen2.service.APIFormatter;
import mops.gruppen2.service.APIFormatterService;
import mops.gruppen2.service.EventService;
import mops.gruppen2.service.GroupService;
import mops.gruppen2.service.SerializationService;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -37,22 +32,27 @@ public class APIController {
this.groupService = groupService;
}
@GetMapping("/updatedGroups/{status}")
@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 {
List<Event> events = eventService.getNewEvents(status);
UpdatedGroupRequestMapper updatedGroupRequestMapper = APIFormatter.wrapp(eventService.getMaxEvent_id(), groupService.projectEventList(events));
UpdatedGroupRequestMapper updatedGroupRequestMapper = APIFormatterService.wrapp(eventService.getMaxEvent_id(), groupService.projectEventList(events));
return updatedGroupRequestMapper;
}
@GetMapping("/getGroups/{teilnehme}")
@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 userId) throws EventException {
List<Long> asd = new ArrayList<>();
return asd;
public List<Long> getGroupsOfUser(@ApiParam("Der Teilnehmer") @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{
List<Event> eventList = eventService.getEventsOfGroup(groupId);
List<Group> groups = groupService.projectEventList(eventList);
return groups.get(0);
}
}