Blame view

src/main/java/fr/plil/sio/web/mvc/UserRestController.java 1.49 KB
d0481dcb   Julien Cartigny   Support for user ...
1
2
  package fr.plil.sio.web.mvc;
  
f9b4ae49   jcartign   Fix recursion in ...
3
  import org.springframework.web.bind.annotation.PathVariable;
d0481dcb   Julien Cartigny   Support for user ...
4
5
6
7
8
9
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RestController;
  
  import javax.annotation.Resource;
  import java.util.List;
353d9d4f   Zak   désactivation des...
10
  import org.springframework.web.bind.annotation.RequestParam;
d0481dcb   Julien Cartigny   Support for user ...
11
12
13
14
15
16
17
  
  @RestController
  public class UserRestController {
  
      @Resource
      private UserService userService;
  
f9b4ae49   jcartign   Fix recursion in ...
18
      @RequestMapping(value = "/api/users/", method = RequestMethod.GET)
d0481dcb   Julien Cartigny   Support for user ...
19
20
21
      public List<User> listUsers() {
          return userService.findAll();
      }
f9b4ae49   jcartign   Fix recursion in ...
22
23
24
25
26
  
      @RequestMapping(value = "/api/users/{username}/", method = RequestMethod.GET)
      public User listUsers(@PathVariable String username) {
          return userService.findByUsername(username);
      }
353d9d4f   Zak   désactivation des...
27
  
716532ee   Zak   Modifications des...
28
29
30
      @RequestMapping(value = "/api/debts/", method = RequestMethod.GET)
      public List<Dette> listDettes() {        
          return userService.findDettes();
353d9d4f   Zak   désactivation des...
31
32
33
      }
  
      @RequestMapping(value = "/api/addDette/", method = RequestMethod.POST)
716532ee   Zak   Modifications des...
34
      public Dette addDette(@RequestParam(value="username",required=false) String username,@RequestParam(value="sommeDette",required=false) String sommeDette) {
353d9d4f   Zak   désactivation des...
35
36
          return userService.addDette(username,sommeDette);
      }
8a362652   Zak   Ajout css, js et ...
37
38
39
40
41
42
      
      @RequestMapping(value="/api/deleteDette/{id}",method=RequestMethod.DELETE)
      public String deleteDette(@PathVariable("id") String id){
          return userService.deleteDette(id);
      }
      
353d9d4f   Zak   désactivation des...
43
44
  
  }