Compare commits

..

4 Commits

Author SHA1 Message Date
Your Name d4dc843498 modif final 2022-03-11 14:40:39 +01:00
Your Name 71a4918504 modif back 2022-03-09 16:05:37 +01:00
Your Name 82ac354e7a ola 2022-03-04 11:27:41 +01:00
Your Name 362ab67c9a modif 2022-03-03 11:32:03 +01:00
33 changed files with 80 additions and 76 deletions

3
.gitignore vendored
View File

@ -5,7 +5,8 @@ build/
!**/src/main/**/build/
!**/src/test/**/build/
/src/main/resources/application.properties
application.properties
### STS ###
.apt_generated

View File

@ -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 {

View File

@ -1,4 +1,4 @@
package fr.vincentRamiere.simpleatBack.controller;
package fr.cardon.simpleat.controller;
import java.util.Collection;
@ -17,12 +17,12 @@ 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.repository.PersonneRepository;
import fr.cardon.simpleat.service.PersonneService;
@RestController
@CrossOrigin("http://localhost:4200")

View File

@ -1,4 +1,4 @@
package fr.vincentRamiere.simpleatBack.controller;
package fr.cardon.simpleat.controller;
import java.util.Collection;
import java.util.Optional;
@ -15,11 +15,11 @@ import org.springframework.web.bind.annotation.PostMapping;
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("*")

View File

@ -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("*")

View File

@ -1,4 +1,4 @@
package fr.vincentRamiere.simpleatBack.controller;
package fr.cardon.simpleat.controller;
import java.util.Collection;
@ -17,9 +17,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("*")

View File

@ -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)

View File

@ -1,4 +1,4 @@
package fr.vincentRamiere.simpleatBack.dto;
package fr.cardon.simpleat.dto;
import java.util.List;

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -1,4 +1,4 @@
package fr.vincentRamiere.simpleatBack.model;
package fr.cardon.simpleat.model;
import org.springframework.security.core.GrantedAuthority;

View File

@ -1,4 +1,4 @@
package fr.vincentRamiere.simpleatBack.model;
package fr.cardon.simpleat.model;
import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
package fr.vincentRamiere.simpleatBack.model;
package fr.cardon.simpleat.model;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;

View File

@ -1,4 +1,4 @@
package fr.vincentRamiere.simpleatBack.model;
package fr.cardon.simpleat.model;
import java.io.Serializable;

View File

@ -1,4 +1,4 @@
package fr.vincentRamiere.simpleatBack.model;
package fr.cardon.simpleat.model;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;

View File

@ -1,4 +1,4 @@
package fr.vincentRamiere.simpleatBack.model;
package fr.cardon.simpleat.model;
import java.io.Serializable;
import java.util.Date;

View File

@ -1,4 +1,4 @@
package fr.vincentRamiere.simpleatBack.model;
package fr.cardon.simpleat.model;
import java.util.ArrayList;
import java.util.Collection;

View File

@ -1,4 +1,4 @@
package fr.vincentRamiere.simpleatBack.model;
package fr.cardon.simpleat.model;
import java.util.List;

View File

@ -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<Personne, Integer> {

View File

@ -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<Preference, PreferencePK> {

View File

@ -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<Reservation, ReservationPK> {

View File

@ -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<Restaurant, Integer> {

View File

@ -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<TypeRestau, Integer> {

View File

@ -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;

View File

@ -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,9 @@ 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 fr.cardon.simpleat.repository.PersonneRepository;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwtException;
import io.jsonwebtoken.Jwts;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -8,7 +8,7 @@ spring.main.allow-circular-references=true
# ===============================
spring.datasource.url=jdbc:mysql://localhost:3306/simpleat?useSSL=false&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=CET
spring.datasource.username=root
spring.datasource.password=bbLouis1+Noe2
spring.datasource.password=BOHmilaresol02
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
# log
#logging.level.root=INFO
@ -19,11 +19,11 @@ 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.sql.init.mode=always
spring.jpa.defer-datasource-initialization=true
server.port=8081

View File

@ -84,7 +84,7 @@ INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`
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 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 Montreuil Street Food Viêt',2,1,'0184671708','http://bolkiri.fr/');

View File

@ -166,7 +166,7 @@ INSERT INTO restaurant (`a_emporter`,`accespmr`,`adresse`,`latitude`,`longitude`
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 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 Montreuil Street Food Viêt',2,1,'0184671708','http://bolkiri.fr/');