diff --git a/src/main/java/me/akito123321/valoStrats/rest/controller/GroupRestAPI.java b/src/main/java/me/akito123321/valoStrats/rest/controller/GroupRestAPI.java index 522f46f..8808d38 100644 --- a/src/main/java/me/akito123321/valoStrats/rest/controller/GroupRestAPI.java +++ b/src/main/java/me/akito123321/valoStrats/rest/controller/GroupRestAPI.java @@ -563,7 +563,7 @@ public class GroupRestAPI { return ResponseEntity.ok(group); } - @PutMapping("/{id}/strat/{stratId}/player-type/{playerTypeId}profile/{profileId}") //TODO remove privius from playerType and create new and add to group if not existend in group + @PutMapping("/{id}/strat/{stratId}/player-type/{playerTypeId}profile/{profileId}") public ResponseEntity editProfile(@PathVariable String id, @PathVariable String stratId, @PathVariable String playerTypeId, @PathVariable String profileId, @RequestBody ProfileRequest newProfile) { StratsUser user = getUser(); @@ -582,13 +582,8 @@ public class GroupRestAPI { return ResponseEntity.badRequest().build(); } - profile.setName(newProfile.name()); - profile.setImage(newProfile.image()); - - profileService.saveProfile(profile); - playerTypeService.savePlayerType(playerType); - stratService.saveStrat(strat); - groupService.saveGroup(group); + removeProfile(id, stratId, playerTypeId, profileId); + addProfile(id, stratId, playerTypeId, newProfile); return ResponseEntity.ok(group); }