From 3e882e0173e4ef4a8a5018b53d80320dbcb62f0c Mon Sep 17 00:00:00 2001 From: jiiiiiw Date: Thu, 29 Feb 2024 16:06:49 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:=20feat:=20=EC=BB=A8=ED=8A=B8?= =?UTF-8?q?=EB=A1=A4=EB=9F=AC=20=EC=9E=91=EC=84=B1=20(#27)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AccountsController.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/main/java/com/smunity/petition/domain/account/controller/AccountsController.java diff --git a/src/main/java/com/smunity/petition/domain/account/controller/AccountsController.java b/src/main/java/com/smunity/petition/domain/account/controller/AccountsController.java new file mode 100644 index 0000000..34e8577 --- /dev/null +++ b/src/main/java/com/smunity/petition/domain/account/controller/AccountsController.java @@ -0,0 +1,33 @@ +package com.smunity.petition.domain.account.controller; + +import com.smunity.petition.domain.account.dto.UserLoginRequestDto; +import com.smunity.petition.domain.account.dto.UserLoginResponseDto; +import com.smunity.petition.domain.account.dto.UserSignupRequestDto; +import com.smunity.petition.domain.account.dto.UserSignupResponseDto; +import com.smunity.petition.domain.account.service.AccountsService; +import com.smunity.petition.global.common.ApiResponse; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +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; + +@Slf4j +@RequiredArgsConstructor +@RestController +@RequestMapping("/api/v1/accounts") +public class AccountsController { + private final AccountsService accountsService; + + @PostMapping("/login") + public ApiResponse login(@Valid @RequestBody UserLoginRequestDto requestDto) { + return ApiResponse.onSuccess(accountsService.login(requestDto)); + } + + @PostMapping("/signup") + public ApiResponse signup(@Valid @RequestBody UserSignupRequestDto requestDto) { + return ApiResponse.onSuccess(accountsService.signup(requestDto)); + } +}