diff --git a/.idea/misc.xml b/.idea/misc.xml
index 06e8b35..2289c27 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -11,4 +11,7 @@
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 0d03dbb..6704f63 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,12 +2,7 @@
4.0.0
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.6.1
-
-
+
fr.organizee
organizee
0.0.1-SNAPSHOT
@@ -16,6 +11,12 @@
11
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.6.1
+
+
org.springframework.boot
diff --git a/src/main/java/fr/organizee/controller/ContactController.java b/src/main/java/fr/organizee/dto/controller/ContactController.java
similarity index 98%
rename from src/main/java/fr/organizee/controller/ContactController.java
rename to src/main/java/fr/organizee/dto/controller/ContactController.java
index e93e926..e9eeacc 100644
--- a/src/main/java/fr/organizee/controller/ContactController.java
+++ b/src/main/java/fr/organizee/dto/controller/ContactController.java
@@ -1,4 +1,4 @@
-package fr.organizee.controller;
+package fr.organizee.dto.controller;
import fr.organizee.model.Contact;
import fr.organizee.repository.ContactRepository;
diff --git a/src/main/java/fr/organizee/controller/EvenementController.java b/src/main/java/fr/organizee/dto/controller/EvenementController.java
similarity index 98%
rename from src/main/java/fr/organizee/controller/EvenementController.java
rename to src/main/java/fr/organizee/dto/controller/EvenementController.java
index f6a32a8..c1a3582 100644
--- a/src/main/java/fr/organizee/controller/EvenementController.java
+++ b/src/main/java/fr/organizee/dto/controller/EvenementController.java
@@ -1,4 +1,4 @@
-package fr.organizee.controller;
+package fr.organizee.dto.controller;
import fr.organizee.model.Evenement;
import fr.organizee.model.Menu;
diff --git a/src/main/java/fr/organizee/controller/MailController.java b/src/main/java/fr/organizee/dto/controller/MailController.java
similarity index 97%
rename from src/main/java/fr/organizee/controller/MailController.java
rename to src/main/java/fr/organizee/dto/controller/MailController.java
index 3543668..e89b43f 100644
--- a/src/main/java/fr/organizee/controller/MailController.java
+++ b/src/main/java/fr/organizee/dto/controller/MailController.java
@@ -1,4 +1,4 @@
-package fr.organizee.controller;
+package fr.organizee.dto.controller;
import fr.organizee.model.Mail;
import fr.organizee.service.SendMailService;
diff --git a/src/main/java/fr/organizee/controller/MembreController.java b/src/main/java/fr/organizee/dto/controller/MembreController.java
similarity index 98%
rename from src/main/java/fr/organizee/controller/MembreController.java
rename to src/main/java/fr/organizee/dto/controller/MembreController.java
index 93df3d8..0bfa9f5 100644
--- a/src/main/java/fr/organizee/controller/MembreController.java
+++ b/src/main/java/fr/organizee/dto/controller/MembreController.java
@@ -1,4 +1,4 @@
-package fr.organizee.controller;
+package fr.organizee.dto.controller;
import fr.organizee.dto.JsonWebToken;
import fr.organizee.dto.MembreDto;
@@ -45,7 +45,7 @@ public class MembreController {
// Récupère tout les membres de la base
@GetMapping(value = "/all")
- @PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
+ //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
public ResponseEntity> getAll(){
List liste = null;
try
diff --git a/src/main/java/fr/organizee/controller/MenuController.java b/src/main/java/fr/organizee/dto/controller/MenuController.java
similarity index 89%
rename from src/main/java/fr/organizee/controller/MenuController.java
rename to src/main/java/fr/organizee/dto/controller/MenuController.java
index b7db085..c0b5c3b 100644
--- a/src/main/java/fr/organizee/controller/MenuController.java
+++ b/src/main/java/fr/organizee/dto/controller/MenuController.java
@@ -1,6 +1,7 @@
-package fr.organizee.controller;
+package fr.organizee.dto.controller;
import fr.organizee.model.Menu;
+import fr.organizee.model.Team;
import fr.organizee.repository.MenuRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -49,11 +50,14 @@ public class MenuController {
}
//Ajoute un nouveau menu
- @PostMapping(value="/add")
+ @PostMapping(value="/add/{team_id}", produces="application/json", consumes= "application/json")
//@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
- public ResponseEntity> addMenu(@RequestBody Menu menu){
+ public ResponseEntity> addMenu(@RequestBody Menu menu, @PathVariable Integer team_id){
Menu resultMenu = null;
try {
+ Team team=new Team();
+ team.setId(team_id);
+ menu.setTeam(team);
resultMenu = menuRepository.saveAndFlush(menu);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
diff --git a/src/main/java/fr/organizee/controller/TacheController.java b/src/main/java/fr/organizee/dto/controller/TacheController.java
similarity index 83%
rename from src/main/java/fr/organizee/controller/TacheController.java
rename to src/main/java/fr/organizee/dto/controller/TacheController.java
index 681d760..224dd14 100644
--- a/src/main/java/fr/organizee/controller/TacheController.java
+++ b/src/main/java/fr/organizee/dto/controller/TacheController.java
@@ -1,6 +1,7 @@
-package fr.organizee.controller;
+package fr.organizee.dto.controller;
import fr.organizee.model.Tache;
+import fr.organizee.model.TodoList;
import fr.organizee.repository.TacheRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -61,10 +62,13 @@ public class TacheController {
}
// Ajoute une tache
- @PostMapping(value="/add", produces="application/json", consumes="application/json")
- public ResponseEntity> addTache(@RequestBody Tache tache){
+ @PostMapping(value="/add/{idTodoList}", produces="application/json", consumes="application/json")
+ public ResponseEntity> addTache(@RequestBody Tache tache,@PathVariable Integer idTodoList){
Tache resultTache = null;
try {
+ TodoList todolist=new TodoList();
+ todolist.setId(idTodoList);
+ tache.setTodolist(todolist);
resultTache = tacheRepo.saveAndFlush(tache);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(e.getMessage());
@@ -73,11 +77,14 @@ public class TacheController {
return ResponseEntity.status(HttpStatus.CREATED).body(resultTache);
}
- //Met a jour les informations d'une date avec son ID
+ //Met a jour les informations d'une tache avec son ID
@PutMapping("/update/{id}")
public ResponseEntity> updateTache(@RequestBody Tache tache, @PathVariable Integer id) throws Exception {
Tache resultTache = null;
try {
+ TodoList todolist=new TodoList();
+ todolist.setId(tacheRepo.findById(tache.getId()).get().getTodolist().getId());
+ tache.setTodolist(todolist);
resultTache = tacheRepo.save(tache);
} catch (Exception e) {
diff --git a/src/main/java/fr/organizee/controller/TeamController.java b/src/main/java/fr/organizee/dto/controller/TeamController.java
similarity index 98%
rename from src/main/java/fr/organizee/controller/TeamController.java
rename to src/main/java/fr/organizee/dto/controller/TeamController.java
index 9ec47d3..b791776 100644
--- a/src/main/java/fr/organizee/controller/TeamController.java
+++ b/src/main/java/fr/organizee/dto/controller/TeamController.java
@@ -1,4 +1,4 @@
-package fr.organizee.controller;
+package fr.organizee.dto.controller;
import fr.organizee.model.Team;
import fr.organizee.repository.TeamRepository;
diff --git a/src/main/java/fr/organizee/controller/TodoListController.java b/src/main/java/fr/organizee/dto/controller/TodoListController.java
similarity index 98%
rename from src/main/java/fr/organizee/controller/TodoListController.java
rename to src/main/java/fr/organizee/dto/controller/TodoListController.java
index 747eff9..f166cf3 100644
--- a/src/main/java/fr/organizee/controller/TodoListController.java
+++ b/src/main/java/fr/organizee/dto/controller/TodoListController.java
@@ -1,4 +1,4 @@
-package fr.organizee.controller;
+package fr.organizee.dto.controller;
import fr.organizee.model.TodoList;
import fr.organizee.repository.TodoListRepository;
diff --git a/src/main/java/fr/organizee/model/Contact.java b/src/main/java/fr/organizee/model/Contact.java
index 826b2db..25b2d2d 100644
--- a/src/main/java/fr/organizee/model/Contact.java
+++ b/src/main/java/fr/organizee/model/Contact.java
@@ -11,6 +11,7 @@ public class Contact {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
+ private String couleur;
private String nom;
private String prenom;
private String telephone;
@@ -18,14 +19,15 @@ public class Contact {
private String adresse;
private LocalDate dateNaissance;
@ManyToOne
- @JoinColumn(name="TEAM_ID")
- @JsonIgnoreProperties({"contact","membre"})
+ @JoinColumn(name = "TEAM_ID")
+ @JsonIgnoreProperties({"contact", "membre"})
private Team team;
public Contact() {
}
- public Contact(String nom, String prenom, String telephone, String email, String adresse, LocalDate dateNaissance, Team team) {
+ public Contact(String couleur, String nom, String prenom, String telephone, String email, String adresse, LocalDate dateNaissance, Team team) {
+ this.couleur = couleur;
this.nom = nom;
this.prenom = prenom;
this.telephone = telephone;
@@ -43,6 +45,14 @@ public class Contact {
this.id = id;
}
+ public String getCouleur() {
+ return couleur;
+ }
+
+ public void setCouleur(String couleur) {
+ this.couleur = couleur;
+ }
+
public String getNom() {
return nom;
}
@@ -94,6 +104,7 @@ public class Contact {
public Team getTeam() {
return team;
}
+
public void setTeam(Team team) {
this.team = team;
}
@@ -102,6 +113,7 @@ public class Contact {
public String toString() {
return "Contact{" +
"id=" + id +
+ ", couleur='" + couleur + '\'' +
", nom='" + nom + '\'' +
", prenom='" + prenom + '\'' +
", telephone='" + telephone + '\'' +
diff --git a/src/main/java/fr/organizee/model/Menu.java b/src/main/java/fr/organizee/model/Menu.java
index dcc5cb0..22a1ab1 100644
--- a/src/main/java/fr/organizee/model/Menu.java
+++ b/src/main/java/fr/organizee/model/Menu.java
@@ -12,7 +12,7 @@ public class Menu {
private int id;
private String libelle;
private LocalDate dateMenu;
- private int validationProposition;
+ // private int validationProposition;
@ManyToOne
@JoinColumn(name="TEAM_ID")
@JsonIgnoreProperties({"menu","membre"})
@@ -21,10 +21,10 @@ public class Menu {
public Menu() {
}
- public Menu(String libelle, LocalDate dateMenu, int validationProposition, Team team) {
+ public Menu(String libelle, LocalDate dateMenu, Team team) {
this.libelle = libelle;
this.dateMenu = dateMenu;
- this.validationProposition=validationProposition;
+ //this.validationProposition=validationProposition;
this.team = team;
}
@@ -52,13 +52,13 @@ public class Menu {
this.dateMenu = dateMenu;
}
- public int getValidationProposition() {
- return validationProposition;
- }
+ // public int getValidationProposition() {
+ // return validationProposition;
+ //}
- public void setValidationProposition(int validationProposition) {
- this.validationProposition = validationProposition;
- }
+ //public void setValidationProposition(int validationProposition) {
+ // this.validationProposition = validationProposition;
+ // }
public Team getTeam() {
return team;
@@ -74,7 +74,6 @@ public class Menu {
"id=" + id +
", libelle='" + libelle + '\'' +
", dateMenu=" + dateMenu +
- ", validationProposition=" + validationProposition +
", team=" + team +
'}';
}
diff --git a/src/main/java/fr/organizee/repository/MenuRepository.java b/src/main/java/fr/organizee/repository/MenuRepository.java
index 1f22d7d..7c5d0cb 100644
--- a/src/main/java/fr/organizee/repository/MenuRepository.java
+++ b/src/main/java/fr/organizee/repository/MenuRepository.java
@@ -14,4 +14,5 @@ public interface MenuRepository extends JpaRepository