1616import io .swagger .v3 .oas .annotations .Operation ;
1717import jakarta .mail .MessagingException ;
1818import jakarta .servlet .http .HttpServletRequest ;
19+ import jakarta .validation .Valid ;
1920import lombok .RequiredArgsConstructor ;
2021import org .springframework .web .bind .annotation .DeleteMapping ;
2122import org .springframework .web .bind .annotation .GetMapping ;
2223import org .springframework .web .bind .annotation .PatchMapping ;
2324import org .springframework .web .bind .annotation .PostMapping ;
2425import org .springframework .web .bind .annotation .RequestBody ;
2526import org .springframework .web .bind .annotation .RequestHeader ;
27+ import org .springframework .web .bind .annotation .RequestMapping ;
2628import org .springframework .web .bind .annotation .RequestParam ;
2729import org .springframework .web .bind .annotation .RestController ;
2830
2931@ RequiredArgsConstructor
3032@ RestController
33+ @ RequestMapping ("/api/v1" )
3134public class MemberController {
3235
3336 private final MemberService memberService ;
3437 private final JwtTokenProvider jwtTokenProvider ;
3538
3639 @ Operation (summary = "회원가입 API" , description = "이메일, 로그인 타입, 비밀번호, 닉네임을 저장해 회원가입하는 API" )
37- @ PostMapping ("/api/v1/ register/general" )
38- public ApiResponse <Void > register (@ RequestBody RegisterDto registerDto ) {
40+ @ PostMapping ("/register/general" )
41+ public ApiResponse <Void > register (@ Valid @ RequestBody RegisterDto registerDto ) {
3942 memberService .register (registerDto );
4043 return ApiResponse .onSuccess (null );
4144 }
4245
4346 @ Operation (summary = "회원가입 API" , description = "이메일, 로그인 타입, 비밀번호, 닉네임을 저장해 회원가입하는 API" )
44- @ PostMapping ("/api/v1/ register/social" )
45- public ApiResponse <Void > registerSocial (@ RequestBody SocialRegisterDto socialRegisterDto ) {
47+ @ PostMapping ("/register/social" )
48+ public ApiResponse <Void > registerSocial (@ Valid @ RequestBody SocialRegisterDto socialRegisterDto ) {
4649 memberService .register (socialRegisterDto );
4750 return ApiResponse .onSuccess (null );
4851 }
4952
5053 @ Operation (summary = "이메일 중복체크 API" , description = "이메일이 이미 가입되어 있는지 조회하는 API" )
51- @ GetMapping ("/api/v1/ register/general/check" )
54+ @ GetMapping ("/register/general/check" )
5255 public ApiResponse <EmailValidationResponseDto > checkRegister (@ RequestParam String email ) {
5356 EmailValidationResponseDto emailValidationResponseDto = memberService .validateDuplicate (email );
5457 return ApiResponse .onSuccess (emailValidationResponseDto );
5558 }
5659
5760 @ Operation (summary = "일반 로그인 API" , description = "이메일, 비밀번호를 입력하여 토큰을 생성하는 API" )
58- @ PostMapping ("/api/v1/ login/general" )
61+ @ PostMapping ("/login/general" )
5962 public ApiResponse <LoginResponseDto > login (@ RequestBody LoginRequestDto loginDto ) {
6063 String email = loginDto .getEmail ();
6164 String password = loginDto .getPassword ();
@@ -64,15 +67,15 @@ public ApiResponse<LoginResponseDto> login(@RequestBody LoginRequestDto loginDto
6467 }
6568
6669 @ Operation (summary = "로그아웃 API" , description = "리프레시토큰을 파괴하는 API" )
67- @ DeleteMapping ("/api/v1/ logout" )
70+ @ DeleteMapping ("/logout" )
6871 public ApiResponse <Void > logout (HttpServletRequest request ) {
6972 String token = jwtTokenProvider .resolveToken (request ).getAccessToken ();
7073 memberService .logout (token );
7174 return ApiResponse .onSuccess (null );
7275 }
7376
7477 @ Operation (summary = "토큰 재발급 API" , description = "리프레시토큰과 액세스 토큰을 재발급하는 API" )
75- @ GetMapping ("/api/v1/ reissue" )
78+ @ GetMapping ("/reissue" )
7679 public ApiResponse <JwtTokenDto > reissue (HttpServletRequest request ) {
7780 JwtTokenDto token = jwtTokenProvider .resolveToken (request );
7881 String email = jwtTokenProvider .getEmail (token .getRefreshToken ());
@@ -81,15 +84,15 @@ public ApiResponse<JwtTokenDto> reissue(HttpServletRequest request) {
8184 }
8285
8386 @ Operation (summary = "비밀번호 재발송 API" , description = "비밃번호를 재생성해서 유저에게 메일 발송하는 API" )
84- @ PatchMapping ("/api/v1/ login/temp-pw" )
87+ @ PatchMapping ("/login/temp-pw" )
8588 public ApiResponse <Void > tempPw (@ RequestBody PasswordReissueDto passwordReissueDto )
8689 throws MessagingException {
8790 memberService .tempPw (passwordReissueDto .getEmail ());
8891 return ApiResponse .onSuccess (null );
8992 }
9093
9194 @ Operation (summary = "메인화면 API" , description = "닉네임, 비행기 유무, 편지 알림여부를 보내는 API" )
92- @ GetMapping ("/api/v1/ main" )
95+ @ GetMapping ("/main" )
9396 public ApiResponse <MainDto > main (HttpServletRequest request ) {
9497 JwtTokenDto token = jwtTokenProvider .resolveToken (request );
9598 String email = jwtTokenProvider .getEmail (token .getAccessToken ());
@@ -98,7 +101,7 @@ public ApiResponse<MainDto> main(HttpServletRequest request) {
98101 }
99102
100103 @ Operation (summary = "새 편지 알림 끄기 API" , description = "새 편지 알림을 끄는 API" )
101- @ PatchMapping ("/api/v1/ main/update-mail-alert" )
104+ @ PatchMapping ("/main/update-mail-alert" )
102105 public ApiResponse <Void > turnOffMailAlert (HttpServletRequest request , @ RequestBody String mailAlert ) {
103106 JwtTokenDto token = jwtTokenProvider .resolveToken (request );
104107 String email = jwtTokenProvider .getEmail (token .getAccessToken ());
@@ -107,7 +110,7 @@ public ApiResponse<Void> turnOffMailAlert(HttpServletRequest request, @RequestBo
107110 }
108111
109112 @ Operation (summary = "닉네임 변경 API" , description = "닉네임을 변경하는 API" )
110- @ PatchMapping ("/api/v1/ setting/nickname" )
113+ @ PatchMapping ("/setting/nickname" )
111114 public ApiResponse <Void > changeNickname (HttpServletRequest request , @ RequestBody
112115 NicknameChangeDto nicknameChangeDto ) {
113116 JwtTokenDto token = jwtTokenProvider .resolveToken (request );
@@ -117,7 +120,7 @@ public ApiResponse<Void> changeNickname(HttpServletRequest request, @RequestBody
117120 }
118121
119122 @ Operation (summary = "비밀번호 변경 API" , description = "비밀번호를 변경하는 API" )
120- @ PatchMapping ("/api/v1/ setting/password" )
123+ @ PatchMapping ("/setting/password" )
121124 public ApiResponse <Void > changePassword (HttpServletRequest request , @ RequestBody
122125 PasswordChangeDto passwordChangeDto ) {
123126 JwtTokenDto token = jwtTokenProvider .resolveToken (request );
@@ -127,7 +130,7 @@ public ApiResponse<Void> changePassword(HttpServletRequest request, @RequestBody
127130 }
128131
129132 @ Operation (summary = "회원 탈퇴 API" , description = "상태를 비활성화로 바꾸고 날짜를 저장하는 API" )
130- @ PatchMapping ("/api/v1/ setting/delete-account" )
133+ @ PatchMapping ("/setting/delete-account" )
131134 public ApiResponse <Void > deleteAccount (HttpServletRequest request ) {
132135 JwtTokenDto token = jwtTokenProvider .resolveToken (request );
133136 String email = jwtTokenProvider .getEmail (token .getAccessToken ());
0 commit comments