Compare commits
19 Commits
d77f38b405
...
back-postg
Author | SHA1 | Date | |
---|---|---|---|
820757c836 | |||
730aa5f450 | |||
dda3e5fcfd | |||
5e8e875a37 | |||
86e7dc7c75 | |||
6235fe7e68 | |||
fc73293122 | |||
e26f8da662 | |||
b4c05f8c59 | |||
ca282378ec | |||
746fa97cf3 | |||
8b24456b48 | |||
6befd10735 | |||
db094a8d86 | |||
c739b4d26d | |||
dacb0dd179 | |||
b00c28a02a | |||
208cbbfa1d | |||
249d00177c |
@ -12,6 +12,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
|
|
||||||
- uses: axel-op/googlejavaformat-action@v3
|
- uses: axel-op/googlejavaformat-action@v3
|
||||||
with:
|
with:
|
||||||
args: "--set-exit-if-changed --skip-sorting-imports --aosp -n"
|
args: "--set-exit-if-changed --skip-sorting-imports --aosp -n"
|
@ -1,14 +1,30 @@
|
|||||||
package enseirb.myinpulse.api;
|
package enseirb.myinpulse.api;
|
||||||
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.security.Principal;
|
||||||
|
|
||||||
|
import javax.management.relation.RoleNotFoundException;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@RestController
|
@RestController
|
||||||
public class GetUserInfo {
|
public class GetUserInfo {
|
||||||
|
// TODO: understand how to get data
|
||||||
|
@GetMapping("/getUserInfo")
|
||||||
|
public Object user(Principal principal) {
|
||||||
|
System.out.println("GetUserInfo + " + principal);
|
||||||
|
System.out.println(SecurityContextHolder.getContext().getAuthentication());
|
||||||
|
return SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@CrossOrigin(methods = {RequestMethod.GET, RequestMethod.OPTIONS})
|
||||||
@GetMapping("/unauth/random")
|
@GetMapping("/unauth/random")
|
||||||
public boolean rand() {
|
public boolean rand(@RequestHeader("Authorization") String token) throws RoleNotFoundException {
|
||||||
|
System.err.println(token);
|
||||||
return Math.random() > 0.5;
|
return Math.random() > 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package enseirb.myinpulse.config;
|
package enseirb.myinpulse.config;
|
||||||
|
|
||||||
|
import static org.springframework.security.authorization.AuthorityAuthorizationManager.hasRole;
|
||||||
|
|
||||||
import enseirb.myinpulse.security.KeycloakJwtRolesConverter;
|
import enseirb.myinpulse.security.KeycloakJwtRolesConverter;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@ -13,9 +16,6 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.springframework.security.authorization.AuthorityAuthorizationManager.hasRole;
|
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class WebSecurityCustomConfiguration {
|
public class WebSecurityCustomConfiguration {
|
||||||
// CORS configuration
|
// CORS configuration
|
||||||
@ -24,8 +24,8 @@ public class WebSecurityCustomConfiguration {
|
|||||||
private String frontendUrl;
|
private String frontendUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure the CORS (Cross Origin Ressource Sharing -- a security feature) configuration.
|
* Configure the CORS (Cross Origin Ressource Sharing -- a security feature) configuration. The
|
||||||
* The only allowed website is the frontend, defined in the .env file.
|
* only allowed website is the frontend, defined in the .env file.
|
||||||
*
|
*
|
||||||
* @return the CORS configuration used by the backend
|
* @return the CORS configuration used by the backend
|
||||||
*/
|
*/
|
||||||
@ -35,10 +35,7 @@ public class WebSecurityCustomConfiguration {
|
|||||||
configuration.setAllowedOrigins(List.of(frontendUrl));
|
configuration.setAllowedOrigins(List.of(frontendUrl));
|
||||||
configuration.setAllowedMethods(Arrays.asList("GET", "OPTIONS"));
|
configuration.setAllowedMethods(Arrays.asList("GET", "OPTIONS"));
|
||||||
configuration.setAllowedHeaders(
|
configuration.setAllowedHeaders(
|
||||||
Arrays.asList(
|
Arrays.asList("authorization", "content-type", "x-auth-token"));
|
||||||
"authorization",
|
|
||||||
"content-type",
|
|
||||||
"x-auth-token"));
|
|
||||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
source.registerCorsConfiguration("/**", configuration);
|
source.registerCorsConfiguration("/**", configuration);
|
||||||
|
|
||||||
@ -47,8 +44,10 @@ public class WebSecurityCustomConfiguration {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure the authorisation required for each path.
|
* Configure the authorisation required for each path.
|
||||||
* admin endpoints are under /admin/* and entrepreneur are under /entrepreneur/*
|
*
|
||||||
* If endpoints dont require authentication, they are under /unauth/
|
* <p>admin endpoints are under /admin/* and entrepreneur are under /entrepreneur/*
|
||||||
|
*
|
||||||
|
* <p>If endpoints dont require authentication, they are under /unauth/
|
||||||
*
|
*
|
||||||
* @param http automatically filled in by spring.
|
* @param http automatically filled in by spring.
|
||||||
* @return a securityfilterchain, automatically used by spring.
|
* @return a securityfilterchain, automatically used by spring.
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package enseirb.myinpulse.exceptions;
|
||||||
|
|
||||||
|
public class RoleNotFoudException extends RuntimeException {
|
||||||
|
public RoleNotFoudException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package enseirb.myinpulse.exceptions;
|
||||||
|
|
||||||
|
public class UserNotFoundException extends RuntimeException {
|
||||||
|
public UserNotFoundException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
@ -2,12 +2,14 @@ package enseirb.myinpulse.postgres_db.controller;
|
|||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.Administrateurs;
|
import enseirb.myinpulse.postgres_db.model.Administrateurs;
|
||||||
import enseirb.myinpulse.postgres_db.repository.AdministrateursRepository;
|
import enseirb.myinpulse.postgres_db.repository.AdministrateursRepository;
|
||||||
import java.util.Optional;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.server.ResponseStatusException;
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class AdministrateursController {
|
public class AdministrateursController {
|
||||||
|
|
||||||
|
@ -2,12 +2,14 @@ package enseirb.myinpulse.postgres_db.controller;
|
|||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.ComptesRendus;
|
import enseirb.myinpulse.postgres_db.model.ComptesRendus;
|
||||||
import enseirb.myinpulse.postgres_db.repository.ComptesRendusRepository;
|
import enseirb.myinpulse.postgres_db.repository.ComptesRendusRepository;
|
||||||
import java.util.Optional;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.server.ResponseStatusException;
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class ComptesRendusController {
|
public class ComptesRendusController {
|
||||||
|
|
||||||
@ -42,6 +44,6 @@ public class ComptesRendusController {
|
|||||||
if (contenu_compte_rendu != null) {
|
if (contenu_compte_rendu != null) {
|
||||||
compteRendu.get().setContenu_compte_rendu(contenu_compte_rendu);
|
compteRendu.get().setContenu_compte_rendu(contenu_compte_rendu);
|
||||||
}
|
}
|
||||||
return compteRendu.get();
|
return this.comptesRendusRepository.save(compteRendu.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,14 @@ package enseirb.myinpulse.postgres_db.controller;
|
|||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.Entrepreneurs;
|
import enseirb.myinpulse.postgres_db.model.Entrepreneurs;
|
||||||
import enseirb.myinpulse.postgres_db.repository.EntrepreneursRepository;
|
import enseirb.myinpulse.postgres_db.repository.EntrepreneursRepository;
|
||||||
import java.util.Optional;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.server.ResponseStatusException;
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class EntrepreneursController {
|
public class EntrepreneursController {
|
||||||
|
|
||||||
@ -51,6 +53,6 @@ public class EntrepreneursController {
|
|||||||
if (status_snee != null) {
|
if (status_snee != null) {
|
||||||
entrepreneur.get().setStatus_snee(status_snee);
|
entrepreneur.get().setStatus_snee(status_snee);
|
||||||
}
|
}
|
||||||
return entrepreneur.get();
|
return this.entrepreneursRepository.save(entrepreneur.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,15 @@ package enseirb.myinpulse.postgres_db.controller;
|
|||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.Projets;
|
import enseirb.myinpulse.postgres_db.model.Projets;
|
||||||
import enseirb.myinpulse.postgres_db.repository.ProjetsRepository;
|
import enseirb.myinpulse.postgres_db.repository.ProjetsRepository;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.Optional;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.server.ResponseStatusException;
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class ProjetsController {
|
public class ProjetsController {
|
||||||
|
|
||||||
@ -57,6 +59,6 @@ public class ProjetsController {
|
|||||||
if (status_projet != null) {
|
if (status_projet != null) {
|
||||||
projet.get().setStatus_projet(status_projet);
|
projet.get().setStatus_projet(status_projet);
|
||||||
}
|
}
|
||||||
return projet.get();
|
return this.projetsRepository.save(projet.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package enseirb.myinpulse.postgres_db.controller;
|
|||||||
import enseirb.myinpulse.postgres_db.model.RendezVous;
|
import enseirb.myinpulse.postgres_db.model.RendezVous;
|
||||||
import enseirb.myinpulse.postgres_db.repository.RendezVousRepository;
|
import enseirb.myinpulse.postgres_db.repository.RendezVousRepository;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalTime;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@ -39,8 +39,8 @@ public class RendezVousController {
|
|||||||
public RendezVous updateRendezVous(
|
public RendezVous updateRendezVous(
|
||||||
@PathVariable Long id,
|
@PathVariable Long id,
|
||||||
LocalDate date_rdv,
|
LocalDate date_rdv,
|
||||||
LocalDateTime heure_rdv,
|
LocalTime heure_rdv,
|
||||||
LocalDateTime duree_rdv,
|
LocalTime duree_rdv,
|
||||||
String lieu_rdv,
|
String lieu_rdv,
|
||||||
String sujet_rdv) {
|
String sujet_rdv) {
|
||||||
Optional<RendezVous> rendezVous = this.rendezVousRepository.findById(id);
|
Optional<RendezVous> rendezVous = this.rendezVousRepository.findById(id);
|
||||||
@ -62,6 +62,6 @@ public class RendezVousController {
|
|||||||
if (sujet_rdv != null) {
|
if (sujet_rdv != null) {
|
||||||
rendezVous.get().setSujet_rdv(sujet_rdv);
|
rendezVous.get().setSujet_rdv(sujet_rdv);
|
||||||
}
|
}
|
||||||
return rendezVous.get();
|
return this.rendezVousRepository.save(rendezVous.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,15 @@ package enseirb.myinpulse.postgres_db.controller;
|
|||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.Sections;
|
import enseirb.myinpulse.postgres_db.model.Sections;
|
||||||
import enseirb.myinpulse.postgres_db.repository.SectionsRepository;
|
import enseirb.myinpulse.postgres_db.repository.SectionsRepository;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.Optional;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.server.ResponseStatusException;
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class SectionsController {
|
public class SectionsController {
|
||||||
|
|
||||||
@ -53,6 +55,6 @@ public class SectionsController {
|
|||||||
if (date_modification != null) {
|
if (date_modification != null) {
|
||||||
section.get().setDate_modification(date_modification);
|
section.get().setDate_modification(date_modification);
|
||||||
}
|
}
|
||||||
return section.get();
|
return this.sectionsRepository.save(section.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,14 @@ package enseirb.myinpulse.postgres_db.controller;
|
|||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.Utilisateurs;
|
import enseirb.myinpulse.postgres_db.model.Utilisateurs;
|
||||||
import enseirb.myinpulse.postgres_db.repository.UtilisateursRepository;
|
import enseirb.myinpulse.postgres_db.repository.UtilisateursRepository;
|
||||||
import java.util.Optional;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.server.ResponseStatusException;
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class UtilisateursController {
|
public class UtilisateursController {
|
||||||
|
|
||||||
@ -60,6 +62,6 @@ public class UtilisateursController {
|
|||||||
if (numero_telephone != null) {
|
if (numero_telephone != null) {
|
||||||
utilisateur.get().setNumero_telephone(numero_telephone);
|
utilisateur.get().setNumero_telephone(numero_telephone);
|
||||||
}
|
}
|
||||||
return utilisateur.get();
|
return this.utilisateursRepository.save(utilisateur.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,13 @@ package enseirb.myinpulse.postgres_db.model;
|
|||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import jakarta.persistence.PrimaryKeyJoinColumn;
|
import jakarta.persistence.PrimaryKeyJoinColumn;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "administrateurs")
|
@Table(name = "administrateurs")
|
||||||
@PrimaryKeyJoinColumn(name = "id_administrateur")
|
@PrimaryKeyJoinColumn(name = "id_administrateur", referencedColumnName = "id_utilisateur")
|
||||||
public class Administrateurs extends Utilisateurs {
|
public class Administrateurs extends Utilisateurs {
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY)
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@ -6,7 +6,7 @@ import jakarta.persistence.Table;
|
|||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "entrepreneurs")
|
@Table(name = "entrepreneurs")
|
||||||
@PrimaryKeyJoinColumn(name = "id_entrepreneur")
|
@PrimaryKeyJoinColumn(name = "id_entrepreneur", referencedColumnName = "id_utilisateur")
|
||||||
public class Entrepreneurs extends Utilisateurs {
|
public class Entrepreneurs extends Utilisateurs {
|
||||||
|
|
||||||
@Column(length = 255)
|
@Column(length = 255)
|
||||||
|
@ -2,6 +2,7 @@ package enseirb.myinpulse.postgres_db.model;
|
|||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -4,7 +4,7 @@ import jakarta.persistence.*;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -12,30 +12,14 @@ import java.util.List;
|
|||||||
@Table(name = "rendez_vous")
|
@Table(name = "rendez_vous")
|
||||||
public class RendezVous {
|
public class RendezVous {
|
||||||
|
|
||||||
@Id
|
|
||||||
@NotNull
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private Long id_rdv;
|
|
||||||
|
|
||||||
private LocalDate date_rdv;
|
|
||||||
|
|
||||||
private LocalDateTime heure_rdv;
|
|
||||||
|
|
||||||
private LocalDateTime duree_rdv;
|
|
||||||
|
|
||||||
@Column(length = 255)
|
|
||||||
private String lieu_rdv;
|
|
||||||
|
|
||||||
private String sujet_rdv;
|
|
||||||
|
|
||||||
@OneToMany(mappedBy = "rendezVousEntrepreneurs", fetch = FetchType.LAZY, orphanRemoval = true)
|
@OneToMany(mappedBy = "rendezVousEntrepreneurs", fetch = FetchType.LAZY, orphanRemoval = true)
|
||||||
private List<Entrepreneurs> ListEntrepreneurs = new ArrayList<>();
|
private final List<Entrepreneurs> ListEntrepreneurs = new ArrayList<>();
|
||||||
|
|
||||||
@OneToMany(mappedBy = "rendezVousAdministrateurs", fetch = FetchType.LAZY, orphanRemoval = true)
|
@OneToMany(mappedBy = "rendezVousAdministrateurs", fetch = FetchType.LAZY, orphanRemoval = true)
|
||||||
private List<Administrateurs> ListAdministrateurs = new ArrayList<>();
|
private final List<Administrateurs> ListAdministrateurs = new ArrayList<>();
|
||||||
|
|
||||||
@OneToMany(mappedBy = "rendezVousComptesRendus", fetch = FetchType.LAZY, orphanRemoval = true)
|
@OneToMany(mappedBy = "rendezVousComptesRendus", fetch = FetchType.LAZY, orphanRemoval = true)
|
||||||
private List<ComptesRendus> ListComptesRendus = new ArrayList<>();
|
private final List<ComptesRendus> ListComptesRendus = new ArrayList<>();
|
||||||
|
|
||||||
@ManyToMany(
|
@ManyToMany(
|
||||||
fetch = FetchType.LAZY,
|
fetch = FetchType.LAZY,
|
||||||
@ -46,13 +30,27 @@ public class RendezVous {
|
|||||||
inverseJoinColumns = @JoinColumn(name = "id_section"))
|
inverseJoinColumns = @JoinColumn(name = "id_section"))
|
||||||
List<Sections> ListSections = new ArrayList<>();
|
List<Sections> ListSections = new ArrayList<>();
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@NotNull
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id_rdv;
|
||||||
|
|
||||||
|
private LocalDate date_rdv;
|
||||||
|
private LocalTime heure_rdv;
|
||||||
|
private LocalTime duree_rdv;
|
||||||
|
|
||||||
|
@Column(length = 255)
|
||||||
|
private String lieu_rdv;
|
||||||
|
|
||||||
|
private String sujet_rdv;
|
||||||
|
|
||||||
public RendezVous() {}
|
public RendezVous() {}
|
||||||
|
|
||||||
public RendezVous(
|
public RendezVous(
|
||||||
Long id_rdv,
|
Long id_rdv,
|
||||||
LocalDate date_rdv,
|
LocalDate date_rdv,
|
||||||
LocalDateTime heure_rdv,
|
LocalTime heure_rdv,
|
||||||
LocalDateTime duree_rdv,
|
LocalTime duree_rdv,
|
||||||
String lieu_rdv,
|
String lieu_rdv,
|
||||||
String sujet_rdv) {
|
String sujet_rdv) {
|
||||||
this.id_rdv = id_rdv;
|
this.id_rdv = id_rdv;
|
||||||
@ -79,19 +77,19 @@ public class RendezVous {
|
|||||||
this.date_rdv = date_rdv;
|
this.date_rdv = date_rdv;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalDateTime getHeure_rdv() {
|
public LocalTime getHeure_rdv() {
|
||||||
return heure_rdv;
|
return heure_rdv;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHeure_rdv(LocalDateTime heure_rdv) {
|
public void setHeure_rdv(LocalTime heure_rdv) {
|
||||||
this.heure_rdv = heure_rdv;
|
this.heure_rdv = heure_rdv;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalDateTime getDuree_rdv() {
|
public LocalTime getDuree_rdv() {
|
||||||
return duree_rdv;
|
return duree_rdv;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDuree_rdv(LocalDateTime duree_rdv) {
|
public void setDuree_rdv(LocalTime duree_rdv) {
|
||||||
this.duree_rdv = duree_rdv;
|
this.duree_rdv = duree_rdv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class Utilisateurs {
|
|||||||
@Column(length = 255)
|
@Column(length = 255)
|
||||||
private String mail_secondaire;
|
private String mail_secondaire;
|
||||||
|
|
||||||
@Column(length = 15)
|
@Column(length = 20)
|
||||||
private String numero_telephone;
|
private String numero_telephone;
|
||||||
|
|
||||||
public Utilisateurs() {}
|
public Utilisateurs() {}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package enseirb.myinpulse.postgres_db.repository;
|
package enseirb.myinpulse.postgres_db.repository;
|
||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.Administrateurs;
|
import enseirb.myinpulse.postgres_db.model.Administrateurs;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package enseirb.myinpulse.postgres_db.repository;
|
package enseirb.myinpulse.postgres_db.repository;
|
||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.ComptesRendus;
|
import enseirb.myinpulse.postgres_db.model.ComptesRendus;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package enseirb.myinpulse.postgres_db.repository;
|
package enseirb.myinpulse.postgres_db.repository;
|
||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.Entrepreneurs;
|
import enseirb.myinpulse.postgres_db.model.Entrepreneurs;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package enseirb.myinpulse.postgres_db.repository;
|
package enseirb.myinpulse.postgres_db.repository;
|
||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.Projets;
|
import enseirb.myinpulse.postgres_db.model.Projets;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package enseirb.myinpulse.postgres_db.repository;
|
package enseirb.myinpulse.postgres_db.repository;
|
||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.RendezVous;
|
import enseirb.myinpulse.postgres_db.model.RendezVous;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package enseirb.myinpulse.postgres_db.repository;
|
package enseirb.myinpulse.postgres_db.repository;
|
||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.Sections;
|
import enseirb.myinpulse.postgres_db.model.Sections;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package enseirb.myinpulse.postgres_db.repository;
|
package enseirb.myinpulse.postgres_db.repository;
|
||||||
|
|
||||||
import enseirb.myinpulse.postgres_db.model.Utilisateurs;
|
import enseirb.myinpulse.postgres_db.model.Utilisateurs;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Source: https://github.com/ChristianHuff-DEV/secure-spring-rest-api-using-keycloak/blob/main/src/main/java/io/betweendata/RestApi/security/oauth2/KeycloakJwtRolesConverter.java
|
||||||
|
* edited by Pierre Tellier
|
||||||
|
*/
|
||||||
package enseirb.myinpulse.security;
|
package enseirb.myinpulse.security;
|
||||||
|
|
||||||
|
import static java.util.stream.Collectors.toSet;
|
||||||
|
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
import org.springframework.security.authentication.AbstractAuthenticationToken;
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
@ -14,8 +20,6 @@ import java.util.Map;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static java.util.stream.Collectors.toSet;
|
|
||||||
|
|
||||||
public class KeycloakJwtRolesConverter implements Converter<Jwt, AbstractAuthenticationToken> {
|
public class KeycloakJwtRolesConverter implements Converter<Jwt, AbstractAuthenticationToken> {
|
||||||
/** Prefix used for realm level roles. */
|
/** Prefix used for realm level roles. */
|
||||||
public static final String PREFIX_REALM_ROLE = "ROLE_REALM_";
|
public static final String PREFIX_REALM_ROLE = "ROLE_REALM_";
|
||||||
@ -38,7 +42,7 @@ public class KeycloakJwtRolesConverter implements Converter<Jwt, AbstractAuthent
|
|||||||
source,
|
source,
|
||||||
Stream.concat(
|
Stream.concat(
|
||||||
new JwtGrantedAuthoritiesConverter().convert(source).stream(),
|
new JwtGrantedAuthoritiesConverter().convert(source).stream(),
|
||||||
TEMPORARNAME(source).stream())
|
tokenRolesExtractor(source).stream())
|
||||||
.collect(toSet()));
|
.collect(toSet()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +50,7 @@ public class KeycloakJwtRolesConverter implements Converter<Jwt, AbstractAuthent
|
|||||||
* Extracts the realm and resource level roles from a JWT token distinguishing between them
|
* Extracts the realm and resource level roles from a JWT token distinguishing between them
|
||||||
* using prefixes.
|
* using prefixes.
|
||||||
*/
|
*/
|
||||||
public Collection<GrantedAuthority> TEMPORARNAME(Jwt jwt) {
|
public Collection<GrantedAuthority> tokenRolesExtractor(Jwt jwt) {
|
||||||
// Collection that will hold the extracted roles
|
// Collection that will hold the extracted roles
|
||||||
Collection<GrantedAuthority> grantedAuthorities = new ArrayList<>();
|
Collection<GrantedAuthority> grantedAuthorities = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -0,0 +1,135 @@
|
|||||||
|
package enseirb.myinpulse.utils.keycloak;
|
||||||
|
|
||||||
|
import static org.springframework.http.MediaType.APPLICATION_JSON;
|
||||||
|
|
||||||
|
import enseirb.myinpulse.exceptions.UserNotFoundException;
|
||||||
|
import enseirb.myinpulse.utils.keycloak.datatypes.RoleRepresentation;
|
||||||
|
import enseirb.myinpulse.utils.keycloak.datatypes.UserRepresentation;
|
||||||
|
|
||||||
|
import org.springframework.web.client.RestClient;
|
||||||
|
|
||||||
|
import javax.management.relation.RoleNotFoundException;
|
||||||
|
|
||||||
|
public class KeycloakApi {
|
||||||
|
|
||||||
|
static final String keycloakUrl;
|
||||||
|
static final String realmName;
|
||||||
|
|
||||||
|
static {
|
||||||
|
if (System.getenv("VITE_KEYCLOAK_URL") == null) {
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
keycloakUrl = System.getenv("VITE_KEYCLOAK_URL");
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
if (System.getenv("VITE_KEYCLOAK_REALM") == null) {
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
realmName = System.getenv("VITE_KEYCLOAK_REALM");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses Keycloak API to retrieve a role representation of a role by its name
|
||||||
|
*
|
||||||
|
* @param roleName name of the role
|
||||||
|
* @param bearer authorization header used by the client to authenticate to keycloak
|
||||||
|
*/
|
||||||
|
public static RoleRepresentation getRoleRepresentationByName(String roleName, String bearer)
|
||||||
|
throws RoleNotFoundException {
|
||||||
|
RoleRepresentation[] response =
|
||||||
|
RestClient.builder()
|
||||||
|
.baseUrl(keycloakUrl)
|
||||||
|
.defaultHeader("Authorization", bearer)
|
||||||
|
.build()
|
||||||
|
.get()
|
||||||
|
.uri("/admin/realms/{realmName}/roles/{roleName}", realmName, roleName)
|
||||||
|
.retrieve()
|
||||||
|
.body(RoleRepresentation[].class);
|
||||||
|
|
||||||
|
if (response == null || response.length == 0) {
|
||||||
|
throw new RoleNotFoundException("Role not found");
|
||||||
|
}
|
||||||
|
return response[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use keycloak API to to retreive a userID via his name or email.
|
||||||
|
*
|
||||||
|
* @param username username or mail of the user
|
||||||
|
* @param bearer bearer of the user, allowing access to database
|
||||||
|
* @return the userid, as a String
|
||||||
|
* @throws UserNotFoundException
|
||||||
|
*/
|
||||||
|
public static String getUserIdByName(String username, String bearer)
|
||||||
|
throws UserNotFoundException {
|
||||||
|
UserRepresentation[] response =
|
||||||
|
RestClient.builder()
|
||||||
|
.baseUrl(keycloakUrl)
|
||||||
|
.defaultHeader("Authorization", bearer)
|
||||||
|
.build()
|
||||||
|
.get()
|
||||||
|
.uri(
|
||||||
|
"/admin/realms/{realmName}/users?username={username}",
|
||||||
|
realmName,
|
||||||
|
username)
|
||||||
|
.retrieve()
|
||||||
|
.body(UserRepresentation[].class);
|
||||||
|
|
||||||
|
if (response == null || response.length == 0) {
|
||||||
|
throw new UserNotFoundException("User not found");
|
||||||
|
}
|
||||||
|
return response[0].id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: check for error
|
||||||
|
*
|
||||||
|
* <p>Set a keycloak role to a keycloak user.
|
||||||
|
*
|
||||||
|
* <p>Usual roles should be `MyINPulse-admin` and `MyINPulse-entrepreneur`
|
||||||
|
*
|
||||||
|
* @param username
|
||||||
|
* @param roleName
|
||||||
|
* @param bearer
|
||||||
|
* @throws RoleNotFoundException
|
||||||
|
* @throws UserNotFoundException
|
||||||
|
*/
|
||||||
|
public static void setRoleToUser(String username, String roleName, String bearer)
|
||||||
|
throws RoleNotFoundException, UserNotFoundException {
|
||||||
|
RoleRepresentation roleRepresentation = getRoleRepresentationByName(roleName, bearer);
|
||||||
|
String userId = getUserIdByName(username, bearer);
|
||||||
|
|
||||||
|
RestClient.builder()
|
||||||
|
.baseUrl(keycloakUrl)
|
||||||
|
.defaultHeader("Authorization", bearer)
|
||||||
|
.build()
|
||||||
|
.post()
|
||||||
|
.uri(
|
||||||
|
"/admin/realms/${realmName}/users/${userId}/role-mappings/realm",
|
||||||
|
realmName,
|
||||||
|
userId)
|
||||||
|
.body(roleRepresentation)
|
||||||
|
.contentType(APPLICATION_JSON)
|
||||||
|
.retrieve();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a user from Keycloak database. TODO: check the bearer permission.
|
||||||
|
*
|
||||||
|
* @param username
|
||||||
|
* @param bearer
|
||||||
|
* @throws UserNotFoundException
|
||||||
|
*/
|
||||||
|
public static void deleteUser(String username, String bearer) throws UserNotFoundException {
|
||||||
|
String userId = getUserIdByName(username, bearer);
|
||||||
|
|
||||||
|
RestClient.builder()
|
||||||
|
.baseUrl(keycloakUrl)
|
||||||
|
.defaultHeader("Authorization", bearer)
|
||||||
|
.build()
|
||||||
|
.delete()
|
||||||
|
.uri("/admin/realms/${realmName}/users/${userId}", realmName, userId)
|
||||||
|
.retrieve();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package enseirb.myinpulse.utils.keycloak.datatypes;
|
||||||
|
|
||||||
|
public class RoleRepresentation {
|
||||||
|
public String id;
|
||||||
|
public String name;
|
||||||
|
public String description;
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
package enseirb.myinpulse.utils.keycloak.datatypes;
|
||||||
|
|
||||||
|
public class UserRepresentation {
|
||||||
|
public String id;
|
||||||
|
public String name;
|
||||||
|
}
|
@ -1,50 +1,57 @@
|
|||||||
INSERT INTO projets (nom_projet, logo, date_creation, status_projet) VALUES
|
TRUNCATE projets, utilisateurs, entrepreneurs, sections, rendez_vous, comptes_rendus CASCADE;
|
||||||
('Eau du robinet', decode('013d7d16d7ad4fefb61bd95b765c8ceb', 'hex'), TO_DATE('01-OCT-2023', 'DD-MON-YYYY'), 'En cours'),
|
|
||||||
('Air oxygéné', decode('150647a0984e8f228cd14b54', 'hex'), TO_DATE('04-APR-2024', 'DD-MON-YYYY'), 'En cours'),
|
INSERT INTO projets (nom_projet, logo, date_creation, status_projet)
|
||||||
('Débat concours', decode('022024abd5486e245c145dda65116f', 'hex'), TO_DATE('22-NOV-2023', 'DD-MON-YYYY'), 'Suspendu'),
|
VALUES ('Eau du robinet', decode('013d7d16d7ad4fefb61bd95b765c8ceb', 'hex'), TO_DATE('01-OCT-2023', 'DD-MON-YYYY'),
|
||||||
('HDeirbMI', decode('ab548d6c1d595a2975e6476f544d14c55a', 'hex'), TO_DATE('07-DEC-2024', 'DD-MON-YYYY'), 'Lancement');
|
'En cours'),
|
||||||
|
('Air oxygéné', decode('150647a0984e8f228cd14b54', 'hex'), TO_DATE('04-APR-2024', 'DD-MON-YYYY'), 'En cours'),
|
||||||
|
('Débat concours', decode('022024abd5486e245c145dda65116f', 'hex'), TO_DATE('22-NOV-2023', 'DD-MON-YYYY'),
|
||||||
|
'Suspendu'),
|
||||||
|
('HDeirbMI', decode('ab548d6c1d595a2975e6476f544d14c55a', 'hex'), TO_DATE('07-DEC-2024', 'DD-MON-YYYY'),
|
||||||
|
'Lancement');
|
||||||
|
|
||||||
INSERT INTO utilisateurs (nom_utilisateur, prenom_utilisateur, mail_principal, mail_secondaire, numero_telephone) VALUES
|
INSERT INTO utilisateurs (nom_utilisateur, prenom_utilisateur, mail_principal, mail_secondaire, numero_telephone) VALUES
|
||||||
('Dupont', 'Dupond', 'super@mail.fr', 'super2@mail.fr', '06 45 72 45 98'),
|
('Dupont', 'Dupond', 'super@mail.fr', 'super2@mail.fr', '06 45 72 45 98'),
|
||||||
('Martin', 'Matin', 'genial@mail.fr', 'genial2@mail.fr', '06 52 14 58 73'),
|
('Martin', 'Matin', 'genial@mail.fr', 'genial2@mail.fr', '06 52 14 58 73'),
|
||||||
('Charvet', 'Lautre', 'mieux@tmail.fr', 'mieux2@tmail.fr', '07 49 82 16 35'),
|
('Charvet', 'Lautre', 'mieux@tmail.fr', 'mieux2@tmail.fr', '07 49 82 16 35'),
|
||||||
('Leguez', 'Theo', 'bof@mesmails.fr', 'bof2@mesmails.fr', '+33 6 78 14 25 29'),
|
('Leguez', 'Theo', 'bof@mesmails.fr', 'bof2@mesmails.fr', '+33 6 78 14 25 29'),
|
||||||
('Kia', 'Bi', 'special@mail.fr', 'special2@mail.fr', '07 65 31 38 95');
|
('Kia', 'Bi', 'special@mail.fr', 'special2@mail.fr', '07 65 31 38 95'),
|
||||||
|
('Ducaillou', 'Pierre', 'maildefou@xyz.fr', 'maildefou2@xyz.fr', '06 54 78 12 62');
|
||||||
|
|
||||||
INSERT INTO entrepreneurs (ecole, filiere, status_snee) VALUES
|
|
||||||
('ENSEIRB-MATMECA', 'INFO', TRUE),
|
INSERT INTO entrepreneurs (ecole, filiere, status_snee, id_entrepreneur) VALUES
|
||||||
('ENSC', 'Cognitique', TRUE),
|
('ENSEIRB-MATMECA', 'INFO', TRUE, 1),
|
||||||
('ENSEIRB-MATMECA', 'MATMECA', FALSE),
|
('ENSC', 'Cognitique', TRUE, 2),
|
||||||
('SupOptique', 'Classique', TRUE),
|
('ENSEIRB-MATMECA', 'MATMECA', FALSE, 3),
|
||||||
('ENSEGID', 'Géoscience', FALSE),
|
('SupOptique', 'Classique', TRUE, 4),
|
||||||
('ENSMAC', 'Matériaux composites - Mécanique', FALSE);
|
('ENSEGID', 'Géoscience', FALSE, 5),
|
||||||
|
('ENSMAC', 'Matériaux composites - Mécanique', FALSE, 6);
|
||||||
|
|
||||||
INSERT INTO sections (titre, contenu_section, date_modification) VALUES
|
INSERT INTO sections (titre, contenu_section, date_modification) VALUES
|
||||||
("Problème", "les problèmes...", TO_DATE('15-JAN-2025', 'DD-MON-YYYY')),
|
('Problème', 'les problèmes...', TO_TIMESTAMP('15-JAN-2025 09:30:20', 'DD-MON-YYYY, HH24:MI:SS')),
|
||||||
("Segment de client", "Le segment AB passant le client n°8 est de longueur 32mm.
|
('Segment de client', 'Le segment AB passant le client n°8 est de longueur 32mm.
|
||||||
Le segment BC a quant à lui un longueur de 28mm. Quelle la longueur du segment AC ?", TO_DATE('12-OCT-2022', 'DD-MON-YYYY')),
|
Le segment BC a quant à lui un longueur de 28mm. Quelle la longueur du segment AC ?', TO_TIMESTAMP('12-OCT-2022 17:47:38', 'DD-MON-YYYY, HH24:MI:SS')),
|
||||||
("Proposition de valeur unique", "'Son prix est de 2594€' 'Ah oui c'est unique en effet'", TO_DATE('25-MAY-2024', 'DD-MON-YYYY')),
|
('Proposition de valeur unique', '''Son prix est de 2594€'' ''Ah oui c''est unique en effet', TO_TIMESTAMP('25-MAY-2024 11:12:04', 'DD-MON-YYYY, HH24:MI:SS')),
|
||||||
("Solution", "Un problème ? Une solution", TO_DATE('08-FEB-2024', 'DD-MON-YYYY')),
|
('Solution', 'Un problème ? Une solution', TO_TIMESTAMP('08-FEB-2024 10:17:53', 'DD-MON-YYYY, HH24:MI:SS')),
|
||||||
("Canaux", "Ici nous avons la Seine, là-bas le Rhin, oh et plus loin le canal de Suez", TO_DATE('19-JUL-2023', 'DD-MON-YYYY')),
|
('Canaux', 'Ici nous avons la Seine, là-bas le Rhin, oh et plus loin le canal de Suez', TO_TIMESTAMP('19-JUL-2023 19:22:45', 'DD-MON-YYYY, HH24:MI:SS')),
|
||||||
("Sources de revenus", "Y'en n'a pas on est pas payé. Enfin y'a du café quoi", TO_DATE('12-JAN-2025', 'DD-MON-YYYY')),
|
('Sources de revenus', 'Y''en n''a pas on est pas payé. Enfin y''a du café quoi', TO_TIMESTAMP('12-JAN-2025 11:40:26', 'DD-MON-YYYY, HH24:MI:SS')),
|
||||||
("Structure des coûts", "'Ah oui là ça va faire au moins 1000€ par mois', Eirbware", TO_DATE('06-FEB-2025', 'DD-MON-YYYY')),
|
('Structure des coûts', '''Ah oui là ça va faire au moins 1000€ par mois'', Eirbware', TO_TIMESTAMP('06-FEB-2025 13:04:06', 'DD-MON-YYYY, HH24:MI:SS')),
|
||||||
("Indicateurs clés", "On apprend les clés comme des badges, ça se fait", TO_DATE('05-FEB-2025', 'DD-MON-YYYY')),
|
('Indicateurs clés', 'On apprend les clés comme des badges, ça se fait', TO_TIMESTAMP('05-FEB-2025 12:42:38', 'DD-MON-YYYY, HH24:MI:SS')),
|
||||||
("Avantages concurrentiel", "On est meilleur", TO_DATE('23-APR-2024', 'DD-MON-YYYY'));
|
('Avantages concurrentiel', 'On est meilleur', TO_TIMESTAMP('23-APR-2024 16:24:02', 'DD-MON-YYYY, HH24:MI:SS'));
|
||||||
|
|
||||||
INSERT INTO rendez_vous (date_rdv, heure_rdv, duree_rdv, lieu_rdv, sujet_rdv) VALUES
|
INSERT INTO rendez_vous (date_rdv, heure_rdv, duree_rdv, lieu_rdv, sujet_rdv) VALUES
|
||||||
(TO_DATE('24-DEC-2023', 'DD-MON-YYYY'), '00:00:00', '00:37:53', "À la maison", "Ouvrir les cadeaux"),
|
(TO_DATE('24-DEC-2023', 'DD-MON-YYYY'), '00:00:00', '00:37:53', 'À la maison', 'Ouvrir les cadeaux'),
|
||||||
(TO_DATE('15-AUG-2024', 'DD-MON-YYYY'), '22:35:00', '00:12:36', "Sur les quais ou dans un champ probablement", "BOUM BOUM les feux d'artifices (on fête quoi déjà ?)"),
|
(TO_DATE('15-AUG-2024', 'DD-MON-YYYY'), '22:35:00', '00:12:36', 'Sur les quais ou dans un champ probablement', 'BOUM BOUM les feux d''artifices (on fête quoi déjà ?)'),
|
||||||
(TO_DATE('29-FEB-2023', 'DD-MON-YYYY'), '14:20:00', '00:20:00', "Salle TD 15", "Ah mince c'est pas une année bissextile !"),
|
(TO_DATE('28-FEB-2023', 'DD-MON-YYYY'), '14:20:00', '00:20:00', 'Salle TD 15', 'Ah mince c''est pas une année bissextile !'),
|
||||||
(TO_DATE('23-JAN-2024', 'DD-MON-YYYY'), '12:56:27', '11:03:33', "Là où le vent nous porte", "Journée la plus importante de l'année"),
|
(TO_DATE('23-JAN-2024', 'DD-MON-YYYY'), '12:56:27', '11:03:33', 'Là où le vent nous porte', 'Journée la plus importante de l''année'),
|
||||||
(TO_DATE('25-AUG-2025', 'DD-MON-YYYY'), '00:09:00', '01:00:00', "Euh c'est par où l'amphi 56 ?", "Rentrée scolaire (il fait trop froid c'est quoi ça on est en août)");
|
(TO_DATE('25-AUG-2025', 'DD-MON-YYYY'), '00:09:00', '01:00:00', 'Euh c''est par où l''amphi 56 ?', 'Rentrée scolaire (il fait trop froid c''est quoi ça on est en août)');
|
||||||
|
|
||||||
INSERT INTO comptes_rendus (contenu_compte_rendu) VALUES
|
INSERT INTO comptes_rendus (contenu_compte_rendu) VALUES
|
||||||
("Ah oui ça c'est super, ah ouais j'aime bien, bien vu de penser à ça"),
|
('Ah oui ça c''est super, ah ouais j''aime bien, bien vu de penser à ça'),
|
||||||
("Bonne réunion"),
|
('Bonne réunion'),
|
||||||
("Ouais, j'ai rien compris mais niquel on fait comme vous avez dit"),
|
('Ouais, j''ai rien compris mais niquel on fait comme vous avez dit'),
|
||||||
("Non non ça va pas du tout ce que tu me proposes, faut tout refaire"),
|
('Non non ça va pas du tout ce que tu me proposes, faut tout refaire'),
|
||||||
("Réponse de la DSI : non"),
|
('Réponse de la DSI : non'),
|
||||||
("Trop dommage qu'Apple ait sorti leur logiciel avant nous, on avait la même idée et tout on aurait tellement pu leur faire de la concurrence");
|
('Trop dommage qu''Apple ait sorti leur logiciel avant nous, on avait la même idée et tout on aurait tellement pu leur faire de la concurrence');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1
MyINPulse-back/src/main/resources/delete.sql
Normal file
1
MyINPulse-back/src/main/resources/delete.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
DROP TABLE IF EXISTS administrateurs, projets, utilisateurs, entrepreneurs, sections, rendez_vous, comptes_rendus, concerner CASCADE;
|
@ -10,12 +10,13 @@ DROP TABLE IF EXISTS formes CASCADE;
|
|||||||
|
|
||||||
CREATE TABLE projets
|
CREATE TABLE projets
|
||||||
(
|
(
|
||||||
id_projet SERIAL NOT NULL,
|
id_projet SERIAL NOT NULL,
|
||||||
nom_projet VARCHAR(255) ,
|
nom_projet VARCHAR(255),
|
||||||
logo BYTEA ,
|
logo BYTEA,
|
||||||
date_creation DATE ,
|
date_creation DATE,
|
||||||
status_projet VARCHAR(255) ,
|
status_projet VARCHAR(255),
|
||||||
CONSTRAINT pk_projet PRIMARY KEY (id_projet) );
|
CONSTRAINT pk_projet PRIMARY KEY (id_projet)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE utilisateurs
|
CREATE TABLE utilisateurs
|
||||||
(
|
(
|
||||||
@ -24,57 +25,63 @@ nom_utilisateur VARCHAR(255) ,
|
|||||||
prenom_utilisateur VARCHAR(255) ,
|
prenom_utilisateur VARCHAR(255) ,
|
||||||
mail_principal VARCHAR(255) ,
|
mail_principal VARCHAR(255) ,
|
||||||
mail_secondaire VARCHAR(255) ,
|
mail_secondaire VARCHAR(255) ,
|
||||||
numero_telephone VARCHAR(15) ,
|
numero_telephone VARCHAR(20) ,
|
||||||
CONSTRAINT pk_utilisateur PRIMARY KEY (id_utilisateur) );
|
CONSTRAINT pk_utilisateur PRIMARY KEY (id_utilisateur) );
|
||||||
|
|
||||||
CREATE TABLE entrepreneurs
|
CREATE TABLE entrepreneurs
|
||||||
(
|
(
|
||||||
id_entrepreneur SERIAL REFERENCES utilisateurs (id_utilisateur),
|
id_entrepreneur SERIAL REFERENCES utilisateurs (id_utilisateur),
|
||||||
ecole VARCHAR(255) ,
|
ecole VARCHAR(255),
|
||||||
filiere VARCHAR(255) ,
|
filiere VARCHAR(255),
|
||||||
status_snee BOOLEAN ,
|
status_snee BOOLEAN,
|
||||||
CONSTRAINT pk_entrepreneur PRIMARY KEY (id_entrepreneur) );
|
CONSTRAINT pk_entrepreneur PRIMARY KEY (id_entrepreneur)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE administrateurs
|
CREATE TABLE administrateurs
|
||||||
(
|
(
|
||||||
id_administrateur SERIAL REFERENCES utilisateurs (id_utilisateur),
|
id_administrateur SERIAL REFERENCES utilisateurs (id_utilisateur),
|
||||||
CONSTRAINT pk_administrateur PRIMARY KEY (id_administrateur) );
|
CONSTRAINT pk_administrateur PRIMARY KEY (id_administrateur)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE sections
|
CREATE TABLE sections
|
||||||
(
|
(
|
||||||
id_section SERIAL NOT NULL,
|
id_section SERIAL NOT NULL,
|
||||||
titre VARCHAR(255) ,
|
titre VARCHAR(255),
|
||||||
contenu_section TEXT ,
|
contenu_section TEXT,
|
||||||
date_modification TIMESTAMP ,
|
date_modification TIMESTAMP,
|
||||||
CONSTRAINT pk_section PRIMARY KEY (id_section) );
|
CONSTRAINT pk_section PRIMARY KEY (id_section)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE rendez_vous
|
CREATE TABLE rendez_vous
|
||||||
(
|
(
|
||||||
id_rdv SERIAL NOT NULL,
|
id_rdv SERIAL NOT NULL,
|
||||||
date_rdv DATE ,
|
date_rdv DATE,
|
||||||
heure_rdv TIME ,
|
heure_rdv TIME,
|
||||||
duree_rdv TIME ,
|
duree_rdv TIME,
|
||||||
lieu_rdv VARCHAR(255) ,
|
lieu_rdv VARCHAR(255),
|
||||||
sujet_rdv TEXT ,
|
sujet_rdv TEXT,
|
||||||
CONSTRAINT pk_rdv PRIMARY KEY (id_rdv) );
|
CONSTRAINT pk_rdv PRIMARY KEY (id_rdv)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE comptes_rendus
|
CREATE TABLE comptes_rendus
|
||||||
(
|
(
|
||||||
id_compte_rendu SERIAL NOT NULL,
|
id_compte_rendu SERIAL NOT NULL,
|
||||||
contenu_compte_rendu TEXT ,
|
contenu_compte_rendu TEXT,
|
||||||
CONSTRAINT pk_compte_rendu PRIMARY KEY (id_compte_rendu) );
|
CONSTRAINT pk_compte_rendu PRIMARY KEY (id_compte_rendu)
|
||||||
|
);
|
||||||
|
|
||||||
CREATE TABLE concerner
|
CREATE TABLE concerner
|
||||||
(
|
(
|
||||||
id_section SERIAL REFERENCES sections (id_section),
|
id_section SERIAL REFERENCES sections (id_section),
|
||||||
id_rdv SERIAL REFERENCES sections (id_rdv),
|
id_rdv SERIAL REFERENCES sections (id_rdv),
|
||||||
CONSTRAINT pk_concerner PRIMARY KEY (id_section, id_rdv) );
|
CONSTRAINT pk_concerner PRIMARY KEY (id_section, id_rdv)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE projets
|
ALTER TABLE projets
|
||||||
ADD CONSTRAINT fk1_projet FOREIGN KEY (id_administrateur)
|
ADD CONSTRAINT fk1_projet FOREIGN KEY (id_administrateur)
|
||||||
REFERENCES administrateurs (id_administrateur)
|
REFERENCES administrateurs (id_administrateur)
|
||||||
ON DELETE CASCADE;
|
ON DELETE CASCADE;
|
||||||
|
|
||||||
ALTER TABLE projets
|
ALTER TABLE projets
|
||||||
ADD CONSTRAINT fk2_projet FOREIGN KEY (id_entrepreneur_participation)
|
ADD CONSTRAINT fk2_projet FOREIGN KEY (id_entrepreneur_participation)
|
||||||
@ -82,34 +89,40 @@ ALTER TABLE projets
|
|||||||
ON DELETE CASCADE;
|
ON DELETE CASCADE;
|
||||||
|
|
||||||
ALTER TABLE entrepreneurs
|
ALTER TABLE entrepreneurs
|
||||||
ADD CONSTRAINT fk1_entrepreneur FOREIGN KEY (id_projet_propose)
|
ADD CONSTRAINT fk1_entrepreneur FOREIGN KEY (id_projet_propose)
|
||||||
REFERENCES projets (id_projet)
|
REFERENCES projets (id_projet)
|
||||||
ON DELETE CASCADE;
|
ON DELETE CASCADE;
|
||||||
|
|
||||||
ALTER TABLE sections
|
ALTER TABLE sections
|
||||||
ADD CONSTRAINT fk1_section FOREIGN KEY (id_projet)
|
ADD CONSTRAINT fk1_section FOREIGN KEY (id_projet)
|
||||||
REFERENCES projets (id_projet)
|
REFERENCES projets (id_projet)
|
||||||
ON DELETE CASCADE;
|
ON DELETE CASCADE;
|
||||||
|
|
||||||
ALTER TABLE sections
|
ALTER TABLE sections
|
||||||
ADD CONSTRAINT fk2_section FOREIGN KEY (id_administrateur)
|
ADD CONSTRAINT fk2_section FOREIGN KEY (id_administrateur)
|
||||||
REFERENCES administrateurs (id_administrateur)
|
REFERENCES administrateurs (id_administrateur)
|
||||||
ON DELETE CASCADE;
|
ON DELETE CASCADE;
|
||||||
|
|
||||||
ALTER TABLE rendez-vous
|
ALTER TABLE rendez-vous
|
||||||
ADD CONSTRAINT fk1_rdv FOREIGN KEY (id_entrepreneur)
|
ADD CONSTRAINT fk1_rdv FOREIGN KEY (id_entrepreneur)
|
||||||
REFERENCES entrepreneurs (id_entrepreneur)
|
REFERENCES entrepreneurs (id_entrepreneur)
|
||||||
ON DELETE CASCADE;
|
ON
|
||||||
|
DELETE
|
||||||
|
CASCADE;
|
||||||
|
|
||||||
ALTER TABLE rendez-vous
|
ALTER TABLE rendez-vous
|
||||||
ADD CONSTRAINT fk2_rdv FOREIGN KEY (id_administrateur)
|
ADD CONSTRAINT fk2_rdv FOREIGN KEY (id_administrateur)
|
||||||
REFERENCES administrateurs (id_administrateur)
|
REFERENCES administrateurs (id_administrateur)
|
||||||
ON DELETE CASCADE;
|
ON
|
||||||
|
DELETE
|
||||||
|
CASCADE;
|
||||||
|
|
||||||
ALTER TABLE comptes-rendus
|
ALTER TABLE comptes-rendus
|
||||||
ADD CONSTRAINT fk1_compte_rendu FOREIGN KEY (id_rdv)
|
ADD CONSTRAINT fk1_compte_rendu FOREIGN KEY (id_rdv)
|
||||||
REFERENCES rendez_vous (id_rdv)
|
REFERENCES rendez_vous (id_rdv)
|
||||||
ON DELETE CASCADE;
|
ON
|
||||||
|
DELETE
|
||||||
|
CASCADE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@ axiosInstance.interceptors.response.use(
|
|||||||
async (error) => {
|
async (error) => {
|
||||||
const originalRequest = error.config;
|
const originalRequest = error.config;
|
||||||
if (
|
if (
|
||||||
error.response.status === 401 &&
|
((error.response && error.response.status === 401) ||
|
||||||
|
error.code == "ERR_NETWORK") &&
|
||||||
!originalRequest._retry &&
|
!originalRequest._retry &&
|
||||||
store.authenticated
|
store.authenticated
|
||||||
) {
|
) {
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { store } from "../main.ts";
|
import { store } from "../main.ts";
|
||||||
import { callApi } from "@/services/api.ts";
|
import { callApi } from "@/services/api.ts";
|
||||||
|
import { ref } from "vue";
|
||||||
|
|
||||||
|
const CustomRequest = ref("");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -55,6 +58,14 @@ import { callApi } from "@/services/api.ts";
|
|||||||
<td>res</td>
|
<td>res</td>
|
||||||
<td id="3"></td>
|
<td id="3"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input v-model="CustomRequest" placeholder="edit me" />
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button @click="callApi(CustomRequest)">call</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</template>
|
</template>
|
||||||
|
Reference in New Issue
Block a user