1
1
package com .hoangtien2k3 .notificationservice .api ;
2
2
3
- import com .hoangtien2k3 .notificationservice .entity .EmailDetails ;
3
+ import com .hoangtien2k3 .notificationservice .dto .EmailDetails ;
4
4
import com .hoangtien2k3 .notificationservice .service .EmailService ;
5
5
import org .springframework .beans .factory .annotation .Autowired ;
6
6
import org .springframework .web .bind .annotation .*;
7
7
import org .springframework .web .multipart .MultipartFile ;
8
+ import reactor .core .publisher .Mono ;
8
9
9
10
@ RestController
10
11
@ RequestMapping ("/api/email" )
@@ -13,26 +14,23 @@ public class EmailController {
13
14
@ Autowired
14
15
private EmailService emailService ;
15
16
16
- // Sending a simple Email
17
- @ PostMapping ("/sendMail" )
18
- public String sendMail (@ RequestBody EmailDetails details ) {
17
+ @ PostMapping ("/sendSimpleMail" )
18
+ public Mono <String > sendSimpleMail (@ RequestBody EmailDetails details ) {
19
19
return emailService .sendSimpleMail (details );
20
20
}
21
21
22
- // Sending email with attachment
23
22
@ PostMapping ("/sendMailWithAttachment" )
24
- public String sendMailWithAttachment (@ RequestBody EmailDetails details ) {
23
+ public Mono < String > sendMailWithAttachment (@ RequestBody EmailDetails details ) {
25
24
return emailService .sendMailWithAttachment (details );
26
25
}
27
26
28
- @ PostMapping ("/send" )
29
- public String sendMail (@ RequestParam (value = "file" , required = false ) MultipartFile [] file ,
30
- String to ,
31
- String [] cc ,
32
- String subject ,
33
- String body ) {
34
-
35
- return emailService .sendMail (file , to , cc , subject , body );
27
+ @ PostMapping ("/sendMail" )
28
+ public Mono <String > sendMail (@ RequestParam (value = "file" , required = false ) MultipartFile [] files ,
29
+ @ RequestParam String to ,
30
+ @ RequestParam String [] cc ,
31
+ @ RequestParam String subject ,
32
+ @ RequestParam String body ) {
33
+ return emailService .sendMail (files , to , cc , subject , body );
36
34
}
37
35
38
36
}
0 commit comments