fix playerType

profile endpoint
This commit is contained in:
Akito123321 2024-06-17 22:19:34 +02:00
parent 5b64559933
commit e71454f3d4

View File

@ -563,7 +563,7 @@ public class GroupRestAPI {
return ResponseEntity.ok(group); 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<Group> editProfile(@PathVariable String id, @PathVariable String stratId, @PathVariable String playerTypeId, @PathVariable String profileId, @RequestBody ProfileRequest newProfile) { public ResponseEntity<Group> editProfile(@PathVariable String id, @PathVariable String stratId, @PathVariable String playerTypeId, @PathVariable String profileId, @RequestBody ProfileRequest newProfile) {
StratsUser user = getUser(); StratsUser user = getUser();
@ -582,13 +582,8 @@ public class GroupRestAPI {
return ResponseEntity.badRequest().build(); return ResponseEntity.badRequest().build();
} }
profile.setName(newProfile.name()); removeProfile(id, stratId, playerTypeId, profileId);
profile.setImage(newProfile.image()); addProfile(id, stratId, playerTypeId, newProfile);
profileService.saveProfile(profile);
playerTypeService.savePlayerType(playerType);
stratService.saveStrat(strat);
groupService.saveGroup(group);
return ResponseEntity.ok(group); return ResponseEntity.ok(group);
} }