Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] 회원가입 및 프로필 수정 스펙 변경 #256

Merged
merged 6 commits into from
Mar 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#254 feat: 회원가입 프로필 처리 변경
  • Loading branch information
yonghwankim-dev committed Mar 5, 2024
commit 07fc49aeac998d42bf7041782394b8858d3ccbd6
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
@@ -84,8 +83,6 @@
public class MemberService {

private static final String LOCAL_PROVIDER = "local";
private static final String DEFAULT_PROFILE_NAME = "default.png";
private static final String DEFAULT_PROFILE_URL = "https://fineants.s3.ap-northeast-2.amazonaws.com/profile/default/default.png";
private final AuthorizationRequestManager authorizationRequestManager;
private final OauthClientRepository oauthClientRepository;
private final MemberRepository memberRepository;
@@ -228,8 +225,8 @@ public SignUpServiceResponse signup(SignUpServiceRequest request) {
verifyPassword(request.getPassword(), request.getPasswordConfirm());

// 프로필 이미지 파일 S3에 업로드
String profileUrl = DEFAULT_PROFILE_URL;
if (!Objects.equals(request.getProfileImageFile().getOriginalFilename(), DEFAULT_PROFILE_NAME)) {
String profileUrl = null;
if (!request.getProfileImageFile().isEmpty()) {
profileUrl = uploadProfileImageFile(request.getProfileImageFile());
}

Binary file removed src/main/resources/static/img/default.png
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -330,7 +330,7 @@ void signup() throws Exception {
.andExpect(jsonPath("message").value(equalTo("회원가입이 완료되었습니다")));
}

@DisplayName("사용자는 프로필을 건너뛰고 회원가입 할 수 있다")
@DisplayName("사용자는 기본 프로필 사진으로 회원가입 할 수 있다")
@Test
void signup_whenSkipProfileImageFile_then200OK() throws Exception {
// given
@@ -348,12 +348,7 @@ void signup_whenSkipProfileImageFile_then200OK() throws Exception {
"signupData",
MediaType.APPLICATION_JSON_VALUE,
json.getBytes(StandardCharsets.UTF_8));
MockMultipartFile profileImageFile = new MockMultipartFile(
"profileImageFile",
"static/img/default.png",
MediaType.MULTIPART_FORM_DATA_VALUE,
new ClassPathResource("static/img/default.png").getInputStream()
);
MockMultipartFile profileImageFile = (MockMultipartFile)createEmptyMockMultipartFile();
// when & then
mockMvc.perform(multipart(POST, "/api/auth/signup")
.file(signupData)
Original file line number Diff line number Diff line change
@@ -458,7 +458,7 @@ void signup_whenDefaultProfile_thenSaveDefaultProfileUrl() {
"nemo1234@",
"nemo1234@"
);
MultipartFile profileImageFile = createProfileFile();
MultipartFile profileImageFile = createEmptyProfileImageFile();
SignUpServiceRequest serviceRequest = SignUpServiceRequest.of(request, profileImageFile);

// when
@@ -467,8 +467,7 @@ void signup_whenDefaultProfile_thenSaveDefaultProfileUrl() {
// then
assertThat(response)
.extracting("nickname", "email", "profileUrl", "provider")
.containsExactlyInAnyOrder("일개미1234", "dragonbead95@naver.com",
"https://fineants.s3.ap-northeast-2.amazonaws.com/profile/default/default.png", "local");
.containsExactlyInAnyOrder("일개미1234", "dragonbead95@naver.com", null, "local");
}

@DisplayName("사용자는 닉네임이 중복되어 회원가입 할 수 없다")
@@ -490,7 +489,7 @@ void signup_whenDuplicatedNickname_thenResponse400Error() {

// then
assertThat(throwable)
.isInstanceOf(BadRequestException.class)
.isInstanceOf(FineAntsException.class)
.hasMessage(MemberErrorCode.REDUNDANT_NICKNAME.getMessage());
}