|
1
|
|
|
package com.osomapps.pt.admin.email; |
|
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/email-message-template") |
|
16
|
|
|
class AdminEmailMessageTemplateResource { |
|
17
|
|
|
|
|
18
|
|
|
private final AdminEmailMessageTemplateService adminEmailMessageTemplateService; |
|
19
|
|
|
|
|
20
|
|
|
@Autowired |
|
21
|
|
|
AdminEmailMessageTemplateResource( |
|
22
|
|
|
AdminEmailMessageTemplateService adminEmailMessageTemplateService) { |
|
23
|
|
|
this.adminEmailMessageTemplateService = adminEmailMessageTemplateService; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
@GetMapping |
|
27
|
|
|
List<EmailMessageTemplateResponseDTO> findAll() { |
|
28
|
|
|
return adminEmailMessageTemplateService.findAll(); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
@GetMapping(value = "{id}") |
|
32
|
|
|
EmailMessageTemplateResponseDTO findOne(@PathVariable Long id) { |
|
33
|
|
|
return adminEmailMessageTemplateService.findOne(id); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
@PostMapping |
|
37
|
|
|
EmailMessageTemplateResponseDTO create( |
|
38
|
|
|
@RequestBody EmailMessageTemplateRequestDTO templateRequestDTO) { |
|
39
|
|
|
return adminEmailMessageTemplateService.create(templateRequestDTO); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
@PutMapping(value = "{id}") |
|
43
|
|
|
EmailMessageTemplateResponseDTO update( |
|
44
|
|
|
@PathVariable Long id, @RequestBody EmailMessageTemplateRequestDTO templateRequestDTO) { |
|
45
|
|
|
return adminEmailMessageTemplateService.update(id, templateRequestDTO); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
@DeleteMapping(value = "{id}") |
|
49
|
|
|
EmailMessageTemplateResponseDTO delete(@PathVariable Long id) { |
|
50
|
|
|
return adminEmailMessageTemplateService.delete(id); |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|