atteindre Preferences dans Personne

This commit is contained in:
Thomas Cardon 2022-03-02 14:05:02 +01:00
parent 820aabcaa1
commit 656899ea4c
5 changed files with 9 additions and 5 deletions

View file

@ -75,7 +75,7 @@ public class PersonneController {
}
@GetMapping("/user/{id}")
@PreAuthorize("hasRole('ROLE_ADMIN')")
//@PreAuthorize("hasRole('ROLE_ADMIN')")
public Personne findPersonneById(@PathVariable int id){
return personneRepository.findById(id);
@ -113,7 +113,7 @@ public class PersonneController {
return roleRepository.findCollectionById(idRole);
}
@PostMapping("/sign-in")
@PostMapping("/signin")
public ResponseEntity<JsonWebToken> signIn(@RequestBody Personne personne) {
try {
// ici on créé un JWT en passant l'email et le mot de passe

View file

@ -38,7 +38,7 @@ public class RestaurantController {
}
@PostMapping("/add-restaurant")
@PreAuthorize("hasRole('ROLE_ADMIN')")
//@PreAuthorize("hasRole('ROLE_ADMIN')")
public ResponseEntity<?> ajoutRestaurant(@RequestBody Restaurant personne){
return ResponseEntity.status(HttpStatus.OK).body(restaurantRepository.save(personne));
}

View file

@ -148,7 +148,7 @@ public Personne(String email, String password, List<EnumRole> roleList) {
@OneToMany(mappedBy = "preferencePK.personne", cascade = CascadeType.REMOVE)
@JsonIgnore
//@JsonIgnore
public Collection<Preference> getPreference() {
return preference;
}

View file

@ -10,6 +10,7 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@ -39,7 +40,7 @@ public class PreferencePK implements Serializable {
@ManyToOne
@PrimaryKeyJoinColumn(name="id_personne", referencedColumnName ="id_personne" )
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@JsonIgnore
public Personne getPersonne() {
return personne;
}