atteindre Preferences dans Personne
This commit is contained in:
parent
820aabcaa1
commit
656899ea4c
5 changed files with 9 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue