1
|
|
|
package com.osomapps.pt.admin.ptuser; |
2
|
|
|
|
3
|
|
|
import java.util.List; |
4
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
5
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping; |
6
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
7
|
|
|
import org.springframework.web.bind.annotation.PathVariable; |
8
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
9
|
|
|
import org.springframework.web.bind.annotation.PutMapping; |
10
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
11
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
12
|
|
|
import org.springframework.web.bind.annotation.RestController; |
13
|
|
|
|
14
|
|
|
@RestController |
15
|
|
|
@RequestMapping("api/v1/admin/pt-user") |
16
|
|
|
class AdminPtUserResource { |
17
|
|
|
|
18
|
|
|
private final AdminPtUserService ptUserService; |
19
|
|
|
|
20
|
|
|
@Autowired |
21
|
|
|
AdminPtUserResource(AdminPtUserService ptUserService) { |
22
|
|
|
this.ptUserService = ptUserService; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
@GetMapping |
26
|
|
|
List<PtUserResponseDTO> findAll() { |
27
|
|
|
return ptUserService.findAll(); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
@GetMapping("{id}") |
31
|
|
|
PtUserResponseDTO findOne(@PathVariable Long id) { |
32
|
|
|
return ptUserService.findOne(id); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
@PostMapping |
36
|
|
|
PtUserResponseDTO create(@RequestBody PtUserRequestDTO ptUserRequestDTO) { |
37
|
|
|
return ptUserService.create(ptUserRequestDTO); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
@PutMapping("{id}") |
41
|
|
|
PtUserResponseDTO update( |
42
|
|
|
@PathVariable Long id, @RequestBody PtUserRequestDTO ptUserRequestDTO) { |
43
|
|
|
return ptUserService.update(id, ptUserRequestDTO); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
@DeleteMapping("{id}") |
47
|
|
|
PtUserResponseDTO delete(@PathVariable Long id) { |
48
|
|
|
return ptUserService.delete(id); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|