diff --git a/.gitignore b/.gitignore index 8dc0cdd..1acaf36 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,6 @@ build/ !**/src/main/**/build/ !**/src/test/**/build/ -/src/main/resources/application.properties - ### STS ### .apt_generated .classpath @@ -37,3 +35,5 @@ out/ ### VS Code ### .vscode/ + +application.properties diff --git a/settings.gradle b/settings.gradle index e76d701..c74741c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -rootProject.name = 'simpleat-back' +rootProject.name = 'simpleat' diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/SimpleatApplication.java b/src/main/java/fr/cardon/simpleat/SimpleatApplication.java similarity index 67% rename from src/main/java/fr/vincentRamiere/simpleatBack/SimpleatApplication.java rename to src/main/java/fr/cardon/simpleat/SimpleatApplication.java index 85feeda..37dea51 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/SimpleatApplication.java +++ b/src/main/java/fr/cardon/simpleat/SimpleatApplication.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack; +package fr.cardon.simpleat; import java.util.ArrayList; import java.util.Arrays; @@ -8,10 +8,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; -import fr.vincentRamiere.simpleatBack.exception.ExistingUsernameException; -import fr.vincentRamiere.simpleatBack.model.EnumRole; -import fr.vincentRamiere.simpleatBack.model.Personne; -import fr.vincentRamiere.simpleatBack.service.PersonneService; +import fr.cardon.simpleat.exception.ExistingUsernameException; +import fr.cardon.simpleat.model.EnumRole; +import fr.cardon.simpleat.model.Personne; +import fr.cardon.simpleat.service.PersonneService; @SpringBootApplication public class SimpleatApplication { diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/controller/PersonneController.java b/src/main/java/fr/cardon/simpleat/controller/PersonneController.java similarity index 65% rename from src/main/java/fr/vincentRamiere/simpleatBack/controller/PersonneController.java rename to src/main/java/fr/cardon/simpleat/controller/PersonneController.java index 48dfc88..7a27fd8 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/controller/PersonneController.java +++ b/src/main/java/fr/cardon/simpleat/controller/PersonneController.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.controller; +package fr.cardon.simpleat.controller; import java.util.Collection; @@ -17,21 +17,26 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; -import fr.vincentRamiere.simpleatBack.dto.JsonWebToken; -import fr.vincentRamiere.simpleatBack.exception.ExistingUsernameException; -import fr.vincentRamiere.simpleatBack.exception.InvalidCredentialsException; -import fr.vincentRamiere.simpleatBack.model.Personne; -import fr.vincentRamiere.simpleatBack.repository.PersonneRepository; -import fr.vincentRamiere.simpleatBack.service.PersonneService; +import fr.cardon.simpleat.dto.JsonWebToken; +import fr.cardon.simpleat.exception.ExistingUsernameException; +import fr.cardon.simpleat.exception.InvalidCredentialsException; +import fr.cardon.simpleat.model.Personne; +import fr.cardon.simpleat.model.Role; +import fr.cardon.simpleat.repository.PersonneRepository; +import fr.cardon.simpleat.repository.RoleRepository; +import fr.cardon.simpleat.service.PersonneService; @RestController -@CrossOrigin("http://localhost:4200") +@CrossOrigin("*") public class PersonneController { @Autowired private PersonneRepository personneRepository; + @Autowired + private RoleRepository roleRepository; + @Autowired private PersonneService personneService; @@ -46,6 +51,7 @@ public class PersonneController { p1.setPrenom("pouet"); p1.setEmail("pouetcoco@gmail.com"); p1.setPassword("hjfdzov"); + p1.setRoles(findRoleById(2)); //ajoutPersonne(p1); @@ -62,28 +68,27 @@ public class PersonneController { @GetMapping("/users") - @PreAuthorize("hasRole('ROLE_ADMIN')") + //@PreAuthorize("hasRole('ROLE_ADMIN')") public Collection findAll(){ return personneRepository.findAll(); } @GetMapping("/user/{id}") - @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_READER')") + //@PreAuthorize("hasRole('ROLE_ADMIN')") public Personne findPersonneById(@PathVariable int id){ return personneRepository.findById(id); } -// @PostMapping("/add-user") -// @PreAuthorize("hasRole('ROLE_ADMIN')") -// public ResponseEntity ajoutPersonne(@RequestBody Personne personne){ -// return ResponseEntity.status(HttpStatus.OK).body(personneRepository.save(personne)); -// } + @PostMapping("/add-user") + //@PreAuthorize("hasRole('ROLE_ADMIN')") + public ResponseEntity ajoutPersonne(@RequestBody Personne personne){ + return ResponseEntity.status(HttpStatus.OK).body(personneRepository.save(personne)); + } @PutMapping(value = "/update-user/{id}") - @PreAuthorize("hasRole('ROLE_ADMIN')") public ResponseEntity modifPerso(@PathVariable int id, @RequestBody Personne personne){ // Personne persoAModif= null; @@ -96,7 +101,6 @@ public class PersonneController { } @DeleteMapping(value = "/delete-user/{id}") - @PreAuthorize("hasRole('ROLE_ADMIN')") public void suppressionPerso(@PathVariable int id){ // Personne persoASuppr= new Personne(); // persoASuppr = findById(id); @@ -105,20 +109,23 @@ public class PersonneController { } + public Collection findRoleById(int idRole){ + return roleRepository.findCollectionById(idRole); + } + @PostMapping("/signin") - public ResponseEntity signIn(@RequestBody Personne personne) { - try { - // ici on créé un JWT en passant l'email et le mot de passe - // récupéré de l'objet user passé en paramètre. - return ResponseEntity.ok(new JsonWebToken(personneService.signin(personne.getEmail(), personne.getPassword()))); - } catch (InvalidCredentialsException ex) { - // on renvoie une réponse négative - return ResponseEntity.badRequest().build(); - } - } + public ResponseEntity signIn(@RequestBody Personne personne) { + try { + // ici on créé un JWT en passant l'email et le mot de passe + // récupéré de l'objet user passé en paramètre. + return ResponseEntity.ok(new JsonWebToken(personneService.signin(personne.getEmail(), personne.getPassword()))); + } catch (InvalidCredentialsException ex) { + // on renvoie une réponse négative + return ResponseEntity.badRequest().build(); + } + } - @PostMapping("/signup") - @PreAuthorize("hasRole('ROLE_ADMIN')") + @PostMapping("/sign-up") public ResponseEntity signUp(@RequestBody Personne personne) { try { return ResponseEntity.ok(new JsonWebToken(personneService.signup(personne))); diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/controller/PreferenceController.java b/src/main/java/fr/cardon/simpleat/controller/PreferenceController.java similarity index 60% rename from src/main/java/fr/vincentRamiere/simpleatBack/controller/PreferenceController.java rename to src/main/java/fr/cardon/simpleat/controller/PreferenceController.java index fe04600..b77e8a9 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/controller/PreferenceController.java +++ b/src/main/java/fr/cardon/simpleat/controller/PreferenceController.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.controller; +package fr.cardon.simpleat.controller; import java.util.Collection; import java.util.Optional; @@ -6,20 +6,20 @@ import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; -import fr.vincentRamiere.simpleatBack.model.Preference; -import fr.vincentRamiere.simpleatBack.model.PreferencePK; -import fr.vincentRamiere.simpleatBack.repository.PersonneRepository; -import fr.vincentRamiere.simpleatBack.repository.PreferenceRepository; -import fr.vincentRamiere.simpleatBack.repository.RestaurantRepository; +import fr.cardon.simpleat.model.Preference; +import fr.cardon.simpleat.model.PreferencePK; +import fr.cardon.simpleat.repository.PersonneRepository; +import fr.cardon.simpleat.repository.PreferenceRepository; +import fr.cardon.simpleat.repository.RestaurantRepository; @RestController @CrossOrigin("*") @@ -36,7 +36,6 @@ public class PreferenceController { private RestaurantRepository restaurantRepository; @GetMapping("/preferences") - @PreAuthorize("hasRole('ROLE_ADMIN')") public Collection findAll(){ return preferenceRepository.findAll(); @@ -44,7 +43,6 @@ public class PreferenceController { @GetMapping("/preference/{iduser}/{idrestau}") - @PreAuthorize("hasRole('ROLE_ADMIN')") public Optional findPreferenceById(@PathVariable int iduser, @PathVariable int idrestau ){ PreferencePK id = new PreferencePK(personneRepository.getById(iduser) ,restaurantRepository.getById(idrestau)); System.out.println(iduser); @@ -52,18 +50,8 @@ public class PreferenceController { } -// @PostMapping("/add-preference") -// public ResponseEntity ajoutPreference(@RequestBody Preference preference){ -// System.out.println(preference); -// return ResponseEntity.status(HttpStatus.OK).body(preferenceRepository.save(preference)); -// } - - @PostMapping("/add-preference/{iduser}/{idrestau}") - @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_READER')") - public ResponseEntity ajoutPreference(@PathVariable int iduser, @PathVariable int idrestau ){ - System.out.println("hello"); - Preference preference = new Preference(new PreferencePK(personneRepository.getById(iduser) ,restaurantRepository.getById(idrestau))); - + @PostMapping("/add-preference") + public ResponseEntity ajoutPreference(@RequestBody Preference preference){ return ResponseEntity.status(HttpStatus.OK).body(preferenceRepository.save(preference)); } @@ -73,10 +61,11 @@ public class PreferenceController { // return ResponseEntity.status(HttpStatus.OK).body(preferenceRepository.save(personne)); // } // - @DeleteMapping("/delete-preference/{iduser}/{idrestau}") - @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_READER')") + @DeleteMapping("/delete-preference/{idrestau}/{iduser}") public void deletePreferenceById(@PathVariable int iduser, @PathVariable int idrestau ){ PreferencePK id = new PreferencePK(personneRepository.getById(iduser) ,restaurantRepository.getById(idrestau)); preferenceRepository.deleteById(id); } + + } diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/controller/RestaurantController.java b/src/main/java/fr/cardon/simpleat/controller/RestaurantController.java similarity index 80% rename from src/main/java/fr/vincentRamiere/simpleatBack/controller/RestaurantController.java rename to src/main/java/fr/cardon/simpleat/controller/RestaurantController.java index bcf3928..6891144 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/controller/RestaurantController.java +++ b/src/main/java/fr/cardon/simpleat/controller/RestaurantController.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.controller; +package fr.cardon.simpleat.controller; import java.util.Collection; @@ -15,8 +15,8 @@ import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; -import fr.vincentRamiere.simpleatBack.model.Restaurant; -import fr.vincentRamiere.simpleatBack.repository.RestaurantRepository; +import fr.cardon.simpleat.model.Restaurant; +import fr.cardon.simpleat.repository.RestaurantRepository; @RestController @CrossOrigin("*") @@ -27,33 +27,30 @@ public class RestaurantController { private RestaurantRepository restaurantRepository; @GetMapping("/restaurants") - @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_READER')") public Collection findAll(){ return restaurantRepository.findAll(); } @GetMapping("/restaurant/{id}") - @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_READER')") public Restaurant findRestaurantById(@PathVariable int id){ return restaurantRepository.findById(id); } @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)); } @PutMapping(value = "/update-restaurant/{id}") - @PreAuthorize("hasRole('ROLE_ADMIN')") + public ResponseEntity modifRestaurant(@PathVariable int id, @RequestBody Restaurant personne){ return ResponseEntity.status(HttpStatus.OK).body(restaurantRepository.save(personne)); } @DeleteMapping(value = "/delete-restaurant/{id}") - @PreAuthorize("hasRole('ROLE_ADMIN')") public void suppressionRestaurant(@PathVariable int id){ restaurantRepository.deleteById(id); diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/controller/TypeRestauController.java b/src/main/java/fr/cardon/simpleat/controller/TypeRestauController.java similarity index 75% rename from src/main/java/fr/vincentRamiere/simpleatBack/controller/TypeRestauController.java rename to src/main/java/fr/cardon/simpleat/controller/TypeRestauController.java index f61e589..4aa388e 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/controller/TypeRestauController.java +++ b/src/main/java/fr/cardon/simpleat/controller/TypeRestauController.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.controller; +package fr.cardon.simpleat.controller; import java.util.Collection; @@ -7,7 +7,6 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -17,9 +16,9 @@ import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; -import fr.vincentRamiere.simpleatBack.model.Restaurant; -import fr.vincentRamiere.simpleatBack.model.TypeRestau; -import fr.vincentRamiere.simpleatBack.repository.TypeRestauRepository; +import fr.cardon.simpleat.model.Restaurant; +import fr.cardon.simpleat.model.TypeRestau; +import fr.cardon.simpleat.repository.TypeRestauRepository; @RestController @CrossOrigin("*") @@ -29,39 +28,33 @@ public class TypeRestauController { private TypeRestauRepository typeRestauRepository; @GetMapping("/types") - @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_READER')") public Collection findAll(){ return typeRestauRepository.findAll(); } @GetMapping("/type/{id}") - @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_READER')") public TypeRestau findTypetById(@PathVariable int id){ return typeRestauRepository.findById(id); } @GetMapping("/restaurantbytype/{id}") - @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_READER')") public List findRestauByType(@PathVariable int id){ return findTypetById(id).getRestaurants(); } @PostMapping("/add-type") - @PreAuthorize("hasRole('ROLE_ADMIN')") public ResponseEntity ajoutType(@RequestBody TypeRestau type){ return ResponseEntity.status(HttpStatus.OK).body(typeRestauRepository.save(type)); } @PutMapping(value = "/update-type/{id}") - @PreAuthorize("hasRole('ROLE_ADMIN')") public ResponseEntity modifType(@PathVariable int id, @RequestBody TypeRestau type){ return ResponseEntity.status(HttpStatus.OK).body(typeRestauRepository.save(type)); } @DeleteMapping(value = "/delete-type/{id}") - @PreAuthorize("hasRole('ROLE_ADMIN')") public void suppressionType(@PathVariable int id){ typeRestauRepository.deleteById(id); diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/dto/JsonWebToken.java b/src/main/java/fr/cardon/simpleat/dto/JsonWebToken.java similarity index 87% rename from src/main/java/fr/vincentRamiere/simpleatBack/dto/JsonWebToken.java rename to src/main/java/fr/cardon/simpleat/dto/JsonWebToken.java index 1620f16..021837a 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/dto/JsonWebToken.java +++ b/src/main/java/fr/cardon/simpleat/dto/JsonWebToken.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.dto; +package fr.cardon.simpleat.dto; /** * Classe spécifique DTO (Data Transfer Object) qui retourne un Jeton au format JSON (REST response) diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/dto/PersonneDto.java b/src/main/java/fr/cardon/simpleat/dto/PersonneDto.java similarity index 50% rename from src/main/java/fr/vincentRamiere/simpleatBack/dto/PersonneDto.java rename to src/main/java/fr/cardon/simpleat/dto/PersonneDto.java index f451985..c078b59 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/dto/PersonneDto.java +++ b/src/main/java/fr/cardon/simpleat/dto/PersonneDto.java @@ -1,10 +1,11 @@ -package fr.vincentRamiere.simpleatBack.dto; +package fr.cardon.simpleat.dto; import java.util.List; import com.sun.istack.NotNull; +import fr.cardon.simpleat.model.Role; /** * Specifique : AppUser DTO permet de renvoyer un User sans le mot de passe (REST response). @@ -13,9 +14,18 @@ public class PersonneDto { private Long id; private String email; + private List roleList; public PersonneDto() { } + public PersonneDto(@NotNull String email) { + this(email,null); + } + + public PersonneDto(@NotNull String email, List roleList) { + this.email = email; + this.roleList = roleList; + } public Long getId() { return id; @@ -33,4 +43,13 @@ public class PersonneDto { this.email = email; } + public List getRoleList() { + return roleList; + } + + public void setRoleList(List roleList) { + this.roleList = roleList; + } + + } diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/exception/ExistingUsernameException.java b/src/main/java/fr/cardon/simpleat/exception/ExistingUsernameException.java similarity index 87% rename from src/main/java/fr/vincentRamiere/simpleatBack/exception/ExistingUsernameException.java rename to src/main/java/fr/cardon/simpleat/exception/ExistingUsernameException.java index 874263e..4ca7c65 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/exception/ExistingUsernameException.java +++ b/src/main/java/fr/cardon/simpleat/exception/ExistingUsernameException.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.exception; +package fr.cardon.simpleat.exception; /** * Classe personnalisée pour gérer un message si l'utilisateur (User) existe en Base de données diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/exception/InvalidCredentialsException.java b/src/main/java/fr/cardon/simpleat/exception/InvalidCredentialsException.java similarity index 86% rename from src/main/java/fr/vincentRamiere/simpleatBack/exception/InvalidCredentialsException.java rename to src/main/java/fr/cardon/simpleat/exception/InvalidCredentialsException.java index a1050e8..82cf0cc 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/exception/InvalidCredentialsException.java +++ b/src/main/java/fr/cardon/simpleat/exception/InvalidCredentialsException.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.exception; +package fr.cardon.simpleat.exception; /** * Specific exception that should be thrown when user credentials are not valid. diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/exception/InvalidJWTException.java b/src/main/java/fr/cardon/simpleat/exception/InvalidJWTException.java similarity index 85% rename from src/main/java/fr/vincentRamiere/simpleatBack/exception/InvalidJWTException.java rename to src/main/java/fr/cardon/simpleat/exception/InvalidJWTException.java index 0432b20..82036fc 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/exception/InvalidJWTException.java +++ b/src/main/java/fr/cardon/simpleat/exception/InvalidJWTException.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.exception; +package fr.cardon.simpleat.exception; /** * Specific exception that should be thrown when a JWT has an invalid format. diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/model/EnumRole.java b/src/main/java/fr/cardon/simpleat/model/EnumRole.java similarity index 71% rename from src/main/java/fr/vincentRamiere/simpleatBack/model/EnumRole.java rename to src/main/java/fr/cardon/simpleat/model/EnumRole.java index 57a1256..29efe61 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/model/EnumRole.java +++ b/src/main/java/fr/cardon/simpleat/model/EnumRole.java @@ -1,10 +1,10 @@ -package fr.vincentRamiere.simpleatBack.model; +package fr.cardon.simpleat.model; import org.springframework.security.core.GrantedAuthority; public enum EnumRole implements GrantedAuthority { - ROLE_ADMIN, ROLE_READER; + ROLE_ADMIN, ROLE_CREATOR, ROLE_READER; @Override public String getAuthority() { diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/model/Personne.java b/src/main/java/fr/cardon/simpleat/model/Personne.java similarity index 77% rename from src/main/java/fr/vincentRamiere/simpleatBack/model/Personne.java rename to src/main/java/fr/cardon/simpleat/model/Personne.java index d0b435a..3296515 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/model/Personne.java +++ b/src/main/java/fr/cardon/simpleat/model/Personne.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.model; +package fr.cardon.simpleat.model; import java.util.ArrayList; @@ -33,6 +33,7 @@ public class Personne { private String prenom; private String email; private String password; + private Collection roles = new ArrayList(); private Collection preference = new ArrayList(); private List roleList; @@ -76,6 +77,19 @@ public Personne(String email, String password, List roleList) { } + public Personne(String nom, String prenom, String email, String password, + Collection roles, Collection preference, + List roleList) { + super(); + this.nom = nom; + this.prenom = prenom; + this.email = email; + this.password = password; + this.roles = roles; + this.preference = preference; + this.roleList = roleList; + } + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @@ -118,6 +132,19 @@ public Personne(String email, String password, List roleList) { public void setPassword(String password) { this.password = password; } + + @ManyToMany + @JoinTable(name="role_personne", + joinColumns = @JoinColumn(name = "id_perso"/*nom créé dans table asso*/,referencedColumnName = "id_personne" /*classe en cours*/) ) + @JsonIgnoreProperties("roles") + public Collection getRoles() { + return roles; + } + + + public void setRoles(Collection roles) { + this.roles = roles; + } @OneToMany(mappedBy = "preferencePK.personne", cascade = CascadeType.REMOVE) @@ -131,7 +158,6 @@ public Personne(String email, String password, List roleList) { this.preference = preference; } - @ElementCollection(fetch = FetchType.EAGER) @Enumerated(EnumType.STRING) public List getRoleList() { @@ -144,4 +170,9 @@ public Personne(String email, String password, List roleList) { } + + + + + } diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/model/Preference.java b/src/main/java/fr/cardon/simpleat/model/Preference.java similarity index 86% rename from src/main/java/fr/vincentRamiere/simpleatBack/model/Preference.java rename to src/main/java/fr/cardon/simpleat/model/Preference.java index 7903ae6..a1267c2 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/model/Preference.java +++ b/src/main/java/fr/cardon/simpleat/model/Preference.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.model; +package fr.cardon.simpleat.model; import javax.persistence.Column; import javax.persistence.EmbeddedId; @@ -19,13 +19,6 @@ public class Preference { } - - - public Preference(PreferencePK preferencePK) { - super(); - this.preferencePK = preferencePK; - } - public Preference(PreferencePK preferencePK, int note, boolean favoris) { super(); this.preferencePK = preferencePK; @@ -58,4 +51,4 @@ public class Preference { -} \ No newline at end of file +} diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/model/PreferencePK.java b/src/main/java/fr/cardon/simpleat/model/PreferencePK.java similarity index 90% rename from src/main/java/fr/vincentRamiere/simpleatBack/model/PreferencePK.java rename to src/main/java/fr/cardon/simpleat/model/PreferencePK.java index faf4f70..953ddb2 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/model/PreferencePK.java +++ b/src/main/java/fr/cardon/simpleat/model/PreferencePK.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.model; +package fr.cardon.simpleat.model; import java.io.Serializable; @@ -10,7 +10,6 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.PrimaryKeyJoinColumn; -import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -41,7 +40,7 @@ public class PreferencePK implements Serializable { @ManyToOne @PrimaryKeyJoinColumn(name="id_personne", referencedColumnName ="id_personne" ) - @JsonBackReference("personne") + @JsonIgnore public Personne getPersonne() { return personne; } @@ -66,4 +65,4 @@ public class PreferencePK implements Serializable { -} \ No newline at end of file +} diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/model/Reservation.java b/src/main/java/fr/cardon/simpleat/model/Reservation.java similarity index 94% rename from src/main/java/fr/vincentRamiere/simpleatBack/model/Reservation.java rename to src/main/java/fr/cardon/simpleat/model/Reservation.java index ea9fad6..ec3f048 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/model/Reservation.java +++ b/src/main/java/fr/cardon/simpleat/model/Reservation.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.model; +package fr.cardon.simpleat.model; import javax.persistence.Column; import javax.persistence.EmbeddedId; diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/model/ReservationPK.java b/src/main/java/fr/cardon/simpleat/model/ReservationPK.java similarity index 96% rename from src/main/java/fr/vincentRamiere/simpleatBack/model/ReservationPK.java rename to src/main/java/fr/cardon/simpleat/model/ReservationPK.java index 9d2daf0..d3dd845 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/model/ReservationPK.java +++ b/src/main/java/fr/cardon/simpleat/model/ReservationPK.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.model; +package fr.cardon.simpleat.model; import java.io.Serializable; import java.util.Date; diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/model/Restaurant.java b/src/main/java/fr/cardon/simpleat/model/Restaurant.java similarity index 94% rename from src/main/java/fr/vincentRamiere/simpleatBack/model/Restaurant.java rename to src/main/java/fr/cardon/simpleat/model/Restaurant.java index 502f90c..7f94abe 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/model/Restaurant.java +++ b/src/main/java/fr/cardon/simpleat/model/Restaurant.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.model; +package fr.cardon.simpleat.model; import java.util.ArrayList; import java.util.Collection; @@ -14,7 +14,9 @@ import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.OneToMany; +import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @Entity @@ -33,6 +35,8 @@ public class Restaurant { private String website; private Collection typerestaus = new ArrayList(); private Collection preference = new ArrayList(); + //TODO @OneToMany relier avec une collec de preferences + public Restaurant() { super(); // TODO Auto-generated constructor stub @@ -148,6 +152,7 @@ public class Restaurant { this.typerestaus = typerestaus; } + @OneToMany(mappedBy = "preferencePK.restau", cascade = CascadeType.REMOVE) @JsonIgnore public Collection getPreference() { @@ -158,4 +163,5 @@ public class Restaurant { public void setPreference(Collection preference) { this.preference = preference; } + } diff --git a/src/main/java/fr/cardon/simpleat/model/Role.java b/src/main/java/fr/cardon/simpleat/model/Role.java new file mode 100644 index 0000000..2d012ce --- /dev/null +++ b/src/main/java/fr/cardon/simpleat/model/Role.java @@ -0,0 +1,41 @@ +package fr.cardon.simpleat.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Role { + + private int id; + private String intitule; + + + public Role() { + super(); + // TODO Auto-generated constructor stub + } + + public Role(int id, String intitule) { + super(); + this.id = id; + this.intitule = intitule; + } + + @Id + @Column(name = "id_role") + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + @Column(nullable = false) + public String getIntitule() { + return intitule; + } + public void setIntitule(String intitule) { + this.intitule = intitule; + } + +} diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/model/TypeRestau.java b/src/main/java/fr/cardon/simpleat/model/TypeRestau.java similarity index 92% rename from src/main/java/fr/vincentRamiere/simpleatBack/model/TypeRestau.java rename to src/main/java/fr/cardon/simpleat/model/TypeRestau.java index 93ecee6..0d85160 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/model/TypeRestau.java +++ b/src/main/java/fr/cardon/simpleat/model/TypeRestau.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.model; +package fr.cardon.simpleat.model; import java.util.List; @@ -11,6 +11,7 @@ import javax.persistence.ManyToMany; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonBackReference; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @Entity diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/repository/PersonneRepository.java b/src/main/java/fr/cardon/simpleat/repository/PersonneRepository.java similarity index 77% rename from src/main/java/fr/vincentRamiere/simpleatBack/repository/PersonneRepository.java rename to src/main/java/fr/cardon/simpleat/repository/PersonneRepository.java index f84b076..0df6572 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/repository/PersonneRepository.java +++ b/src/main/java/fr/cardon/simpleat/repository/PersonneRepository.java @@ -1,11 +1,11 @@ -package fr.vincentRamiere.simpleatBack.repository; +package fr.cardon.simpleat.repository; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import fr.vincentRamiere.simpleatBack.model.Personne; +import fr.cardon.simpleat.model.Personne; @Repository public interface PersonneRepository extends JpaRepository { diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/repository/PreferenceRepository.java b/src/main/java/fr/cardon/simpleat/repository/PreferenceRepository.java similarity index 57% rename from src/main/java/fr/vincentRamiere/simpleatBack/repository/PreferenceRepository.java rename to src/main/java/fr/cardon/simpleat/repository/PreferenceRepository.java index 81700a8..d035e49 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/repository/PreferenceRepository.java +++ b/src/main/java/fr/cardon/simpleat/repository/PreferenceRepository.java @@ -1,10 +1,10 @@ -package fr.vincentRamiere.simpleatBack.repository; +package fr.cardon.simpleat.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import fr.vincentRamiere.simpleatBack.model.Preference; -import fr.vincentRamiere.simpleatBack.model.PreferencePK; +import fr.cardon.simpleat.model.Preference; +import fr.cardon.simpleat.model.PreferencePK; @Repository public interface PreferenceRepository extends JpaRepository { diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/repository/ReservationRepository.java b/src/main/java/fr/cardon/simpleat/repository/ReservationRepository.java similarity index 56% rename from src/main/java/fr/vincentRamiere/simpleatBack/repository/ReservationRepository.java rename to src/main/java/fr/cardon/simpleat/repository/ReservationRepository.java index 7896918..b52d836 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/repository/ReservationRepository.java +++ b/src/main/java/fr/cardon/simpleat/repository/ReservationRepository.java @@ -1,10 +1,10 @@ -package fr.vincentRamiere.simpleatBack.repository; +package fr.cardon.simpleat.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import fr.vincentRamiere.simpleatBack.model.Reservation; -import fr.vincentRamiere.simpleatBack.model.ReservationPK; +import fr.cardon.simpleat.model.Reservation; +import fr.cardon.simpleat.model.ReservationPK; @Repository public interface ReservationRepository extends JpaRepository { diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/repository/RestaurantRepository.java b/src/main/java/fr/cardon/simpleat/repository/RestaurantRepository.java similarity index 69% rename from src/main/java/fr/vincentRamiere/simpleatBack/repository/RestaurantRepository.java rename to src/main/java/fr/cardon/simpleat/repository/RestaurantRepository.java index 7fc50f9..7bd6041 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/repository/RestaurantRepository.java +++ b/src/main/java/fr/cardon/simpleat/repository/RestaurantRepository.java @@ -1,9 +1,9 @@ -package fr.vincentRamiere.simpleatBack.repository; +package fr.cardon.simpleat.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import fr.vincentRamiere.simpleatBack.model.Restaurant; +import fr.cardon.simpleat.model.Restaurant; @Repository public interface RestaurantRepository extends JpaRepository { diff --git a/src/main/java/fr/cardon/simpleat/repository/RoleRepository.java b/src/main/java/fr/cardon/simpleat/repository/RoleRepository.java new file mode 100644 index 0000000..6172577 --- /dev/null +++ b/src/main/java/fr/cardon/simpleat/repository/RoleRepository.java @@ -0,0 +1,16 @@ +package fr.cardon.simpleat.repository; + +import java.util.Collection; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import fr.cardon.simpleat.model.Role; + +@Repository +public interface RoleRepository extends JpaRepository { + + + Collection findCollectionById(int id); + +} diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/repository/TypeRestauRepository.java b/src/main/java/fr/cardon/simpleat/repository/TypeRestauRepository.java similarity index 69% rename from src/main/java/fr/vincentRamiere/simpleatBack/repository/TypeRestauRepository.java rename to src/main/java/fr/cardon/simpleat/repository/TypeRestauRepository.java index 08f8692..4eb0ce5 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/repository/TypeRestauRepository.java +++ b/src/main/java/fr/cardon/simpleat/repository/TypeRestauRepository.java @@ -1,9 +1,9 @@ -package fr.vincentRamiere.simpleatBack.repository; +package fr.cardon.simpleat.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import fr.vincentRamiere.simpleatBack.model.TypeRestau; +import fr.cardon.simpleat.model.TypeRestau; @Repository public interface TypeRestauRepository extends JpaRepository { diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/security/JwtTokenFilter.java b/src/main/java/fr/cardon/simpleat/security/JwtTokenFilter.java similarity index 93% rename from src/main/java/fr/vincentRamiere/simpleatBack/security/JwtTokenFilter.java rename to src/main/java/fr/cardon/simpleat/security/JwtTokenFilter.java index fdb0196..bd0e495 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/security/JwtTokenFilter.java +++ b/src/main/java/fr/cardon/simpleat/security/JwtTokenFilter.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.security; +package fr.cardon.simpleat.security; import java.io.IOException; @@ -12,7 +12,7 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.filter.OncePerRequestFilter; -import fr.vincentRamiere.simpleatBack.exception.InvalidJWTException; +import fr.cardon.simpleat.exception.InvalidJWTException; diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/security/JwtTokenProvider.java b/src/main/java/fr/cardon/simpleat/security/JwtTokenProvider.java similarity index 94% rename from src/main/java/fr/vincentRamiere/simpleatBack/security/JwtTokenProvider.java rename to src/main/java/fr/cardon/simpleat/security/JwtTokenProvider.java index 216d958..2e39ba4 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/security/JwtTokenProvider.java +++ b/src/main/java/fr/cardon/simpleat/security/JwtTokenProvider.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.security; +package fr.cardon.simpleat.security; import java.util.Base64; import java.util.Date; @@ -20,9 +20,8 @@ import org.springframework.stereotype.Component; import com.fasterxml.jackson.core.JsonProcessingException; -import fr.vincentRamiere.simpleatBack.exception.InvalidJWTException; -import fr.vincentRamiere.simpleatBack.model.EnumRole; -import fr.vincentRamiere.simpleatBack.repository.PersonneRepository; +import fr.cardon.simpleat.exception.InvalidJWTException; +import fr.cardon.simpleat.model.EnumRole; import io.jsonwebtoken.Claims; import io.jsonwebtoken.JwtException; import io.jsonwebtoken.Jwts; @@ -44,9 +43,6 @@ public class JwtTokenProvider { @Autowired private UserDetailsService userDetailsService; - - @Autowired - private PersonneRepository personneRepository; /** * Cette méthode d'initialisation s'exécute avant le constructeur @@ -108,7 +104,6 @@ public class JwtTokenProvider { public String createToken(String email, List roleList){ Claims claims = Jwts.claims().setSubject(email); - claims.put("userId", personneRepository.findByEmail(email).get().getId()); claims.put("auth", roleList.stream().map(s -> new SimpleGrantedAuthority(s.getAuthority())).filter(Objects::nonNull).collect(Collectors.toList())); System.out.println("claims = "+claims); diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/security/WebSecurityConfig.java b/src/main/java/fr/cardon/simpleat/security/WebSecurityConfig.java similarity index 98% rename from src/main/java/fr/vincentRamiere/simpleatBack/security/WebSecurityConfig.java rename to src/main/java/fr/cardon/simpleat/security/WebSecurityConfig.java index 764a4cf..07a43c4 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/security/WebSecurityConfig.java +++ b/src/main/java/fr/cardon/simpleat/security/WebSecurityConfig.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.security; +package fr.cardon.simpleat.security; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/service/PersonneService.java b/src/main/java/fr/cardon/simpleat/service/PersonneService.java similarity index 82% rename from src/main/java/fr/vincentRamiere/simpleatBack/service/PersonneService.java rename to src/main/java/fr/cardon/simpleat/service/PersonneService.java index 4418352..99a7a4f 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/service/PersonneService.java +++ b/src/main/java/fr/cardon/simpleat/service/PersonneService.java @@ -1,13 +1,13 @@ -package fr.vincentRamiere.simpleatBack.service; +package fr.cardon.simpleat.service; import java.util.List; import java.util.Optional; import org.springframework.stereotype.Service; -import fr.vincentRamiere.simpleatBack.exception.ExistingUsernameException; -import fr.vincentRamiere.simpleatBack.exception.InvalidCredentialsException; -import fr.vincentRamiere.simpleatBack.model.Personne; +import fr.cardon.simpleat.exception.ExistingUsernameException; +import fr.cardon.simpleat.exception.InvalidCredentialsException; +import fr.cardon.simpleat.model.Personne; diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/service/PersonneServiceImpl.java b/src/main/java/fr/cardon/simpleat/service/PersonneServiceImpl.java similarity index 86% rename from src/main/java/fr/vincentRamiere/simpleatBack/service/PersonneServiceImpl.java rename to src/main/java/fr/cardon/simpleat/service/PersonneServiceImpl.java index 75e87c0..8371fa5 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/service/PersonneServiceImpl.java +++ b/src/main/java/fr/cardon/simpleat/service/PersonneServiceImpl.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.service; +package fr.cardon.simpleat.service; import java.util.List; import java.util.Optional; @@ -11,11 +11,13 @@ import org.springframework.security.core.AuthenticationException; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; -import fr.vincentRamiere.simpleatBack.exception.ExistingUsernameException; -import fr.vincentRamiere.simpleatBack.exception.InvalidCredentialsException; -import fr.vincentRamiere.simpleatBack.model.Personne; -import fr.vincentRamiere.simpleatBack.repository.PersonneRepository; -import fr.vincentRamiere.simpleatBack.security.JwtTokenProvider; + + +import fr.cardon.simpleat.exception.ExistingUsernameException; +import fr.cardon.simpleat.exception.InvalidCredentialsException; +import fr.cardon.simpleat.model.Personne; +import fr.cardon.simpleat.repository.PersonneRepository; +import fr.cardon.simpleat.security.JwtTokenProvider; diff --git a/src/main/java/fr/vincentRamiere/simpleatBack/service/UserDetailsServiceImpl.java b/src/main/java/fr/cardon/simpleat/service/UserDetailsServiceImpl.java similarity index 88% rename from src/main/java/fr/vincentRamiere/simpleatBack/service/UserDetailsServiceImpl.java rename to src/main/java/fr/cardon/simpleat/service/UserDetailsServiceImpl.java index eedca94..25129e1 100644 --- a/src/main/java/fr/vincentRamiere/simpleatBack/service/UserDetailsServiceImpl.java +++ b/src/main/java/fr/cardon/simpleat/service/UserDetailsServiceImpl.java @@ -1,4 +1,4 @@ -package fr.vincentRamiere.simpleatBack.service; +package fr.cardon.simpleat.service; import java.util.Optional; @@ -10,8 +10,9 @@ import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; -import fr.vincentRamiere.simpleatBack.model.Personne; -import fr.vincentRamiere.simpleatBack.repository.PersonneRepository; +import fr.cardon.simpleat.model.Personne; + +import fr.cardon.simpleat.repository.PersonneRepository; @Service diff --git a/src/main/resources/PostmanV2 b/src/main/resources/Postman similarity index 85% rename from src/main/resources/PostmanV2 rename to src/main/resources/Postman index 8f1d50c..a222d5a 100644 --- a/src/main/resources/PostmanV2 +++ b/src/main/resources/Postman @@ -77,7 +77,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"nom\": \"Cardon\",\r\n \"prenom\": \"Thomas\",\r\n \"email\": \"thomas.cardon@gmail.com\",\r\n \"password\": \"SimplonTC\",\r\n \"roleList\": [\"ROLE_ADMIN\"]\r\n \r\n}", + "raw": "{\r\n \"nom\": \"nouvel\",\r\n \"prenom\": \"ajout\",\r\n \"email\": \"role@ajout.fr\",\r\n \"password\": \"root\",\r\n \"roles\": [\r\n {\r\n \"id\": 2\r\n }\r\n ]\r\n}", "options": { "raw": { "language": "json" @@ -145,60 +145,6 @@ } }, "response": [] - }, - { - "name": "Sign-up", - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"nom\": \"Cardon\",\r\n \"prenom\": \"Thomas\",\r\n \"email\": \"thomas.cardon@gmail.com\",\r\n \"password\": \"SimplonTC\",\r\n \"roleList\": [\"ROLE_ADMIN\"]\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "localhost:8080/sign-up", - "host": [ - "localhost" - ], - "port": "8080", - "path": [ - "sign-up" - ] - } - }, - "response": [] - }, - { - "name": "Sign-in", - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"email\": \"thomas.cardon@gmail.com\",\r\n \"password\": \"SimplonTC\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "localhost:8080/signin", - "host": [ - "localhost" - ], - "port": "8080", - "path": [ - "signin" - ] - } - }, - "response": [] } ] }, @@ -262,7 +208,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"preferencePK\":{\r\n \"personne\": {\r\n \"id\": 1\r\n },\r\n \"restau\": {\r\n \"id\": 1\r\n }},\r\n \"note\": 5,\r\n \"favoris\": true\r\n}", + "raw": "{\r\n \"personne\": {\r\n \"id\": 1\r\n },\r\n \"restau\": {\r\n \"id\": 5\r\n },\r\n \"note\": 5,\r\n \"favoris\": true\r\n}", "options": { "raw": { "language": "json" @@ -288,24 +234,24 @@ "method": "DELETE", "header": [], "url": { - "raw": "localhost:8080/delete-preference/:iduser/:idrestau", + "raw": "localhost:8080/delete-preference/:idrestau/:iduser", "host": [ "localhost" ], "port": "8080", "path": [ "delete-preference", - ":iduser", - ":idrestau" + ":idrestau", + ":iduser" ], "variable": [ { - "key": "iduser", - "value": "1" + "key": "idrestau", + "value": "3" }, { - "key": "idrestau", - "value": null + "key": "iduser", + "value": "1" } ] } @@ -392,14 +338,6 @@ }, "response": [] }, - { - "name": "New Request", - "request": { - "method": "GET", - "header": [] - }, - "response": [] - }, { "name": "AjoutRestaurant", "request": { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f08ad83..19011c0 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -6,9 +6,9 @@ spring.main.allow-circular-references=true # =============================== # base de données MySQL # =============================== -spring.datasource.url=jdbc:mysql://localhost:3306/simpleat?useSSL=false&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=CET +spring.datasource.url=jdbc:mysql://localhost:3308/simpleat?useSSL=false&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=CET spring.datasource.username=root -spring.datasource.password=bbLouis1+Noe2 +spring.datasource.password=root spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # log #logging.level.root=INFO @@ -19,11 +19,10 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver # =============================== spring.jpa.show-sql=true ##spring.jpa.hibernate.ddl-auto=update -spring.jpa.hibernate.ddl-auto=none +spring.jpa.hibernate.ddl-auto=create-drop spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect # =============================== # Permet d'exécuter le data.sql # =============================== -# spring.sql.init.mode=always -spring.jpa.defer-datasource-initialization=true -server.port=8081 \ No newline at end of file +spring.sql.init.mode=always +spring.jpa.defer-datasource-initialization=true \ No newline at end of file diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql index 233989d..07cd1c8 100644 --- a/src/main/resources/data.sql +++ b/src/main/resources/data.sql @@ -1,36 +1,21 @@ -insert into personne (nom, prenom, email, password) values ('Cardon', 'Thomas', 'thomas.cardon@gmail.com', '$2a$10$724bLjLyGOEKTBbHy.s3C.ETc.HuBnhEoCOuoO7.Ts7kyPbz6hkme'); -insert into personne (nom, prenom, email, password) values ('Ramiere', 'Vincent', 'vincent.ramiere@gmail.com', '$2a$10$x6.VyO9PCMXSPsi5/m/Hze9xOP.IUdYbaye7cNFc.PfyuRuVLbG7e'); -insert into personne (nom, prenom, email, password) values ('Verger', 'Romain', 'romain.verger@gmail.com', '$2a$10$oe/h0ZDpi6xFmTj8CvDMDe13hoEGv0DhHziY7GUatbb9ETcRw/8RG'); -insert into personne (nom, prenom, email, password) values ('Ribardiere', 'Paul-Emmanuel', 'paul.ribardiere@gmail.com', '$2a$10$ArSe7TSUapTs9oGE8824fOv4PM6NJwu7mzcg72cSmHy0.ds585Oke'); -insert into personne (nom, prenom, email, password) values ('Noris', 'William', 'william.noris@gmail.com', '$2a$10$6UbvPYBR2Ql09M1kgK0.HuoX3X1gxScmaOxI242EB2U7cXiylX3z.'); -insert into personne (nom, prenom, email, password) values ('Harmand', 'Isabelle', 'isabelle.harmand@gmail.com', '$2a$10$at1EZABxNN32M5pCttV36OvzbUWx1myGisa36i3..vveO6j0Lk2Da'); -insert into personne (nom, prenom, email, password) values ('Bajard', 'Blandine', 'blandine.bajard@gmail.com', '$2a$10$koeHn0Wg54MTc7iDb9hbsujy/Opfrhhu0uuhhBNA00rMXLeMpSl.m'); -insert into personne (nom, prenom, email, password) values ('El Hiri', 'Sana', 'sana.el-hiri@gmail.com', '$2a$10$jBBk1RQrl5XOeSQYz3xdJ.Xl8hBIu/x3mqHpYyL10m6KjwfDsWGEW'); -insert into personne (nom, prenom, email, password) values ('Lucas', 'Cecile', 'cecile.lucas@gmail.com', '$2a$10$HAUg8vlmtvS/YphJzWAPfuGJdLd/3SeSZ48JVvybK6Wh/AY3QirGG'); -insert into personne (nom, prenom, email, password) values ('Kerkeb', 'Mohamed', 'mohamed.kerkeb@gmail.com', '$2a$10$BpWZMlDLKXA2qGMo9t6cxeS6G/6mvjdsdN4nIUOAjE2sr/0sJNiCW'); -insert into personne (nom, prenom, email, password) values ('Rinquin', 'Aline', 'aline.rinquin@gmail.com', '$2a$10$FJKDTcipj/8PKos7AcCnZ.HHAmdDh6EjknpUWPLDcVfSXWPcHZI5O'); -insert into personne (nom, prenom, email, password) values ('Keddar', 'Noreddine', 'noredinne.keddar@gmail.com', '$2a$10$5iowOIUv72hFVsT9B8K.nerA3YTPAyyUiqOAwKR55ZZcpiHT96LhG'); -insert into personne (nom, prenom, email, password) values ('Tomczyk', 'Julian', 'julian.tomczyk@gmail.com', '$2a$10$vJ89S5CXjtO01NsYrwfLyudU/p2Cz1QNDm1dGUkfKD60Z23HLZM2.'); -insert into personne (nom, prenom, email, password) values ('Mjid', 'Hedi', 'hedi.mjid@gmail.com', '$10$vJ89S5CXjtO01NsYrwfLyudU/p2Cz1QNDm1dGUkfKD60Z23HLZM2.'); +insert into personne (nom, prenom, email, password) values ('Cardon', 'Thomas', 'thomas.cardon@gmail.com', 'pjKxIN'); +insert into personne (nom, prenom, email, password) values ('Ramiere', 'Vincent', 'vincent.ramiere@gmail.com', 'YY0TuY6JH0di'); +insert into personne (nom, prenom, email, password) values ('Verger', 'Romain', 'romain.verger@gmail.com', 'C4sfAW4'); +insert into personne (nom, prenom, email, password) values ('Ribardiere', 'Paul-Emmanuel', 'paul.ribardiere@gmail.com', 'ACdXxMr'); +insert into personne (nom, prenom, email, password) values ('Noris', 'William', 'william.noris@gmail.com', 'pjKxIN'); +insert into personne (nom, prenom, email, password) values ('Harmand', 'Isabelle', 'isabelle.harmand@gmail.com', 'YY0TuY6JH0di'); +insert into personne (nom, prenom, email, password) values ('Bajard', 'Blandine', 'blandine.bajard@gmail.com', 'C4sfAW4'); +insert into personne (nom, prenom, email, password) values ('El hiri', 'Sana', 'sana.el-hiri@gmail.com', 'ACdXxMr'); +insert into personne (nom, prenom, email, password) values ('Lucas', 'Cecile', 'cecile.lucas@gmail.com', 'pjKxIN'); +insert into personne (nom, prenom, email, password) values ('Kerkeb', 'Mohamed', 'mohamed.kerkeb@gmail.com', 'YY0TuY6JH0di'); +insert into personne (nom, prenom, email, password) values ('Rinquin', 'Aline', 'aline.rinquin@gmail.com', 'C4sfAW4'); +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 `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (1,'ROLE_ADMIN'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (2,'ROLE_ADMIN'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (3,'ROLE_ADMIN'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (4,'ROLE_ADMIN'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (5,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (6,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (7,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (8,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (9,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (10,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (11,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (12,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (13,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (14,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (15,'ROLE_ADMIN'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (15,'ROLE_READER'); - +insert into role (id_role, intitule) values (1, 'Admin'); +insert into role (id_role, intitule) values (2, 'User'); INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,0,1,1,'Le Jardin de Montreuil','1 Rue du Sergent Godefroy, 93100 Montreuil','01 41 63 92 66','http://www.lejardindemontreuil.fr/','48.853391599999995','2.4347358'); INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,0,'La CaVe','45 Rue de Paris, 93100 Montreuil','01 42 87 09 48','http://www.lacaveestrestaurant.com/','48.8576152','2.4342148999999997'); @@ -73,18 +58,7 @@ INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone, INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'La Brasserie des Laitières','38 Rue de Lagny, 93100 Montreuil','01 48 51 50 70','https://le-bl.metro.biz/','48.8490399','2.4262376999999997'); INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (1,1,1,1,'LE HAVANE','248 Rue de Paris, 93100 Montreuil','01 48 57 17 23',NULL,'48.855091599999994','2.4187965'); INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'Chez Carla','6 Rue Claude Bernard, 93100 Montreuil','01 48 18 00 53','http://www.chezcarla.fr/','48.8699343','2.4507599'); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,1,'2 Bd Chanzy, 93100 Montreuil','48.85847716355682','2.4358987134859515','Le Sultan',1,1,'0148180475',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,1,'19 Av. de la Résistance, 93100 Montreuil','48.85945630168561','2.436446504305728','Monoprix',1,0,'0141720580','monoprix.fr'); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,NULL,' 20, Avenue De La Resistance','48.859572881535506','2.43723868323233','Fournil du Perche',1,0,'',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,1,'Place Jacques Duclot','48.85763987017326','2.4357752878301313','Street Wok',1,0,'',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,NULL,'18 Bd Rouget de Lisle, 93100 Montreuil','48.86127664908431','2.440266447738863','La Casa',2,1,'0187004594','www.lacasa-pizza.fr/'); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,1,'31 Rue Franklin, 93100 Montreuil','48.86373425237411','2.444081609130601','New Kyoto',2,1,'0142877365','https://newkyoto93.fr/'); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,1,'86 Bd Henri Barbusse, 93100 Montreuil','48.868535950518506','2.4415787173758625','Cosa C E Da Mangiare',2,1,'0148510777',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,1,'8 Av. Walwein, 93100 Montreuil','48.86227215595597','2.443526611143298','Bamboo & Sum',2,1,'0987366393',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,NULL,'78 Av. de la Résistance, 93100 Montreuil','48.86260826926845','2.4370469579964404','O Bon Coin',1,1,'0953523586',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,NULL,'14 Rue du Capitaine Dreyfus, 93100 Montreuil','48.85828992238344','2.437848545198565','Kashmir Café',2,1,'0143633386','http://www.kashmircafe.fr/'); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,NULL,'45 Bd Paul Vaillant Couturier, 93100 Montreuil','48.86615467929139','2.4442899980905284','Le Marrakech',3,1,'0148589402',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,NULL,'7 Bd Rouget de Lisle, 93100 Montreuil','48.86133951184523','2.4407883330629856','BOLKIRI',2,1,'0184671708','http://bolkiri.fr/'); + @@ -114,37 +88,29 @@ insert into type (id_type, libelle) values (6, 'Pizza'); insert into type (id_type, libelle) values (7, 'Brasserie'); insert into type (id_type, libelle) values (8, 'Americain'); insert into type (id_type, libelle) values (9, 'Japonais'); +insert into type (id_type, libelle) values (10, 'Asiatique'); insert into type (id_type, libelle) values (11, 'Italien'); +insert into type (id_type, libelle) values (12, 'Sushis'); insert into type (id_type, libelle) values (13, 'Chinois'); +insert into type (id_type, libelle) values (14, 'Crêperie'); insert into type (id_type, libelle) values (15, 'Hamburger'); insert into type (id_type, libelle) values (16, 'Indien'); insert into type (id_type, libelle) values (17, 'Marocain'); +insert into type (id_type, libelle) values (18, 'Fruits de Mer'); +insert into type (id_type, libelle) values (19, 'Steack'); insert into type (id_type, libelle) values (20, 'Vietnamien'); insert into type (id_type, libelle) values (21, 'Bistrot'); insert into type (id_type, libelle) values (22, 'Poulet'); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (1,5); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (2,5); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (3,5); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (4,5); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (5,5); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (6,8); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (6,22); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (7,7); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (8,5); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (9,21); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (10,7); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (42,1); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (43,2); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (44,3); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (45,4); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (46,6); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (47,9); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (48,11); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (49,13); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (50,15); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (51,16); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (52,17); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (53,20); - +insert into type_restau (id_restau, id_type) values (1, 5); +insert into type_restau (id_restau, id_type) values (2, 5); +insert into type_restau (id_restau, id_type) values (3, 5); +insert into type_restau (id_restau, id_type) values (4, 5); +insert into type_restau (id_restau, id_type) values (5, 5); +insert into type_restau (id_restau, id_type) values (6, 8); +insert into type_restau (id_restau, id_type) values (6, 22); +insert into type_restau (id_restau, id_type) values (7, 7); +insert into type_restau (id_restau, id_type) values (8, 5); +insert into type_restau (id_restau, id_type) values (9, 21); +insert into type_restau (id_restau, id_type) values (10, 7); \ No newline at end of file diff --git a/src/main/resources/script-simpleat.sql b/src/main/resources/script-simpleat.sql deleted file mode 100644 index 86a47cb..0000000 --- a/src/main/resources/script-simpleat.sql +++ /dev/null @@ -1,230 +0,0 @@ -DROP SCHEMA IF EXISTS `simpleat`; - -CREATE SCHEMA IF NOT EXISTS `simpleat` DEFAULT CHARACTER SET utf8mb4 ; -USE `simpleat` ; - -CREATE TABLE IF NOT EXISTS `simpleat`.`personne` ( - `id_personne` INT NOT NULL AUTO_INCREMENT, - `email` VARCHAR(255) NOT NULL, - `nom` VARCHAR(255) NOT NULL, - `password` VARCHAR(255) NOT NULL, - `prenom` VARCHAR(255) NOT NULL, - PRIMARY KEY (`id_personne`) -); - -CREATE TABLE IF NOT EXISTS `simpleat`.`personne_role_list` ( - `personne_id_personne` INT NOT NULL, - `role_list` VARCHAR(255) NULL DEFAULT NULL, - INDEX (`personne_id_personne`), - FOREIGN KEY (`personne_id_personne`) - REFERENCES `simpleat`.`personne` (`id_personne`) -); - -CREATE TABLE IF NOT EXISTS `simpleat`.`restaurant` ( - `id_restau` INT NOT NULL AUTO_INCREMENT, - `a_emporter` BOOLEAN NULL DEFAULT NULL, - `accespmr` BOOLEAN NULL DEFAULT NULL, - `adresse` VARCHAR(255) NOT NULL, - `latitude` VARCHAR(255) NOT NULL, - `longitude` VARCHAR(255) NOT NULL, - `nom` VARCHAR(255) NOT NULL, - `prix` INT NULL DEFAULT NULL, - `sur_place` BOOLEAN NULL DEFAULT NULL, - `telephone` VARCHAR(255) NULL DEFAULT NULL, - `website` VARCHAR(255) NULL DEFAULT NULL, - PRIMARY KEY (`id_restau`) -); - -CREATE TABLE IF NOT EXISTS `simpleat`.`preference` ( - `favori` BOOLEAN NULL DEFAULT NULL, - `note` INT NULL DEFAULT NULL, - `restau_id_restau` INT NOT NULL, - `personne_id_personne` INT NOT NULL, - PRIMARY KEY (`personne_id_personne`, `restau_id_restau`), - INDEX (`restau_id_restau`), - INDEX (`personne_id_personne`), - FOREIGN KEY (`restau_id_restau`) - REFERENCES `simpleat`.`restaurant` (`id_restau`), - FOREIGN KEY (`personne_id_personne`) - REFERENCES `simpleat`.`personne` (`id_personne`) -); - -CREATE TABLE IF NOT EXISTS `simpleat`.`reservation` ( - `date_resa` DATETIME NOT NULL, - `nb_personne` INT NOT NULL, - `id_restau` INT NOT NULL, - `id_personne` INT NOT NULL, - PRIMARY KEY (`date_resa`, `id_personne`, `id_restau`), - INDEX (`id_restau`), - INDEX (`id_personne`), - FOREIGN KEY (`id_restau`) - REFERENCES `simpleat`.`restaurant` (`id_restau`), - FOREIGN KEY (`id_personne`) - REFERENCES `simpleat`.`personne` (`id_personne`) -); - -CREATE TABLE IF NOT EXISTS `simpleat`.`type` ( - `id_type` INT NOT NULL AUTO_INCREMENT, - `libelle` VARCHAR(255) NOT NULL, - PRIMARY KEY (`id_type`) -); - -CREATE TABLE IF NOT EXISTS `simpleat`.`type_restau` ( - `id_restau` INT NOT NULL, - `id_type` INT NOT NULL, - INDEX (`id_type`) , - INDEX (`id_restau` ) , - FOREIGN KEY (`id_type`) - REFERENCES `simpleat`.`type` (`id_type`), - FOREIGN KEY (`id_restau`) - REFERENCES `simpleat`.`restaurant` (`id_restau`) -); - -insert into personne (nom, prenom, email, password) values ('Cardon', 'Thomas', 'thomas.cardon@gmail.com', '$2a$10$724bLjLyGOEKTBbHy.s3C.ETc.HuBnhEoCOuoO7.Ts7kyPbz6hkme'); -insert into personne (nom, prenom, email, password) values ('Ramiere', 'Vincent', 'vincent.ramiere@gmail.com', '$2a$10$x6.VyO9PCMXSPsi5/m/Hze9xOP.IUdYbaye7cNFc.PfyuRuVLbG7e'); -insert into personne (nom, prenom, email, password) values ('Verger', 'Romain', 'romain.verger@gmail.com', '$2a$10$oe/h0ZDpi6xFmTj8CvDMDe13hoEGv0DhHziY7GUatbb9ETcRw/8RG'); -insert into personne (nom, prenom, email, password) values ('Ribardiere', 'Paul-Emmanuel', 'paul.ribardiere@gmail.com', '$2a$10$ArSe7TSUapTs9oGE8824fOv4PM6NJwu7mzcg72cSmHy0.ds585Oke'); -insert into personne (nom, prenom, email, password) values ('Noris', 'William', 'william.noris@gmail.com', '$2a$10$6UbvPYBR2Ql09M1kgK0.HuoX3X1gxScmaOxI242EB2U7cXiylX3z.'); -insert into personne (nom, prenom, email, password) values ('Harmand', 'Isabelle', 'isabelle.harmand@gmail.com', '$2a$10$at1EZABxNN32M5pCttV36OvzbUWx1myGisa36i3..vveO6j0Lk2Da'); -insert into personne (nom, prenom, email, password) values ('Bajard', 'Blandine', 'blandine.bajard@gmail.com', '$2a$10$koeHn0Wg54MTc7iDb9hbsujy/Opfrhhu0uuhhBNA00rMXLeMpSl.m'); -insert into personne (nom, prenom, email, password) values ('El Hiri', 'Sana', 'sana.el-hiri@gmail.com', '$2a$10$jBBk1RQrl5XOeSQYz3xdJ.Xl8hBIu/x3mqHpYyL10m6KjwfDsWGEW'); -insert into personne (nom, prenom, email, password) values ('Lucas', 'Cecile', 'cecile.lucas@gmail.com', '$2a$10$HAUg8vlmtvS/YphJzWAPfuGJdLd/3SeSZ48JVvybK6Wh/AY3QirGG'); -insert into personne (nom, prenom, email, password) values ('Kerkeb', 'Mohamed', 'mohamed.kerkeb@gmail.com', '$2a$10$BpWZMlDLKXA2qGMo9t6cxeS6G/6mvjdsdN4nIUOAjE2sr/0sJNiCW'); -insert into personne (nom, prenom, email, password) values ('Rinquin', 'Aline', 'aline.rinquin@gmail.com', '$2a$10$FJKDTcipj/8PKos7AcCnZ.HHAmdDh6EjknpUWPLDcVfSXWPcHZI5O'); -insert into personne (nom, prenom, email, password) values ('Keddar', 'Noreddine', 'noredinne.keddar@gmail.com', '$2a$10$5iowOIUv72hFVsT9B8K.nerA3YTPAyyUiqOAwKR55ZZcpiHT96LhG'); -insert into personne (nom, prenom, email, password) values ('Tomczyk', 'Julian', 'julian.tomczyk@gmail.com', '$2a$10$vJ89S5CXjtO01NsYrwfLyudU/p2Cz1QNDm1dGUkfKD60Z23HLZM2.'); -insert into personne (nom, prenom, email, password) values ('Mjid', 'Hedi', 'hedi.mjid@gmail.com', '$10$vJ89S5CXjtO01NsYrwfLyudU/p2Cz1QNDm1dGUkfKD60Z23HLZM2.'); -insert into personne (nom, prenom, email, password) values ('BIDEN', 'Joe', 'joe@biden.fr', '$2a$10$NNfAnATNZf/MzIjrUFi5K.xqWizxv1Hil4/PyRAabKWK5DxsLPE6.'); - -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (1,'ROLE_ADMIN'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (2,'ROLE_ADMIN'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (3,'ROLE_ADMIN'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (4,'ROLE_ADMIN'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (5,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (6,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (7,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (8,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (9,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (10,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (11,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (12,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (13,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (14,'ROLE_READER'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (15,'ROLE_ADMIN'); -INSERT INTO `personne_role_list` (`personne_id_personne`,`role_list`) VALUES (15,'ROLE_READER'); - - -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,0,1,1,'Le Jardin de Montreuil','1 Rue du Sergent Godefroy, 93100 Montreuil','01 41 63 92 66','http://www.lejardindemontreuil.fr/','48.853391599999995','2.4347358'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,0,'La CaVe','45 Rue de Paris, 93100 Montreuil','01 42 87 09 48','http://www.lacaveestrestaurant.com/','48.8576152','2.4342148999999997'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (3,0,1,1,'Villa 9 Trois','71 Rue Hoche, 93100 Montreuil','01 48 58 17 37','http://www.villa9trois.com/','48.8638352','2.4331966'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'L''Amourette','54 Rue Robespierre, 93100 Montreuil','01 48 59 99 94','http://www.lamourette.fr/','48.853121599999994','2.4234494'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'La Maison Montreuil','31 Rue du Capitaine Dreyfus, 93100 Montreuil','09 87 18 18 81','https://www.lamaisonmontreuil.com/','48.859359700000006','2.4399254999999997'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (1,1,1,1,'le poulet en feu','63 Rue Danton, 93100 Montreuil','09 87 51 10 90','https://www.pouletenfeu.fr/','48.8653553','2.4514297'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,0,1,1,'Les Tonneaux','62 Rue Robespierre, 93100 Montreuil','01 48 58 95 01',NULL,'48.85205','2.4238472'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'Les Pianos','26 Rue Robespierre, 93100 Montreuil','09 63 53 85 17','https://www.facebook.com/lespianosmontreuilofficiel/','48.854841799999996','2.4230319'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,0,1,1,'M I M','113 Rue Marceau, 93100 Montreuil','01 43 63 31 13',NULL,'48.849849999999996','2.4265312999999997'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (1,1,1,1,'Le Gévaudan','1 Bd Rouget de Lisle, 93100 Montreuil','01 42 87 42 83',NULL,'48.8617445','2.4412374'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'Restaurant Filippo','6 Bd Chanzy, 93100 Montreuil','01 48 18 08 16',NULL,'48.8583964','2.4349743'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (1,0,1,1,'Le Mange Disc','50 Rue de Romainville, 93100 Montreuil','09 83 54 60 27','https://m.facebook.com/Le-Mange-Disc-102557926519195/?locale2=fr_FR','48.8658457','2.4466363'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (1,1,1,NULL,'Restaurant El Kahina','227 Rue de Paris, 93100 Montreuil','01 48 70 95 46',NULL,'48.8550124','2.4195686'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (NULL,1,1,1,'La Baraka','262 Rue de Paris, 93100 Montreuil','01 42 87 19 27','http://www.labarakamontreuil.fr/?lang=fr','48.8549268','2.4177603999999997'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'La Bottega Della Pizza','34 Bd Rouget de Lisle, 93100 Montreuil','01 43 63 04 35','http://www.labottegadellapizza.fr/','48.860204200000005','2.4387626'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,0,1,NULL,'Restaurant de la Paix','11 Rue Armand Carrel, 93100 Montreuil','01 73 55 21 72',NULL,'48.853764','2.4177003999999997'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'La Fontaine Bar Restaurant','47 Rue Armand Carrel, 93100 Montreuil','01 48 70 08 84','https://www.facebook.com/pages/la-fontaine-de-montreuil-Restaurant/213852528659590?fref=ts','48.8512132','2.4183881'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (3,1,1,NULL,'La Cantine Arkose Montreuil','33 Rue du Progrès, 93100 Montreuil','01 49 88 45 07','https://lacantine.arkose.com/montreuil/','48.8516335','2.419278'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (3,1,1,NULL,'Kashmir Café.','14 Rue du Capitaine Dreyfus, 93100 Montreuil','01 43 63 33 86','http://www.kashmircafe.fr/','48.8582843','2.4378471999999998'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'W Lounge','37 Rue de Valmy, 93100 Montreuil','01 48 37 61 17','http://wlounge-montreuil.com/?utm_source=gmb&utm_medium=referral','48.8507208','2.4187186'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (1,1,1,1,'L''Oasis','171 Rue de Paris, 93100 Montreuil','01 48 70 70 52','https://loasis-montreuil.fr/fr','48.855555599999995','2.4230556'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'Obrigado','8 Av. de la Prte de Montreuil, 75020 Paris','09 84 58 24 21','http://obrigado.paris/','48.8534995','2.4118692'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'Le Xanthos','30 Rue du Capitaine Dreyfus, 93100 Montreuil','01 55 86 26 77',NULL,'48.858785','2.4388468999999997'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'Thé Vert','43 Rue du Capitaine Dreyfus, 93100 Montreuil','01 42 87 79 57','http://www.thevertenligne.fr/','48.8596741','2.4405049'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'Gramophone','1 Rue Pépin, 93100 Montreuil','01 49 88 74 56','http://www.restaurantlegramophone.com/','48.8641275','2.4449753'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,0,1,NULL,'La Grosse Mignonne','56 Rue Carnot, 93100 Montreuil','01 42 87 54 51','https://www.facebook.com/LaGrosseMignonne','48.855322','2.4413144'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (1,1,1,NULL,'La Galetiere','126 Rue de Paris, 93100 Montreuil','01 42 87 47 32','http://lagaletiere.eatbu.com/','48.8563999','2.4263293'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (3,1,1,1,'Le Mamaju','36 Rue de Lagny, 93100 Montreuil','01 83 74 02 26','https://mamaju-restaurant-montreuil.eatbu.com/','48.8490247','2.4265491'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,NULL,'Le Pizzo','15 Rue du Capitaine Dreyfus, 93100 Montreuil','09 88 46 71 29',NULL,'48.8588721','2.4385882999999997'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,NULL,'L''Olivier','211 Rue de Paris, 93100 Montreuil','06 47 82 43 41',NULL,'48.855081','2.4203481'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'Louise','27 Rue du Capitaine Dreyfus, 93100 Montreuil','06 75 32 56 81','https://instagram.com/cafelouisemontreuil?utm_medium=copy_link','48.859237','2.4394462'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (1,1,1,1,'Ô Bar Lié','16 Rue de la République, 93100 Montreuil','01 48 58 71 95','http://www.obarlie.com/','48.8531155','2.4209562'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (1,1,1,NULL,'Gabycook','27 Rue du Progrès, 93100 Montreuil',NULL,NULL,'48.851772999999994','2.4202114'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'L''ALEMBERT','268 Rue de Paris, 93100 Montreuil','01 42 87 29 61','http://www.lalembert.fr/','48.8549126','2.4174881999999998'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,NULL,'Gujarat','35 Bd Paul Vaillant Couturier, 93100 Montreuil','01 48 58 77 16','http://restaurantgujarat.fr/','48.865111','2.443053'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,NULL,'L''effiloché Montreuil','5 Rue du Centenaire, 93100 Montreuil',NULL,NULL,'48.8579636','2.4270348'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,NULL,'Famille-CMC','6 Av. Pasteur, 93100 Montreuil',NULL,NULL,'48.862999300000006','2.441328'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,NULL,'O''Villagio','28 Rue du Capitaine Dreyfus, 93100 Montreuil','01 57 42 63 82','https://ovillaggio93.wixsite.com/o-villaggio','48.858722','2.4386695'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'La Brasserie des Laitières','38 Rue de Lagny, 93100 Montreuil','01 48 51 50 70','https://le-bl.metro.biz/','48.8490399','2.4262376999999997'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (1,1,1,1,'LE HAVANE','248 Rue de Paris, 93100 Montreuil','01 48 57 17 23',NULL,'48.855091599999994','2.4187965'); -INSERT INTO restaurant(prix,a_emporter,sur_place,accespmr,nom,adresse,telephone,website,latitude,longitude) VALUES (2,1,1,1,'Chez Carla','6 Rue Claude Bernard, 93100 Montreuil','01 48 18 00 53','http://www.chezcarla.fr/','48.8699343','2.4507599'); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,1,'2 Bd Chanzy, 93100 Montreuil','48.85847716355682','2.4358987134859515','Le Sultan',1,1,'0148180475',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,1,'19 Av. de la Résistance, 93100 Montreuil','48.85945630168561','2.436446504305728','Monoprix',1,0,'0141720580','monoprix.fr'); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,NULL,' 20, Avenue De La Resistance','48.859572881535506','2.43723868323233','Fournil du Perche',1,0,'',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,1,'Place Jacques Duclot','48.85763987017326','2.4357752878301313','Street Wok',1,0,'',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,NULL,'18 Bd Rouget de Lisle, 93100 Montreuil','48.86127664908431','2.440266447738863','La Casa',2,1,'0187004594','www.lacasa-pizza.fr/'); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,1,'31 Rue Franklin, 93100 Montreuil','48.86373425237411','2.444081609130601','New Kyoto',2,1,'0142877365','https://newkyoto93.fr/'); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,1,'86 Bd Henri Barbusse, 93100 Montreuil','48.868535950518506','2.4415787173758625','Cosa C E Da Mangiare',2,1,'0148510777',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,1,'8 Av. Walwein, 93100 Montreuil','48.86227215595597','2.443526611143298','Bamboo & Sum',2,1,'0987366393',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,NULL,'78 Av. de la Résistance, 93100 Montreuil','48.86260826926845','2.4370469579964404','O Bon Coin',1,1,'0953523586',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,NULL,'14 Rue du Capitaine Dreyfus, 93100 Montreuil','48.85828992238344','2.437848545198565','Kashmir Café',2,1,'0143633386','http://www.kashmircafe.fr/'); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,NULL,'45 Bd Paul Vaillant Couturier, 93100 Montreuil','48.86615467929139','2.4442899980905284','Le Marrakech',3,1,'0148589402',''); -INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`,`nom`,`prix`,`sur_place`,`telephone`,`website`) VALUES (1,NULL,'7 Bd Rouget de Lisle, 93100 Montreuil','48.86133951184523','2.4407883330629856','BOLKIRI',2,1,'0184671708','http://bolkiri.fr/'); - - - -insert into preference (restau_id_restau, personne_id_personne, note, favori) values (2, 9, 1, false); -insert into preference (restau_id_restau, personne_id_personne, note, favori) values (3, 1, 5, false); -insert into preference (restau_id_restau, personne_id_personne, note, favori) values (1, 9, 3, true); -insert into preference (restau_id_restau, personne_id_personne, note, favori) values (4, 6, 2, false); -insert into preference (restau_id_restau, personne_id_personne, note, favori) values (5, 5, 5, false); -insert into preference (restau_id_restau, personne_id_personne, note, favori) values (1, 10, 1, false); -insert into preference (restau_id_restau, personne_id_personne, note, favori) values (5, 3, 5, false); -insert into preference (restau_id_restau, personne_id_personne, note, favori) values (1, 7, 1, true); -insert into preference (restau_id_restau, personne_id_personne, note, favori) values (4, 2, 1, false); -insert into preference (restau_id_restau, personne_id_personne, note, favori) values (1, 3, 5, false); -insert into preference (restau_id_restau, personne_id_personne, note, favori) values (3, 10, 4, false); -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é'); -insert into type (id_type, libelle) values (3, 'Boulangerie'); -insert into type (id_type, libelle) values (4, 'Thaï'); -insert into type (id_type, libelle) values (5, 'Français'); -insert into type (id_type, libelle) values (6, 'Pizza'); -insert into type (id_type, libelle) values (7, 'Brasserie'); -insert into type (id_type, libelle) values (8, 'Americain'); -insert into type (id_type, libelle) values (9, 'Japonais'); -insert into type (id_type, libelle) values (11, 'Italien'); -insert into type (id_type, libelle) values (13, 'Chinois'); -insert into type (id_type, libelle) values (15, 'Hamburger'); -insert into type (id_type, libelle) values (16, 'Indien'); -insert into type (id_type, libelle) values (17, 'Marocain'); -insert into type (id_type, libelle) values (20, 'Vietnamien'); -insert into type (id_type, libelle) values (21, 'Bistrot'); -insert into type (id_type, libelle) values (22, 'Poulet'); - -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (1,5); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (2,5); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (3,5); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (4,5); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (5,5); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (6,8); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (6,22); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (7,7); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (8,5); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (9,21); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (10,7); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (42,1); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (43,2); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (44,3); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (45,4); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (46,6); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (47,9); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (48,11); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (49,13); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (50,15); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (51,16); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (52,17); -INSERT INTO type_restau (`id_restau`,`id_type`) VALUES (53,20);