Compare commits

..

No commits in common. "7a9955b781ac81df061ebc2b4e1644edf26ced67" and "9e2ab9fa5aa0dc72b663b479e3f6df3654ca6824" have entirely different histories.

20 changed files with 646 additions and 629 deletions

View File

@ -1,13 +1,14 @@
package enseirb.myinpulse.postgres_db.controller; package enseirb.myinpulse.postgres_db.controller;
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 enseirb.myinpulse.postgres_db.model.Administrateurs;
import org.springframework.web.server.ResponseStatusException; import org.springframework.web.server.ResponseStatusException;
import java.util.Optional;
@RestController @RestController
public class AdministrateursController { public class AdministrateursController {
@ -23,7 +24,8 @@ public class AdministrateursController {
public Administrateurs getAdministrateursById(@PathVariable Long id) { public Administrateurs getAdministrateursById(@PathVariable Long id) {
Optional<Administrateurs> administrateur = this.administrateursRepository.findById(id); Optional<Administrateurs> administrateur = this.administrateursRepository.findById(id);
if (administrateur.isEmpty()) { 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(); return administrateur.get();
} }

View File

@ -1,13 +1,14 @@
package enseirb.myinpulse.postgres_db.controller; package enseirb.myinpulse.postgres_db.controller;
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 enseirb.myinpulse.postgres_db.model.ComptesRendus;
import org.springframework.web.server.ResponseStatusException; import org.springframework.web.server.ResponseStatusException;
import java.util.Optional;
@RestController @RestController
public class ComptesRendusController { public class ComptesRendusController {

View File

@ -1,13 +1,14 @@
package enseirb.myinpulse.postgres_db.controller; package enseirb.myinpulse.postgres_db.controller;
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 enseirb.myinpulse.postgres_db.model.Entrepreneurs;
import org.springframework.web.server.ResponseStatusException; import org.springframework.web.server.ResponseStatusException;
import java.util.Optional;
@RestController @RestController
public class EntrepreneursController { public class EntrepreneursController {
@ -23,7 +24,8 @@ public class EntrepreneursController {
public Entrepreneurs getEntrepreneursById(@PathVariable Long id) { public Entrepreneurs getEntrepreneursById(@PathVariable Long id) {
Optional<Entrepreneurs> entrepreneur = entrepreneursRepository.findById(id); Optional<Entrepreneurs> entrepreneur = entrepreneursRepository.findById(id);
if (entrepreneur.isEmpty()) { 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(); return entrepreneur.get();
} }
@ -38,7 +40,8 @@ public class EntrepreneursController {
@PathVariable Long id, String ecole, String filiere, Boolean status_snee) { @PathVariable Long id, String ecole, String filiere, Boolean status_snee) {
Optional<Entrepreneurs> entrepreneur = entrepreneursRepository.findById(id); Optional<Entrepreneurs> entrepreneur = entrepreneursRepository.findById(id);
if (entrepreneur.isEmpty()) { 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) { if (ecole != null) {
entrepreneur.get().setEcole(ecole); entrepreneur.get().setEcole(ecole);

View File

@ -1,14 +1,15 @@
package enseirb.myinpulse.postgres_db.controller; package enseirb.myinpulse.postgres_db.controller;
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 enseirb.myinpulse.postgres_db.model.Projets;
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 {
@ -38,7 +39,7 @@ public class ProjetsController {
public Projets updateProjets( public Projets updateProjets(
@PathVariable Long id, @PathVariable Long id,
String nom_projet, String nom_projet,
byte[] logo, Byte[] logo,
LocalDate date_creation, LocalDate date_creation,
String status_projet) { String status_projet) {
Optional<Projets> projet = this.projetsRepository.findById(id); Optional<Projets> projet = this.projetsRepository.findById(id);

View File

@ -1,15 +1,16 @@
package enseirb.myinpulse.postgres_db.controller; package enseirb.myinpulse.postgres_db.controller;
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.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 enseirb.myinpulse.postgres_db.model.RendezVous;
import org.springframework.web.server.ResponseStatusException; import org.springframework.web.server.ResponseStatusException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Optional;
@RestController @RestController
public class RendezVousController { public class RendezVousController {

View File

@ -1,14 +1,15 @@
package enseirb.myinpulse.postgres_db.controller; package enseirb.myinpulse.postgres_db.controller;
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 enseirb.myinpulse.postgres_db.model.Sections;
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 {

View File

@ -1,13 +1,14 @@
package enseirb.myinpulse.postgres_db.controller; package enseirb.myinpulse.postgres_db.controller;
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 enseirb.myinpulse.postgres_db.model.Utilisateurs;
import org.springframework.web.server.ResponseStatusException; import org.springframework.web.server.ResponseStatusException;
import java.util.Optional;
@RestController @RestController
public class UtilisateursController { public class UtilisateursController {

View File

@ -3,6 +3,7 @@ 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;
@ -12,15 +13,15 @@ import java.util.List;
public class Administrateurs extends Utilisateurs { public class Administrateurs extends Utilisateurs {
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_projet") @JoinColumn(name = "Projets.id_projets")
private Projets projetsAdministrateurs; private Projets projets;
@OneToMany(mappedBy = "administrateursSections", fetch = FetchType.LAZY, orphanRemoval = true) @OneToMany(mappedBy = "administrateurs", fetch = FetchType.LAZY, orphanRemoval = true)
private List<Sections> ListSections = new ArrayList<>(); private List<Sections> ListSections = new ArrayList<>();
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_rdv") @JoinColumn(name = "RendezVous.id_rdv")
private RendezVous rendezVousAdministrateurs; private RendezVous rendezVous;
public Administrateurs() {} public Administrateurs() {}

View File

@ -1,7 +1,7 @@
package enseirb.myinpulse.postgres_db.model; package enseirb.myinpulse.postgres_db.model;
import jakarta.persistence.*;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.*;
import jakarta.persistence.Id; import jakarta.persistence.Id;
import jakarta.persistence.Table; import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
@ -18,8 +18,8 @@ public class ComptesRendus {
private String contenu_compte_rendu; private String contenu_compte_rendu;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_rdv") @JoinColumn(name = "RendezVous.id_rdv")
private RendezVous rendezVousComptesRendus; private RendezVous rendezVous;
public ComptesRendus() {} public ComptesRendus() {}

View File

@ -1,7 +1,7 @@
package enseirb.myinpulse.postgres_db.model; package enseirb.myinpulse.postgres_db.model;
import jakarta.persistence.*;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.*;
import jakarta.persistence.Table; import jakarta.persistence.Table;
@Entity @Entity
@ -18,17 +18,16 @@ public class Entrepreneurs extends Utilisateurs {
private boolean status_snee; private boolean status_snee;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_projet_participation", referencedColumnName = "id_projet") @JoinColumn(name = "Projets.id_projets")
private Projets projetsParticipation; private Projets projets_participation;
// @Column(insertable=false, updatable=false)
@OneToOne(fetch = FetchType.LAZY) @OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_projet_propose", referencedColumnName = "id_projet") @JoinColumn(name = "Projets.id_projets")
private Projets projetsPropose; private Projets projets_propose;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_rdv") @JoinColumn(name = "RendezVous.id_rdv")
private RendezVous rendezVousEntrepreneurs; private RendezVous rendezVous;
public Entrepreneurs() {} public Entrepreneurs() {}

View File

@ -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;
@ -18,23 +19,23 @@ public class Projets {
@Column(length = 255) @Column(length = 255)
private String nom_projet; private String nom_projet;
private byte[] logo; private Byte[] logo;
private LocalDate date_creation; private LocalDate date_creation;
@Column(length = 255) @Column(length = 255)
private String status_projet; private String status_projet;
@OneToMany(mappedBy = "projetsAdministrateurs", fetch = FetchType.LAZY, orphanRemoval = true) @OneToMany(mappedBy = "projets", fetch = FetchType.LAZY, orphanRemoval = true)
private List<Administrateurs> listAdministrateurs = new ArrayList<>(); private List<Administrateurs> listAdministrateurs = new ArrayList<>();
@OneToMany(mappedBy = "projetsParticipation", fetch = FetchType.LAZY, orphanRemoval = true) @OneToMany(mappedBy = "projets", fetch = FetchType.LAZY, orphanRemoval = true)
private List<Entrepreneurs> ListEntrepreneursParticipation = new ArrayList<>(); private List<Entrepreneurs> ListEntrepreneursParticipation = new ArrayList<>();
@OneToOne(mappedBy = "projetsPropose", fetch = FetchType.LAZY, orphanRemoval = true) @OneToOne(mappedBy = "projets", fetch = FetchType.LAZY, orphanRemoval = true)
private Entrepreneurs entrepreneursPropose; private Entrepreneurs entrepreneurs_propose;
@OneToMany(mappedBy = "projetsSections", fetch = FetchType.LAZY, orphanRemoval = true) @OneToMany(mappedBy = "projets", fetch = FetchType.LAZY, orphanRemoval = true)
private List<Sections> ListSections = new ArrayList<>(); private List<Sections> ListSections = new ArrayList<>();
// Hibernate expects entities to have a no-arg constructor, // Hibernate expects entities to have a no-arg constructor,
@ -45,7 +46,7 @@ public class Projets {
public Projets( public Projets(
Long id_projet, Long id_projet,
String nom_projet, String nom_projet,
byte[] logo, Byte[] logo,
LocalDate date_creation, LocalDate date_creation,
String status_projet) { String status_projet) {
this.id_projet = id_projet; this.id_projet = id_projet;
@ -71,11 +72,11 @@ public class Projets {
this.nom_projet = nom_projet; this.nom_projet = nom_projet;
} }
public byte[] getLogo() { public Byte[] getLogo() {
return logo; return logo;
} }
public void setLogo(byte[] logo) { public void setLogo(Byte[] logo) {
this.logo = logo; this.logo = logo;
} }

View File

@ -28,13 +28,13 @@ public class RendezVous {
private String sujet_rdv; private String sujet_rdv;
@OneToMany(mappedBy = "rendezVousEntrepreneurs", fetch = FetchType.LAZY, orphanRemoval = true) @OneToMany(mappedBy = "rendez_vous", fetch = FetchType.LAZY, orphanRemoval = true)
private List<Entrepreneurs> ListEntrepreneurs = new ArrayList<>(); private List<Entrepreneurs> ListEntrepreneurs = new ArrayList<>();
@OneToMany(mappedBy = "rendezVousAdministrateurs", fetch = FetchType.LAZY, orphanRemoval = true) @OneToMany(mappedBy = "rendez_vous", fetch = FetchType.LAZY, orphanRemoval = true)
private List<Administrateurs> ListAdministrateurs = new ArrayList<>(); private List<Administrateurs> ListAdministrateurs = new ArrayList<>();
@OneToMany(mappedBy = "rendezVousComptesRendus", fetch = FetchType.LAZY, orphanRemoval = true) @OneToMany(mappedBy = "rendez_vous", fetch = FetchType.LAZY, orphanRemoval = true)
private List<ComptesRendus> ListComptesRendus = new ArrayList<>(); private List<ComptesRendus> ListComptesRendus = new ArrayList<>();
@ManyToMany( @ManyToMany(
@ -43,7 +43,7 @@ public class RendezVous {
@JoinTable( @JoinTable(
name = "concerner", name = "concerner",
joinColumns = @JoinColumn(name = "id_rdv"), joinColumns = @JoinColumn(name = "id_rdv"),
inverseJoinColumns = @JoinColumn(name = "id_section")) inverseJoinColumns = @JoinColumn(name = "id_sections"))
List<Sections> ListSections = new ArrayList<>(); List<Sections> ListSections = new ArrayList<>();
public RendezVous() {} public RendezVous() {}

View File

@ -24,20 +24,23 @@ public class Sections {
private LocalDateTime date_modification; private LocalDateTime date_modification;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_projet") @JoinColumn(name = "Projets.id_projets")
private Projets projetsSections; private Projets projets;
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_admnistrateur") @JoinColumn(name = "Administrateurs.id_admnistrateur")
private Administrateurs administrateursSections; private Administrateurs administrateurs;
@ManyToMany(mappedBy = "ListSections") @ManyToMany(mappedBy = "sections")
private List<RendezVous> rendezVous = new ArrayList<>(); private List<RendezVous> rendezVous = new ArrayList<>();
public Sections() {} public Sections() {}
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.id_section = id_section;
this.titre = titre; this.titre = titre;
this.contenu_section = contenu_section; this.contenu_section = contenu_section;

View File

@ -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.jwk-set-uri=http://localhost:7080/realms/test/protocol/openid-connect/certs
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:7080/realms/test spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:7080/realms/test
logging.level.org.springframework.security=DEBUG logging.level.org.springframework.security=DEBUG
spring.datasource.url=jdbc:postgresql://postgres/${POSTGRES_DB} spring.datasource.url=jdbc:postgresql://localhost:5432/${MyINPulse_DB}
spring.datasource.username=${POSTGRES_USER} spring.datasource.username=${POSTGRES_USER}
spring.datasource.password=${POSTGRES_PASSWORD} spring.datasource.password=${POSTGRES_PASSWORD}
spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.ddl-auto=update

View File

@ -4,6 +4,7 @@ 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'), ('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'); ('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 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'), ('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'),
@ -38,6 +39,7 @@ 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('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"),

View File

@ -17,6 +17,7 @@ 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
( (
id_utilisateur SERIAL NOT NULL, id_utilisateur SERIAL NOT NULL,