Compare commits
	
		
			2 Commits
		
	
	
		
			9e2ab9fa5a
			...
			7a9955b781
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 7a9955b781 | ||
|  | 1e97177777 | 
| @@ -1,14 +1,13 @@ | ||||
| package enseirb.myinpulse.postgres_db.controller; | ||||
|  | ||||
| import enseirb.myinpulse.postgres_db.model.Administrateurs; | ||||
| import enseirb.myinpulse.postgres_db.repository.AdministrateursRepository; | ||||
| import java.util.Optional; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import enseirb.myinpulse.postgres_db.model.Administrateurs; | ||||
| import org.springframework.web.server.ResponseStatusException; | ||||
|  | ||||
| import java.util.Optional; | ||||
|  | ||||
| @RestController | ||||
| public class AdministrateursController { | ||||
|  | ||||
| @@ -24,8 +23,7 @@ public class AdministrateursController { | ||||
|   public Administrateurs getAdministrateursById(@PathVariable Long id) { | ||||
|     Optional<Administrateurs> administrateur = this.administrateursRepository.findById(id); | ||||
|     if (administrateur.isEmpty()) { | ||||
|             throw new ResponseStatusException( | ||||
|                     HttpStatus.NOT_FOUND, "Cet administrateur n'existe pas"); | ||||
|       throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Cet administrateur n'existe pas"); | ||||
|     } | ||||
|     return administrateur.get(); | ||||
|   } | ||||
|   | ||||
| @@ -1,14 +1,13 @@ | ||||
| package enseirb.myinpulse.postgres_db.controller; | ||||
|  | ||||
| import enseirb.myinpulse.postgres_db.model.ComptesRendus; | ||||
| import enseirb.myinpulse.postgres_db.repository.ComptesRendusRepository; | ||||
| import java.util.Optional; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import enseirb.myinpulse.postgres_db.model.ComptesRendus; | ||||
| import org.springframework.web.server.ResponseStatusException; | ||||
|  | ||||
| import java.util.Optional; | ||||
|  | ||||
| @RestController | ||||
| public class ComptesRendusController { | ||||
|  | ||||
|   | ||||
| @@ -1,14 +1,13 @@ | ||||
| package enseirb.myinpulse.postgres_db.controller; | ||||
|  | ||||
| import enseirb.myinpulse.postgres_db.model.Entrepreneurs; | ||||
| import enseirb.myinpulse.postgres_db.repository.EntrepreneursRepository; | ||||
| import java.util.Optional; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import enseirb.myinpulse.postgres_db.model.Entrepreneurs; | ||||
| import org.springframework.web.server.ResponseStatusException; | ||||
|  | ||||
| import java.util.Optional; | ||||
|  | ||||
| @RestController | ||||
| public class EntrepreneursController { | ||||
|  | ||||
| @@ -24,8 +23,7 @@ public class EntrepreneursController { | ||||
|   public Entrepreneurs getEntrepreneursById(@PathVariable Long id) { | ||||
|     Optional<Entrepreneurs> entrepreneur = entrepreneursRepository.findById(id); | ||||
|     if (entrepreneur.isEmpty()) { | ||||
|             throw new ResponseStatusException( | ||||
|                     HttpStatus.NOT_FOUND, "Cet entrepreneur n'existe pas"); | ||||
|       throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Cet entrepreneur n'existe pas"); | ||||
|     } | ||||
|     return entrepreneur.get(); | ||||
|   } | ||||
| @@ -40,8 +38,7 @@ public class EntrepreneursController { | ||||
|       @PathVariable Long id, String ecole, String filiere, Boolean status_snee) { | ||||
|     Optional<Entrepreneurs> entrepreneur = entrepreneursRepository.findById(id); | ||||
|     if (entrepreneur.isEmpty()) { | ||||
|             throw new ResponseStatusException( | ||||
|                     HttpStatus.NOT_FOUND, "Cet entrepreneur n'existe pas"); | ||||
|       throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Cet entrepreneur n'existe pas"); | ||||
|     } | ||||
|     if (ecole != null) { | ||||
|       entrepreneur.get().setEcole(ecole); | ||||
|   | ||||
| @@ -1,15 +1,14 @@ | ||||
| package enseirb.myinpulse.postgres_db.controller; | ||||
|  | ||||
| import enseirb.myinpulse.postgres_db.model.Projets; | ||||
| 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.http.HttpStatus; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import enseirb.myinpulse.postgres_db.model.Projets; | ||||
| import org.springframework.web.server.ResponseStatusException; | ||||
|  | ||||
| import java.time.LocalDate; | ||||
| import java.util.Optional; | ||||
|  | ||||
| @RestController | ||||
| public class ProjetsController { | ||||
|  | ||||
| @@ -39,7 +38,7 @@ public class ProjetsController { | ||||
|   public Projets updateProjets( | ||||
|       @PathVariable Long id, | ||||
|       String nom_projet, | ||||
|             Byte[] logo, | ||||
|       byte[] logo, | ||||
|       LocalDate date_creation, | ||||
|       String status_projet) { | ||||
|     Optional<Projets> projet = this.projetsRepository.findById(id); | ||||
|   | ||||
| @@ -1,15 +1,14 @@ | ||||
| package enseirb.myinpulse.postgres_db.controller; | ||||
|  | ||||
| import enseirb.myinpulse.postgres_db.repository.RendezVousRepository; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import enseirb.myinpulse.postgres_db.model.RendezVous; | ||||
| import org.springframework.web.server.ResponseStatusException; | ||||
|  | ||||
| import enseirb.myinpulse.postgres_db.repository.RendezVousRepository; | ||||
| import java.time.LocalDate; | ||||
| import java.time.LocalDateTime; | ||||
| import java.util.Optional; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import org.springframework.web.server.ResponseStatusException; | ||||
|  | ||||
| @RestController | ||||
| public class RendezVousController { | ||||
|   | ||||
| @@ -1,15 +1,14 @@ | ||||
| package enseirb.myinpulse.postgres_db.controller; | ||||
|  | ||||
| import enseirb.myinpulse.postgres_db.model.Sections; | ||||
| 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.http.HttpStatus; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import enseirb.myinpulse.postgres_db.model.Sections; | ||||
| import org.springframework.web.server.ResponseStatusException; | ||||
|  | ||||
| import java.time.LocalDateTime; | ||||
| import java.util.Optional; | ||||
|  | ||||
| @RestController | ||||
| public class SectionsController { | ||||
|  | ||||
|   | ||||
| @@ -1,14 +1,13 @@ | ||||
| package enseirb.myinpulse.postgres_db.controller; | ||||
|  | ||||
| import enseirb.myinpulse.postgres_db.model.Utilisateurs; | ||||
| import enseirb.myinpulse.postgres_db.repository.UtilisateursRepository; | ||||
| import java.util.Optional; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.http.HttpStatus; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| import enseirb.myinpulse.postgres_db.model.Utilisateurs; | ||||
| import org.springframework.web.server.ResponseStatusException; | ||||
|  | ||||
| import java.util.Optional; | ||||
|  | ||||
| @RestController | ||||
| public class UtilisateursController { | ||||
|  | ||||
|   | ||||
| @@ -3,7 +3,6 @@ package enseirb.myinpulse.postgres_db.model; | ||||
| import jakarta.persistence.*; | ||||
| import jakarta.persistence.PrimaryKeyJoinColumn; | ||||
| import jakarta.persistence.Table; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| @@ -13,15 +12,15 @@ import java.util.List; | ||||
| public class Administrateurs extends Utilisateurs { | ||||
|  | ||||
|   @ManyToOne(fetch = FetchType.LAZY) | ||||
|     @JoinColumn(name = "Projets.id_projets") | ||||
|     private Projets projets; | ||||
|   @JoinColumn(name = "id_projet") | ||||
|   private Projets projetsAdministrateurs; | ||||
|  | ||||
|     @OneToMany(mappedBy = "administrateurs", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   @OneToMany(mappedBy = "administrateursSections", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   private List<Sections> ListSections = new ArrayList<>(); | ||||
|  | ||||
|   @ManyToOne(fetch = FetchType.LAZY) | ||||
|     @JoinColumn(name = "RendezVous.id_rdv") | ||||
|     private RendezVous rendezVous; | ||||
|   @JoinColumn(name = "id_rdv") | ||||
|   private RendezVous rendezVousAdministrateurs; | ||||
|  | ||||
|   public Administrateurs() {} | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| package enseirb.myinpulse.postgres_db.model; | ||||
|  | ||||
| import jakarta.persistence.Entity; | ||||
| import jakarta.persistence.*; | ||||
| import jakarta.persistence.Entity; | ||||
| import jakarta.persistence.Id; | ||||
| import jakarta.persistence.Table; | ||||
| import jakarta.validation.constraints.NotNull; | ||||
| @@ -18,8 +18,8 @@ public class ComptesRendus { | ||||
|   private String contenu_compte_rendu; | ||||
|  | ||||
|   @ManyToOne(fetch = FetchType.LAZY) | ||||
|     @JoinColumn(name = "RendezVous.id_rdv") | ||||
|     private RendezVous rendezVous; | ||||
|   @JoinColumn(name = "id_rdv") | ||||
|   private RendezVous rendezVousComptesRendus; | ||||
|  | ||||
|   public ComptesRendus() {} | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| package enseirb.myinpulse.postgres_db.model; | ||||
|  | ||||
| import jakarta.persistence.Entity; | ||||
| import jakarta.persistence.*; | ||||
| import jakarta.persistence.Entity; | ||||
| import jakarta.persistence.Table; | ||||
|  | ||||
| @Entity | ||||
| @@ -18,16 +18,17 @@ public class Entrepreneurs extends Utilisateurs { | ||||
|   private boolean status_snee; | ||||
|  | ||||
|   @ManyToOne(fetch = FetchType.LAZY) | ||||
|     @JoinColumn(name = "Projets.id_projets") | ||||
|     private Projets projets_participation; | ||||
|   @JoinColumn(name = "id_projet_participation", referencedColumnName = "id_projet") | ||||
|   private Projets projetsParticipation; | ||||
|  | ||||
|   // @Column(insertable=false, updatable=false) | ||||
|   @OneToOne(fetch = FetchType.LAZY) | ||||
|     @JoinColumn(name = "Projets.id_projets") | ||||
|     private Projets projets_propose; | ||||
|   @JoinColumn(name = "id_projet_propose", referencedColumnName = "id_projet") | ||||
|   private Projets projetsPropose; | ||||
|  | ||||
|   @ManyToOne(fetch = FetchType.LAZY) | ||||
|     @JoinColumn(name = "RendezVous.id_rdv") | ||||
|     private RendezVous rendezVous; | ||||
|   @JoinColumn(name = "id_rdv") | ||||
|   private RendezVous rendezVousEntrepreneurs; | ||||
|  | ||||
|   public Entrepreneurs() {} | ||||
|  | ||||
|   | ||||
| @@ -2,7 +2,6 @@ package enseirb.myinpulse.postgres_db.model; | ||||
|  | ||||
| import jakarta.persistence.*; | ||||
| import jakarta.validation.constraints.NotNull; | ||||
|  | ||||
| import java.time.LocalDate; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| @@ -19,23 +18,23 @@ public class Projets { | ||||
|   @Column(length = 255) | ||||
|   private String nom_projet; | ||||
|  | ||||
|     private Byte[] logo; | ||||
|   private byte[] logo; | ||||
|  | ||||
|   private LocalDate date_creation; | ||||
|  | ||||
|   @Column(length = 255) | ||||
|   private String status_projet; | ||||
|  | ||||
|     @OneToMany(mappedBy = "projets", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   @OneToMany(mappedBy = "projetsAdministrateurs", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   private List<Administrateurs> listAdministrateurs = new ArrayList<>(); | ||||
|  | ||||
|     @OneToMany(mappedBy = "projets", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   @OneToMany(mappedBy = "projetsParticipation", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   private List<Entrepreneurs> ListEntrepreneursParticipation = new ArrayList<>(); | ||||
|  | ||||
|     @OneToOne(mappedBy = "projets", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|     private Entrepreneurs entrepreneurs_propose; | ||||
|   @OneToOne(mappedBy = "projetsPropose", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   private Entrepreneurs entrepreneursPropose; | ||||
|  | ||||
|     @OneToMany(mappedBy = "projets", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   @OneToMany(mappedBy = "projetsSections", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   private List<Sections> ListSections = new ArrayList<>(); | ||||
|  | ||||
|   // Hibernate expects entities to have a no-arg constructor, | ||||
| @@ -46,7 +45,7 @@ public class Projets { | ||||
|   public Projets( | ||||
|       Long id_projet, | ||||
|       String nom_projet, | ||||
|             Byte[] logo, | ||||
|       byte[] logo, | ||||
|       LocalDate date_creation, | ||||
|       String status_projet) { | ||||
|     this.id_projet = id_projet; | ||||
| @@ -72,11 +71,11 @@ public class Projets { | ||||
|     this.nom_projet = nom_projet; | ||||
|   } | ||||
|  | ||||
|     public Byte[] getLogo() { | ||||
|   public byte[] getLogo() { | ||||
|     return logo; | ||||
|   } | ||||
|  | ||||
|     public void setLogo(Byte[] logo) { | ||||
|   public void setLogo(byte[] logo) { | ||||
|     this.logo = logo; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -28,13 +28,13 @@ public class RendezVous { | ||||
|  | ||||
|   private String sujet_rdv; | ||||
|  | ||||
|     @OneToMany(mappedBy = "rendez_vous", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   @OneToMany(mappedBy = "rendezVousEntrepreneurs", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   private List<Entrepreneurs> ListEntrepreneurs = new ArrayList<>(); | ||||
|  | ||||
|     @OneToMany(mappedBy = "rendez_vous", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   @OneToMany(mappedBy = "rendezVousAdministrateurs", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   private List<Administrateurs> ListAdministrateurs = new ArrayList<>(); | ||||
|  | ||||
|     @OneToMany(mappedBy = "rendez_vous", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   @OneToMany(mappedBy = "rendezVousComptesRendus", fetch = FetchType.LAZY, orphanRemoval = true) | ||||
|   private List<ComptesRendus> ListComptesRendus = new ArrayList<>(); | ||||
|  | ||||
|   @ManyToMany( | ||||
| @@ -43,7 +43,7 @@ public class RendezVous { | ||||
|   @JoinTable( | ||||
|       name = "concerner", | ||||
|       joinColumns = @JoinColumn(name = "id_rdv"), | ||||
|             inverseJoinColumns = @JoinColumn(name = "id_sections")) | ||||
|       inverseJoinColumns = @JoinColumn(name = "id_section")) | ||||
|   List<Sections> ListSections = new ArrayList<>(); | ||||
|  | ||||
|   public RendezVous() {} | ||||
|   | ||||
| @@ -24,23 +24,20 @@ public class Sections { | ||||
|   private LocalDateTime date_modification; | ||||
|  | ||||
|   @ManyToOne(fetch = FetchType.LAZY) | ||||
|     @JoinColumn(name = "Projets.id_projets") | ||||
|     private Projets projets; | ||||
|   @JoinColumn(name = "id_projet") | ||||
|   private Projets projetsSections; | ||||
|  | ||||
|   @ManyToOne(fetch = FetchType.LAZY) | ||||
|     @JoinColumn(name = "Administrateurs.id_admnistrateur") | ||||
|     private Administrateurs administrateurs; | ||||
|   @JoinColumn(name = "id_admnistrateur") | ||||
|   private Administrateurs administrateursSections; | ||||
|  | ||||
|     @ManyToMany(mappedBy = "sections") | ||||
|   @ManyToMany(mappedBy = "ListSections") | ||||
|   private List<RendezVous> rendezVous = new ArrayList<>(); | ||||
|  | ||||
|   public Sections() {} | ||||
|  | ||||
|   public Sections( | ||||
|             Long id_section, | ||||
|             String titre, | ||||
|             String contenu_section, | ||||
|             LocalDateTime date_modification) { | ||||
|       Long id_section, String titre, String contenu_section, LocalDateTime date_modification) { | ||||
|     this.id_section = id_section; | ||||
|     this.titre = titre; | ||||
|     this.contenu_section = contenu_section; | ||||
|   | ||||
| @@ -2,7 +2,7 @@ spring.application.name=myinpulse | ||||
| spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:7080/realms/test/protocol/openid-connect/certs | ||||
| spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:7080/realms/test | ||||
| logging.level.org.springframework.security=DEBUG | ||||
| spring.datasource.url=jdbc:postgresql://localhost:5432/${MyINPulse_DB} | ||||
| spring.datasource.url=jdbc:postgresql://postgres/${POSTGRES_DB} | ||||
| spring.datasource.username=${POSTGRES_USER} | ||||
| spring.datasource.password=${POSTGRES_PASSWORD} | ||||
| spring.jpa.hibernate.ddl-auto=update | ||||
|   | ||||
| @@ -4,7 +4,6 @@ INSERT INTO projets (nom_projet, logo, date_creation, status_projet) VALUES | ||||
| ('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, prenom, mail_principal, mail_secondaire, numero_telephone) VALUES | ||||
| ('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'), | ||||
| @@ -39,7 +38,6 @@ INSERT INTO rendez_vous (date_rdv, heure_rdv, duree_rdv, lieu_rdv, sujet_rdv) VA | ||||
| (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)"); | ||||
|  | ||||
|  | ||||
| INSERT INTO comptes_rendus (contenu_compte_rendu) VALUES | ||||
| ("Ah oui ça c'est super, ah ouais j'aime bien, bien vu de penser à ça"), | ||||
| ("Bonne réunion"), | ||||
|   | ||||
| @@ -17,7 +17,6 @@ date_creation   DATE              , | ||||
| status_projet   VARCHAR(255)      , | ||||
| CONSTRAINT pk_projet PRIMARY KEY (id_projet) ); | ||||
|  | ||||
|  | ||||
| CREATE TABLE utilisateurs | ||||
| ( | ||||
| id_utilisateur      SERIAL    NOT NULL, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user