Skip to content

Commit

Permalink
Merge pull request #44 from Na-o-man/fix/#42/web-signup-fix
Browse files Browse the repository at this point in the history
[FIX] 회원가입 시 temp-member-info 값 전달 방식 변경 #42
  • Loading branch information
bflykky authored Aug 2, 2024
2 parents 445f22c + c17beaf commit 030d070
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,26 @@
import com.umc.naoman.domain.member.dto.MemberResponse.CheckMemberRegistration;
import com.umc.naoman.domain.member.dto.MemberResponse.LoginInfo;
import com.umc.naoman.domain.member.service.MemberService;
import com.umc.naoman.global.error.BusinessException;
import com.umc.naoman.global.result.ResultResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.Cookie;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Email;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import static com.umc.naoman.global.error.code.MemberErrorCode.TEMP_MEMBER_INFO_COOKIE_NOT_FOUND;
import static com.umc.naoman.global.result.code.MemberResultCode.*;

@RestController
Expand All @@ -35,12 +38,16 @@ public class AuthController {
@PostMapping("/signup/web")
@Operation(summary = "회원가입 API(웹)", description = "웹 클라이언트가 사용하는 회원가입 API입니다.")
@Parameters(value = {
@Parameter(name = "temp-member-info", description = "리다이렉션 시에 쿠키로 넘겨준 사용자 정보가 담긴 jwt를 헤더로 넘겨주세요.",
in = ParameterIn.HEADER)
@Parameter(name = "temp-member-info", description = "리다이렉션 시에 쿠키로 넘겨준 사용자 정보가 담긴 jwt가 "
+ "요청과 함께 쿠키로 넘어와야 합니다.", in = ParameterIn.COOKIE)
})
public ResultResponse<LoginInfo> signup(@RequestHeader("temp-member-info") String tempMemberInfo,
public ResultResponse<LoginInfo> signup(@CookieValue("temp-member-info") Cookie tempMemberInfoCookie,
@Valid @RequestBody MarketingAgreedRequest request) {
return ResultResponse.of(SIGNUP, memberService.signup(tempMemberInfo, request));
// 추후에 핸들러 처리로 바꿀까 생각 중
if (tempMemberInfoCookie == null) {
throw new BusinessException(TEMP_MEMBER_INFO_COOKIE_NOT_FOUND);
}
return ResultResponse.of(SIGNUP, memberService.signup(tempMemberInfoCookie.getValue(), request));
}

@PostMapping("/signup/android")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum MemberErrorCode implements ErrorCode {
REFRESH_TOKEN_NOT_FOUND(404, "EM000", "해당 refresh token이 존재하지 않습니다."),
INVALID_SOCIAL_TYPE(404, "EM000", "해당 socialType은 유효하지 않습니다."),
MEMBER_ALREADY_SIGNUP(400, "EM000", "해당 이메일을 가진 회원은 이미 회원가입하였습니다."),
TEMP_MEMBER_INFO_COOKIE_NOT_FOUND(404, "EM000", "회원가입에 사용할 temp-member-info 쿠키가 존재하지 않습니다."),

;

Expand Down

0 comments on commit 030d070

Please sign in to comment.