1
1
package com.sns.user.endpoints.user
2
2
3
+ import com.sns.user.component.authcode.application.AuthCodeCommand
4
+ import com.sns.user.component.authcode.domain.Purpose
5
+ import com.sns.user.core.config.SwaggerTag
3
6
import com.sns.user.endpoints.user.requests.SignUpRequest
4
- import com.sns.user.endpoints.user.responses.IdExistsCheckResponse
7
+ import io.swagger.v3.oas.annotations.media.Content
8
+ import io.swagger.v3.oas.annotations.media.Schema
9
+ import io.swagger.v3.oas.annotations.responses.ApiResponse
10
+ import io.swagger.v3.oas.annotations.tags.Tag
5
11
import javax.validation.constraints.Email
6
12
import org.springframework.http.HttpStatus
13
+ import org.springframework.http.ResponseEntity
7
14
import org.springframework.validation.annotation.Validated
8
15
import org.springframework.web.bind.annotation.GetMapping
9
16
import org.springframework.web.bind.annotation.PathVariable
@@ -16,31 +23,43 @@ import org.springframework.web.bind.annotation.RestController
16
23
17
24
@Validated
18
25
@RestController
26
+ @Tag(name = SwaggerTag .SIGN_UP )
19
27
@RequestMapping(" /api" )
20
- class SignUpController {
28
+ class SignUpController ( val authCodeCommand : AuthCodeCommand ) {
21
29
30
+ @ApiResponse(description = " 회원 가입" , responseCode = " 202" )
22
31
@ResponseStatus(HttpStatus .CREATED )
23
32
@PostMapping(" /v1/sign-up" )
24
33
fun signUp (@RequestBody request : SignUpRequest ) {
25
34
// TODO 패스워드 유효성 검증
26
35
}
27
36
37
+ @ApiResponse(
38
+ description = " 이메일 중복 검사" , responseCode = " 200" ,
39
+ content = [Content (schema = Schema (implementation = Boolean ::class ))],
40
+ )
28
41
@ResponseStatus(HttpStatus .OK )
29
42
@GetMapping(" /v1/sign-up/verifications/emails/{email}" )
30
- fun verifyEmail (@Email @PathVariable email : String ): IdExistsCheckResponse {
43
+ fun verifyEmail (@Email @PathVariable email : String ): ResponseEntity < Boolean > {
31
44
// TODO email 중복 검사
32
- return IdExistsCheckResponse (false )
45
+ return ResponseEntity .ok (false )
33
46
}
34
47
48
+ @ApiResponse(description = " 가입 인증 코드 재발송" , responseCode = " 202" )
35
49
@ResponseStatus(HttpStatus .CREATED )
36
- @PutMapping(" /v1/sign-up/verifications/ids/{userId}/auth-code " )
50
+ @PutMapping(" /v1/sign-up/verifications/auth-code/ ids/{userId}" )
37
51
fun createAuthenticationCode (@PathVariable userId : String ) {
38
- // TODO 인증번호 재발송
52
+
53
+ authCodeCommand.create(userId)
39
54
}
40
55
56
+ @ApiResponse(
57
+ description = " 가입 인증 코드 검사" , responseCode = " 200" ,
58
+ content = [Content (schema = Schema (implementation = Boolean ::class ))],
59
+ )
41
60
@ResponseStatus(HttpStatus .OK )
42
- @PostMapping(" /v1/sign-up/verifications/ids/{userId}/auth-code " )
43
- fun verifyAuthenticationCode (@PathVariable userId : String , @RequestBody code : String ) {
44
- // TODO 인증번호 검사
61
+ @PostMapping(" /v1/sign-up/verifications/auth-code/ ids/{userId}" )
62
+ fun verifyAuthenticationCode (@PathVariable userId : String , @RequestBody code : String ): ResponseEntity < Boolean > {
63
+ return ResponseEntity .ok(authCodeCommand.verify(userId, Purpose . SIGN_UP , code))
45
64
}
46
65
}
0 commit comments