atteindre Preferences dans Personne
This commit is contained in:
parent
820aabcaa1
commit
656899ea4c
@ -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;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ insert into personne (nom, prenom, email, password) values ('Rinquin', 'Aline',
|
||||
insert into personne (nom, prenom, email, password) values ('Keddar', 'Noreddine', 'noredinne.keddar@gmail.com', 'ACdXxMr');
|
||||
insert into personne (nom, prenom, email, password) values ('Tomczyk', 'Julian', 'julian.tomczyk@gmail.com', 'pjKxIN');
|
||||
insert into personne (nom, prenom, email, password) values ('MJID', 'Hedi', 'hedi.mjid@gmail.com', 'YY0TuY6JH0di');
|
||||
insert into personne (nom, prenom, email, password) values ('BIDEN', 'Joe', 'joe@biden.fr', '$2a$10$NNfAnATNZf/MzIjrUFi5K.xqWizxv1Hil4/PyRAabKWK5DxsLPE6.');
|
||||
|
||||
insert into role (id_role, intitule) values (1, 'Admin');
|
||||
insert into role (id_role, intitule) values (2, 'User');
|
||||
@ -75,6 +76,8 @@ insert into preference (restau_id_restau, personne_id_personne, note, favori) va
|
||||
insert into preference (restau_id_restau, personne_id_personne, note, favori) values (3, 3, 4, true);
|
||||
insert into preference (restau_id_restau, personne_id_personne, note, favori) values (2, 3, 3, false);
|
||||
insert into preference (restau_id_restau, personne_id_personne, note, favori) values (2, 8, 3, false);
|
||||
insert into preference (restau_id_restau, personne_id_personne, note, favori) values (5, 15, 3, false);
|
||||
insert into preference (restau_id_restau, personne_id_personne, note, favori) values (8, 15, 3, false);
|
||||
|
||||
insert into type (id_type, libelle) values (1, 'Kebab');
|
||||
insert into type (id_type, libelle) values (2, 'Supermarché');
|
||||
|
Loading…
Reference in New Issue
Block a user