Merge branch 'dev' of https://github.com/HediMjid/Organizee into Blandine
This commit is contained in:
		
						commit
						8e43bd59aa
					
				
					 8 changed files with 14 additions and 40 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package fr.organizee.controller;
 | 
			
		||||
package fr.organizee.dto.controller;
 | 
			
		||||
 | 
			
		||||
import fr.organizee.model.Contact;
 | 
			
		||||
import fr.organizee.repository.ContactRepository;
 | 
			
		||||
| 
						 | 
				
			
			@ -20,6 +20,7 @@ public class ContactController {
 | 
			
		|||
    @Autowired
 | 
			
		||||
    private ContactRepository contactRepo;
 | 
			
		||||
 | 
			
		||||
    //Récupère les infos d'un contact par son ID
 | 
			
		||||
    @GetMapping(value = "/{id}")
 | 
			
		||||
    //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
 | 
			
		||||
    public ResponseEntity<?> findById(@PathVariable int id){
 | 
			
		||||
| 
						 | 
				
			
			@ -34,6 +35,7 @@ public class ContactController {
 | 
			
		|||
        return ResponseEntity.status(HttpStatus.OK).body(contact);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //Récupère les infos d'un contact par la team ID
 | 
			
		||||
    @GetMapping(value = "team/{team_id}")
 | 
			
		||||
    //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
 | 
			
		||||
    public ResponseEntity<?> findByTeamId(@PathVariable int team_id){
 | 
			
		||||
| 
						 | 
				
			
			@ -44,10 +46,10 @@ public class ContactController {
 | 
			
		|||
        } catch (Exception e) {
 | 
			
		||||
            return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return ResponseEntity.status(HttpStatus.OK).body(contacts);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //Ajoute un nouveau contact
 | 
			
		||||
    @PostMapping(value="/add")
 | 
			
		||||
    //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
 | 
			
		||||
    public ResponseEntity<?> addContact(@RequestBody Contact contact){
 | 
			
		||||
| 
						 | 
				
			
			@ -61,6 +63,7 @@ public class ContactController {
 | 
			
		|||
        return ResponseEntity.status(HttpStatus.CREATED).body(resultContact);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //Mise à jour du contact par son ID
 | 
			
		||||
    @PutMapping("/update/{id}")
 | 
			
		||||
    //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
 | 
			
		||||
    public ResponseEntity<?> updateContact(@RequestBody Contact contact, @PathVariable Integer id) throws Exception {
 | 
			
		||||
| 
						 | 
				
			
			@ -75,6 +78,7 @@ public class ContactController {
 | 
			
		|||
        return ResponseEntity.status(HttpStatus.OK).body(resultContact);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //Efface le contact par on ID
 | 
			
		||||
    @DeleteMapping(value = "/delete/{id}")
 | 
			
		||||
    //@PreAuthorize("hasRole('ROLE_PARENT')")
 | 
			
		||||
    public ResponseEntity<?> deleteContact(@PathVariable int id){
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package fr.organizee.controller;
 | 
			
		||||
package fr.organizee.dto.controller;
 | 
			
		||||
 | 
			
		||||
import fr.organizee.model.Evenement;
 | 
			
		||||
import fr.organizee.model.Menu;
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package fr.organizee.controller;
 | 
			
		||||
package fr.organizee.dto.controller;
 | 
			
		||||
 | 
			
		||||
import fr.organizee.model.Mail;
 | 
			
		||||
import fr.organizee.service.SendMailService;
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package fr.organizee.controller;
 | 
			
		||||
package fr.organizee.dto.controller;
 | 
			
		||||
 | 
			
		||||
import fr.organizee.dto.JsonWebToken;
 | 
			
		||||
import fr.organizee.dto.MembreDto;
 | 
			
		||||
| 
						 | 
				
			
			@ -59,7 +59,7 @@ public class MembreController {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/admin/all")
 | 
			
		||||
    @PreAuthorize("hasRole('ROLE_PARENT')")
 | 
			
		||||
    //@PreAuthorize("hasRole('ROLE_PARENT')")
 | 
			
		||||
    public List<MembreDto> getAllAdminUsers() {
 | 
			
		||||
        return membreService.findAllUsers().stream().map(appUser -> new MembreDto(appUser.getEmail(), appUser.getRoleList())).collect(Collectors.toList());
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -168,34 +168,4 @@ public class MembreController {
 | 
			
		|||
 | 
			
		||||
        return ResponseEntity.status(HttpStatus.OK).body(resultMembre);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
//    UPDATE SUR UN CHAMPS
 | 
			
		||||
//    @PutMapping("/update/{id}")
 | 
			
		||||
//    public ResponseEntity<?> updateMembre(@RequestBody Membre membre, @PathVariable Integer id) throws Exception {
 | 
			
		||||
//        Membre resultMembre = null;
 | 
			
		||||
//        Membre oldMembre = membreRepo.getById(id);
 | 
			
		||||
//        oldMembre.setNom(membre.getNom());
 | 
			
		||||
//        //Membre resultMembre = membreRepo.getById(id);
 | 
			
		||||
//        try {
 | 
			
		||||
//            resultMembre = membreRepo.save(oldMembre);
 | 
			
		||||
//
 | 
			
		||||
//        } catch (Exception e) {
 | 
			
		||||
//            return ResponseEntity.status(HttpStatus.NOT_FOUND).body(e.getMessage());
 | 
			
		||||
//        }
 | 
			
		||||
//
 | 
			
		||||
//        return ResponseEntity.status(HttpStatus.OK).body(resultMembre);
 | 
			
		||||
//    }
 | 
			
		||||
 | 
			
		||||
//    @GetMapping(value = "/team/{id}")
 | 
			
		||||
//    public ResponseEntity<?> findTeamById(@PathVariable int id){
 | 
			
		||||
//        Optional<Team> liste = null;
 | 
			
		||||
//        try
 | 
			
		||||
//        {
 | 
			
		||||
//            liste = teamRepo.findById(id);
 | 
			
		||||
//        } catch (Exception e) {
 | 
			
		||||
//            return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
 | 
			
		||||
//        }
 | 
			
		||||
//
 | 
			
		||||
//        return ResponseEntity.status(HttpStatus.OK).body(liste);
 | 
			
		||||
//    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package fr.organizee.controller;
 | 
			
		||||
package fr.organizee.dto.controller;
 | 
			
		||||
 | 
			
		||||
import fr.organizee.model.Menu;
 | 
			
		||||
import fr.organizee.model.Team;
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package fr.organizee.controller;
 | 
			
		||||
package fr.organizee.dto.controller;
 | 
			
		||||
 | 
			
		||||
import fr.organizee.model.Tache;
 | 
			
		||||
import fr.organizee.model.TodoList;
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package fr.organizee.controller;
 | 
			
		||||
package fr.organizee.dto.controller;
 | 
			
		||||
 | 
			
		||||
import fr.organizee.model.Team;
 | 
			
		||||
import fr.organizee.repository.TeamRepository;
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package fr.organizee.controller;
 | 
			
		||||
package fr.organizee.dto.controller;
 | 
			
		||||
 | 
			
		||||
import fr.organizee.model.TodoList;
 | 
			
		||||
import fr.organizee.repository.TodoListRepository;
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue