modif smiley avec bdd

This commit is contained in:
cecilesimplon93 2022-03-06 15:48:43 +01:00
parent ce8c57b5ac
commit aaa3ba5333
2 changed files with 26 additions and 1 deletions

View File

@ -245,4 +245,20 @@ public class MembreController {
return ResponseEntity.status(HttpStatus.OK).body(resultMembre);
}
}
@PutMapping("/update/smiley/{idUser}")
public ResponseEntity<?> updateSmiley(@RequestBody String numero, @PathVariable int idUser) throws Exception {
Optional <Membre> resultMembre ;
try {
resultMembre = membreRepository.findById(idUser);
resultMembre.get().setSmiley(numero);
membreRepository.saveAndFlush(resultMembre.get());
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(e.getMessage());
}
return ResponseEntity.status(HttpStatus.OK).body(resultMembre);
}
}

View File

@ -143,6 +143,15 @@ public class Membre {
return roleList;
}
public String getSmiley() {
return smiley;
}
public void setSmiley(String smiley) {
this.smiley = smiley;
}
public void setRoleList(List<Role> roleList) {
this.roleList = roleList;
}