1

Impletended the updategroup(status) method in the API

This commit is contained in:
LukasEttel
2020-03-12 16:11:32 +01:00
parent 3fcf8105f7
commit 9795c10c14
7 changed files with 46 additions and 27 deletions

View File

@ -1,13 +1,17 @@
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.EventService;
import mops.gruppen2.service.GroupService;
import mops.gruppen2.service.SerializationService;
@ -35,9 +39,11 @@ public class APIController {
@GetMapping("/updatedGroups/{status}")
@ApiOperation(value = "Gibt alle Gruppen zurück in denen sich etwas geändert hat")
public List<Group> updateGroup(@ApiParam("Status des Anfragestellers") @PathVariable Long status) throws EventException {
public UpdatedGroupRequestMapper updateGroup(@ApiParam("Status des Anfragestellers") @PathVariable Long status) throws EventException, JsonProcessingException {
List<Event> events = eventService.getNewEvents(status);
return groupService.projectEventList(events);
UpdatedGroupRequestMapper updatedGroupRequestMapper = APIFormatter.wrapp(eventService.getMaxEvent_id(), groupService.projectEventList(events));
return updatedGroupRequestMapper;
}