-
Notifications
You must be signed in to change notification settings - Fork 7
/
SignUpMemberController.java
42 lines (35 loc) · 1.74 KB
/
SignUpMemberController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.gaebaljip.exceed.adapter.in.member;
import javax.validation.Valid;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import com.gaebaljip.exceed.application.port.in.member.*;
import com.gaebaljip.exceed.common.ApiResponse;
import com.gaebaljip.exceed.common.ApiResponse.CustomBody;
import com.gaebaljip.exceed.common.ApiResponseGenerator;
import com.gaebaljip.exceed.common.docs.member.SignUpMemberExceptionDocs;
import com.gaebaljip.exceed.adapter.in.member.request.SignUpMemberRequest;
import com.gaebaljip.exceed.common.swagger.ApiErrorExceptionsExample;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
@RestController
@RequiredArgsConstructor
@RequestMapping("/v1")
@SecurityRequirement(name = "access-token")
@Tag(name = "[회원가입]")
public class SignUpMemberController {
private final ValidateEmailUsecase validateEmailUsecase;
private final SendEmailUsecase sendEmailUsecase;
private final CreateMemberUsecase createMemberUsecase;
@Operation(summary = "회원 가입", description = "회원 가입한다.")
@PostMapping("/members")
@ApiErrorExceptionsExample(SignUpMemberExceptionDocs.class)
public ApiResponse<CustomBody<Void>> signUpMember(
@RequestBody @Valid SignUpMemberRequest signUpMemberRequest) {
validateEmailUsecase.execute(new ValidateEmailCommand(signUpMemberRequest.email()));
sendEmailUsecase.execute(new SendEmailCommand(signUpMemberRequest.email()));
createMemberUsecase.execute(signUpMemberRequest);
return ApiResponseGenerator.success(HttpStatus.CREATED);
}
}