Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
165965a391 | ||
|
5cbd384954 | ||
|
0ceae0c0bf | ||
|
475587d541 | ||
|
2795468f61 | ||
|
25551e5163 | ||
|
6477f7e4a5 | ||
|
d88b34c774 | ||
|
eadca672ba | ||
|
44af1869a7 | ||
|
69feb6d378 |
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack;
|
package fr.cardon.simpleat;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -8,10 +8,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.exception.ExistingUsernameException;
|
import fr.cardon.simpleat.exception.ExistingUsernameException;
|
||||||
import fr.vincentRamiere.simpleatBack.model.EnumRole;
|
import fr.cardon.simpleat.model.EnumRole;
|
||||||
import fr.vincentRamiere.simpleatBack.model.Personne;
|
import fr.cardon.simpleat.model.Personne;
|
||||||
import fr.vincentRamiere.simpleatBack.service.PersonneService;
|
import fr.cardon.simpleat.service.PersonneService;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class SimpleatApplication {
|
public class SimpleatApplication {
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.controller;
|
package fr.cardon.simpleat.controller;
|
||||||
|
|
||||||
import java.util.Collection;
|
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.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.dto.JsonWebToken;
|
import fr.cardon.simpleat.dto.JsonWebToken;
|
||||||
import fr.vincentRamiere.simpleatBack.exception.ExistingUsernameException;
|
import fr.cardon.simpleat.exception.ExistingUsernameException;
|
||||||
import fr.vincentRamiere.simpleatBack.exception.InvalidCredentialsException;
|
import fr.cardon.simpleat.exception.InvalidCredentialsException;
|
||||||
import fr.vincentRamiere.simpleatBack.model.Personne;
|
import fr.cardon.simpleat.model.Personne;
|
||||||
import fr.vincentRamiere.simpleatBack.repository.PersonneRepository;
|
import fr.cardon.simpleat.repository.PersonneRepository;
|
||||||
import fr.vincentRamiere.simpleatBack.service.PersonneService;
|
import fr.cardon.simpleat.service.PersonneService;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin("http://localhost:4200")
|
@CrossOrigin("http://localhost:4200")
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.controller;
|
package fr.cardon.simpleat.controller;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Optional;
|
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.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.model.Preference;
|
import fr.cardon.simpleat.model.Preference;
|
||||||
import fr.vincentRamiere.simpleatBack.model.PreferencePK;
|
import fr.cardon.simpleat.model.PreferencePK;
|
||||||
import fr.vincentRamiere.simpleatBack.repository.PersonneRepository;
|
import fr.cardon.simpleat.repository.PersonneRepository;
|
||||||
import fr.vincentRamiere.simpleatBack.repository.PreferenceRepository;
|
import fr.cardon.simpleat.repository.PreferenceRepository;
|
||||||
import fr.vincentRamiere.simpleatBack.repository.RestaurantRepository;
|
import fr.cardon.simpleat.repository.RestaurantRepository;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin("*")
|
@CrossOrigin("*")
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.controller;
|
package fr.cardon.simpleat.controller;
|
||||||
|
|
||||||
import java.util.Collection;
|
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.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.model.Restaurant;
|
import fr.cardon.simpleat.model.Restaurant;
|
||||||
import fr.vincentRamiere.simpleatBack.repository.RestaurantRepository;
|
import fr.cardon.simpleat.repository.RestaurantRepository;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin("*")
|
@CrossOrigin("*")
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.controller;
|
package fr.cardon.simpleat.controller;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Collection;
|
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.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.model.Restaurant;
|
import fr.cardon.simpleat.model.Restaurant;
|
||||||
import fr.vincentRamiere.simpleatBack.model.TypeRestau;
|
import fr.cardon.simpleat.model.TypeRestau;
|
||||||
import fr.vincentRamiere.simpleatBack.repository.TypeRestauRepository;
|
import fr.cardon.simpleat.repository.TypeRestauRepository;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@CrossOrigin("*")
|
@CrossOrigin("*")
|
@ -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)
|
* Classe spécifique DTO (Data Transfer Object) qui retourne un Jeton au format JSON (REST response)
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.dto;
|
package fr.cardon.simpleat.dto;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -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
|
* Classe personnalisée pour gérer un message si l'utilisateur (User) existe en Base de données
|
@ -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.
|
* Specific exception that should be thrown when user credentials are not valid.
|
@ -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.
|
* Specific exception that should be thrown when a JWT has an invalid format.
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.model;
|
package fr.cardon.simpleat.model;
|
||||||
|
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.model;
|
package fr.cardon.simpleat.model;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.model;
|
package fr.cardon.simpleat.model;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.EmbeddedId;
|
import javax.persistence.EmbeddedId;
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.model;
|
package fr.cardon.simpleat.model;
|
||||||
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.model;
|
package fr.cardon.simpleat.model;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.EmbeddedId;
|
import javax.persistence.EmbeddedId;
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.model;
|
package fr.cardon.simpleat.model;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.model;
|
package fr.cardon.simpleat.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.model;
|
package fr.cardon.simpleat.model;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.repository;
|
package fr.cardon.simpleat.repository;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.model.Personne;
|
import fr.cardon.simpleat.model.Personne;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface PersonneRepository extends JpaRepository<Personne, Integer> {
|
public interface PersonneRepository extends JpaRepository<Personne, Integer> {
|
@ -1,10 +1,10 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.repository;
|
package fr.cardon.simpleat.repository;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.model.Preference;
|
import fr.cardon.simpleat.model.Preference;
|
||||||
import fr.vincentRamiere.simpleatBack.model.PreferencePK;
|
import fr.cardon.simpleat.model.PreferencePK;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface PreferenceRepository extends JpaRepository<Preference, PreferencePK> {
|
public interface PreferenceRepository extends JpaRepository<Preference, PreferencePK> {
|
@ -1,10 +1,10 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.repository;
|
package fr.cardon.simpleat.repository;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.model.Reservation;
|
import fr.cardon.simpleat.model.Reservation;
|
||||||
import fr.vincentRamiere.simpleatBack.model.ReservationPK;
|
import fr.cardon.simpleat.model.ReservationPK;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface ReservationRepository extends JpaRepository<Reservation, ReservationPK> {
|
public interface ReservationRepository extends JpaRepository<Reservation, ReservationPK> {
|
@ -1,9 +1,9 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.repository;
|
package fr.cardon.simpleat.repository;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.model.Restaurant;
|
import fr.cardon.simpleat.model.Restaurant;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface RestaurantRepository extends JpaRepository<Restaurant, Integer> {
|
public interface RestaurantRepository extends JpaRepository<Restaurant, Integer> {
|
@ -1,9 +1,9 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.repository;
|
package fr.cardon.simpleat.repository;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.model.TypeRestau;
|
import fr.cardon.simpleat.model.TypeRestau;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface TypeRestauRepository extends JpaRepository<TypeRestau, Integer> {
|
public interface TypeRestauRepository extends JpaRepository<TypeRestau, Integer> {
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.security;
|
package fr.cardon.simpleat.security;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ import org.springframework.security.core.Authentication;
|
|||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.web.filter.OncePerRequestFilter;
|
import org.springframework.web.filter.OncePerRequestFilter;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.exception.InvalidJWTException;
|
import fr.cardon.simpleat.exception.InvalidJWTException;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.security;
|
package fr.cardon.simpleat.security;
|
||||||
|
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -20,9 +20,9 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.exception.InvalidJWTException;
|
import fr.cardon.simpleat.exception.InvalidJWTException;
|
||||||
import fr.vincentRamiere.simpleatBack.model.EnumRole;
|
import fr.cardon.simpleat.model.EnumRole;
|
||||||
import fr.vincentRamiere.simpleatBack.repository.PersonneRepository;
|
import fr.cardon.simpleat.repository.PersonneRepository;
|
||||||
import io.jsonwebtoken.Claims;
|
import io.jsonwebtoken.Claims;
|
||||||
import io.jsonwebtoken.JwtException;
|
import io.jsonwebtoken.JwtException;
|
||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.security;
|
package fr.cardon.simpleat.security;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
@ -1,13 +1,13 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.service;
|
package fr.cardon.simpleat.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.exception.ExistingUsernameException;
|
import fr.cardon.simpleat.exception.ExistingUsernameException;
|
||||||
import fr.vincentRamiere.simpleatBack.exception.InvalidCredentialsException;
|
import fr.cardon.simpleat.exception.InvalidCredentialsException;
|
||||||
import fr.vincentRamiere.simpleatBack.model.Personne;
|
import fr.cardon.simpleat.model.Personne;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.service;
|
package fr.cardon.simpleat.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -11,11 +11,13 @@ import org.springframework.security.core.AuthenticationException;
|
|||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import org.springframework.stereotype.Service;
|
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.vincentRamiere.simpleatBack.repository.PersonneRepository;
|
import fr.cardon.simpleat.exception.InvalidCredentialsException;
|
||||||
import fr.vincentRamiere.simpleatBack.security.JwtTokenProvider;
|
import fr.cardon.simpleat.model.Personne;
|
||||||
|
import fr.cardon.simpleat.repository.PersonneRepository;
|
||||||
|
import fr.cardon.simpleat.security.JwtTokenProvider;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package fr.vincentRamiere.simpleatBack.service;
|
package fr.cardon.simpleat.service;
|
||||||
|
|
||||||
import java.util.Optional;
|
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.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import fr.vincentRamiere.simpleatBack.model.Personne;
|
import fr.cardon.simpleat.model.Personne;
|
||||||
import fr.vincentRamiere.simpleatBack.repository.PersonneRepository;
|
|
||||||
|
import fr.cardon.simpleat.repository.PersonneRepository;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
@ -7,8 +7,8 @@ spring.main.allow-circular-references=true
|
|||||||
# base de données MySQL
|
# 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:3306/simpleat?useSSL=false&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=CET
|
||||||
spring.datasource.username=root
|
spring.datasource.username=simplon
|
||||||
spring.datasource.password=bbLouis1+Noe2
|
spring.datasource.password=bbLouis1&Noe2
|
||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
# log
|
# log
|
||||||
#logging.level.root=INFO
|
#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.show-sql=true
|
||||||
##spring.jpa.hibernate.ddl-auto=update
|
##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
|
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
|
||||||
# ===============================
|
# ===============================
|
||||||
# Permet d'exécuter le data.sql
|
# Permet d'exécuter le data.sql
|
||||||
# ===============================
|
# ===============================
|
||||||
# spring.sql.init.mode=always
|
spring.sql.init.mode=always
|
||||||
spring.jpa.defer-datasource-initialization=true
|
spring.jpa.defer-datasource-initialization=true
|
||||||
server.port=8081
|
|
Loading…
Reference in New Issue
Block a user