From f25589727fdb482444d64b1120df517c6248e8cd Mon Sep 17 00:00:00 2001 From: 101 Date: Thu, 25 Jan 2024 15:13:05 +0900 Subject: [PATCH] =?UTF-8?q?controller=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/mail/api/MailController.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/main/java/com/example/daemawiki/domain/mail/api/MailController.java diff --git a/src/main/java/com/example/daemawiki/domain/mail/api/MailController.java b/src/main/java/com/example/daemawiki/domain/mail/api/MailController.java new file mode 100644 index 00000000..da25d69f --- /dev/null +++ b/src/main/java/com/example/daemawiki/domain/mail/api/MailController.java @@ -0,0 +1,39 @@ +package com.example.daemawiki.domain.mail.api; + +import com.example.daemawiki.domain.mail.dto.AuthCodeRequest; +import com.example.daemawiki.domain.mail.dto.AuthCodeVerifyRequest; +import com.example.daemawiki.domain.mail.service.MailSend; +import com.example.daemawiki.domain.mail.service.MailVerify; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import reactor.core.publisher.Mono; + +@RestController +@RequestMapping("/api/mail") +public class MailController { + private final MailSend mailSend; + private final MailVerify mailVerify; + + public MailController(MailSend mailSend, MailVerify mailVerify) { + this.mailSend = mailSend; + this.mailVerify = mailVerify; + } + + @PostMapping("/send") + public Mono send(@RequestBody AuthCodeRequest request) { + return mailSend.execute(request); + } + + @PostMapping("/verify") + public Mono verify(@RequestBody AuthCodeVerifyRequest request) { + return mailVerify.execute(request); + } + + @PostMapping("/reissue") + public Mono reissue(@RequestBody AuthCodeRequest request) { + return mailSend.reissue(request); + } + +}