Compare commits
No commits in common. "7a9955b781ac81df061ebc2b4e1644edf26ced67" and "9e2ab9fa5aa0dc72b663b479e3f6df3654ca6824" have entirely different histories.
7a9955b781
...
9e2ab9fa5a
@ -1,13 +1,14 @@
|
||||
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 {
|
||||
|
||||
@ -23,7 +24,8 @@ 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,13 +1,14 @@
|
||||
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,13 +1,14 @@
|
||||
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 {
|
||||
|
||||
@ -23,7 +24,8 @@ 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();
|
||||
}
|
||||
@ -38,7 +40,8 @@ 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,14 +1,15 @@
|
||||
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 {
|
||||
|
||||
@ -38,7 +39,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,16 @@
|
||||
package enseirb.myinpulse.postgres_db.controller;
|
||||
|
||||
import enseirb.myinpulse.postgres_db.model.RendezVous;
|
||||
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 enseirb.myinpulse.postgres_db.model.RendezVous;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
public class RendezVousController {
|
||||
|
||||
|
@ -1,14 +1,15 @@
|
||||
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,13 +1,14 @@
|
||||
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,6 +3,7 @@ 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;
|
||||
|
||||
@ -12,15 +13,15 @@ import java.util.List;
|
||||
public class Administrateurs extends Utilisateurs {
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "id_projet")
|
||||
private Projets projetsAdministrateurs;
|
||||
@JoinColumn(name = "Projets.id_projets")
|
||||
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<>();
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "id_rdv")
|
||||
private RendezVous rendezVousAdministrateurs;
|
||||
@JoinColumn(name = "RendezVous.id_rdv")
|
||||
private RendezVous rendezVous;
|
||||
|
||||
public Administrateurs() {}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package enseirb.myinpulse.postgres_db.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.*;
|
||||
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 = "id_rdv")
|
||||
private RendezVous rendezVousComptesRendus;
|
||||
@JoinColumn(name = "RendezVous.id_rdv")
|
||||
private RendezVous rendezVous;
|
||||
|
||||
public ComptesRendus() {}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package enseirb.myinpulse.postgres_db.model;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@ -18,17 +18,16 @@ public class Entrepreneurs extends Utilisateurs {
|
||||
private boolean status_snee;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "id_projet_participation", referencedColumnName = "id_projet")
|
||||
private Projets projetsParticipation;
|
||||
@JoinColumn(name = "Projets.id_projets")
|
||||
private Projets projets_participation;
|
||||
|
||||
// @Column(insertable=false, updatable=false)
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "id_projet_propose", referencedColumnName = "id_projet")
|
||||
private Projets projetsPropose;
|
||||
@JoinColumn(name = "Projets.id_projets")
|
||||
private Projets projets_propose;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "id_rdv")
|
||||
private RendezVous rendezVousEntrepreneurs;
|
||||
@JoinColumn(name = "RendezVous.id_rdv")
|
||||
private RendezVous rendezVous;
|
||||
|
||||
public Entrepreneurs() {}
|
||||
|
||||
|
@ -2,6 +2,7 @@ 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;
|
||||
@ -18,23 +19,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 = "projetsAdministrateurs", fetch = FetchType.LAZY, orphanRemoval = true)
|
||||
@OneToMany(mappedBy = "projets", fetch = FetchType.LAZY, orphanRemoval = true)
|
||||
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<>();
|
||||
|
||||
@OneToOne(mappedBy = "projetsPropose", fetch = FetchType.LAZY, orphanRemoval = true)
|
||||
private Entrepreneurs entrepreneursPropose;
|
||||
@OneToOne(mappedBy = "projets", fetch = FetchType.LAZY, orphanRemoval = true)
|
||||
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<>();
|
||||
|
||||
// Hibernate expects entities to have a no-arg constructor,
|
||||
@ -45,7 +46,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;
|
||||
@ -71,11 +72,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 = "rendezVousEntrepreneurs", fetch = FetchType.LAZY, orphanRemoval = true)
|
||||
@OneToMany(mappedBy = "rendez_vous", fetch = FetchType.LAZY, orphanRemoval = true)
|
||||
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<>();
|
||||
|
||||
@OneToMany(mappedBy = "rendezVousComptesRendus", fetch = FetchType.LAZY, orphanRemoval = true)
|
||||
@OneToMany(mappedBy = "rendez_vous", 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_section"))
|
||||
inverseJoinColumns = @JoinColumn(name = "id_sections"))
|
||||
List<Sections> ListSections = new ArrayList<>();
|
||||
|
||||
public RendezVous() {}
|
||||
|
@ -24,20 +24,23 @@ public class Sections {
|
||||
private LocalDateTime date_modification;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "id_projet")
|
||||
private Projets projetsSections;
|
||||
@JoinColumn(name = "Projets.id_projets")
|
||||
private Projets projets;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "id_admnistrateur")
|
||||
private Administrateurs administrateursSections;
|
||||
@JoinColumn(name = "Administrateurs.id_admnistrateur")
|
||||
private Administrateurs administrateurs;
|
||||
|
||||
@ManyToMany(mappedBy = "ListSections")
|
||||
@ManyToMany(mappedBy = "sections")
|
||||
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://postgres/${POSTGRES_DB}
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/${MyINPulse_DB}
|
||||
spring.datasource.username=${POSTGRES_USER}
|
||||
spring.datasource.password=${POSTGRES_PASSWORD}
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
|
@ -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'),
|
||||
('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'),
|
||||
@ -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('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,6 +17,7 @@ date_creation DATE ,
|
||||
status_projet VARCHAR(255) ,
|
||||
CONSTRAINT pk_projet PRIMARY KEY (id_projet) );
|
||||
|
||||
|
||||
CREATE TABLE utilisateurs
|
||||
(
|
||||
id_utilisateur SERIAL NOT NULL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user