Skip to content

Conversation

@sungchaewon
Copy link
Member

@sungchaewon sungchaewon commented Jun 5, 2025

…기본 소개글로 반환하는 방향으로 통일

이슈 번호

#52
close #52

작업 내용

  • 디폴트 이미지 및 소개글은 는 db에 null로 저장하고 프론트한테는 기본 이미지 링크나 기본 소개글로 반환하는 방향으로 통일
  • 닉네임, 비밀번호, 프로필 사진, 소개글 수정 기능 구현

기타

Summary by CodeRabbit

  • 신규 기능
    • 회원 탈퇴 시 비밀번호 확인 절차가 추가되었습니다.
    • 기본 프로필 이미지 및 기본 자기소개 문구가 제공됩니다.
  • 버그 수정
    • 로그인 및 회원 정보 조회 시 프로필 이미지와 자기소개가 없을 경우 기본값이 자동으로 적용됩니다.
  • 기능 변경
    • 사용자가 좋아요한 게시글 목록 조회 기능이 제거되었습니다.
    • 회원 가입 시 기본 프로필 이미지는 더 이상 서버에서 저장하지 않으며, 프론트엔드에서 기본 이미지를 처리합니다.
  • 환경 설정
    • 데이터베이스가 MySQL에서 H2로 변경되었습니다.

@sungchaewon sungchaewon self-assigned this Jun 5, 2025
@sungchaewon sungchaewon added the del 쓸모없는 코드나 파일 삭제 label Jun 5, 2025
@sungchaewon sungchaewon linked an issue Jun 5, 2025 that may be closed by this pull request
5 tasks
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 5, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

이번 변경에서는 회원 탈퇴 시 비밀번호 확인 절차가 추가되었고, 기본 프로필 이미지 및 소개글에 대한 기본값 제공이 DTO 레이어에서 처리되도록 리팩토링되었습니다. 또한, 사용자가 좋아요한 게시글 조회 기능이 제거되었으며, 데이터베이스 설정이 MySQL에서 H2로 전환되었습니다.

Changes

파일/경로 그룹 변경 요약
.../FixLogApplication.java @EnableJpaAuditing 애노테이션 추가 및 관련 import로 JPA 감사 기능 활성화
.../controller/MemberController.java
.../service/MemberService.java
.../dto/WithdrawRequestDto.java
회원 탈퇴 시 비밀번호 입력을 위한 DTO 도입 및 withdraw 메서드 시그니처 변경, 비밀번호 검증 로직 추가
.../controller/MypagePostController.java
.../service/MypagePostService.java
좋아요한 게시글 조회 API 및 관련 서비스/리포지토리 코드 주석 처리 및 삭제
.../domain/member/Member.java
.../service/AuthService.java
.../service/MemberService.java
회원 생성 시 프로필 이미지 URL을 null로 저장, 기본 프로필 이미지는 프론트엔드 또는 DTO에서 처리하도록 변경
.../dto/member/LoginResponseDto.java
.../dto/member/MemberInfoResponseDto.java
기본 프로필 이미지 및 소개글을 DTO의 static factory method에서 처리하도록 리팩토링 및 메서드 추가
.../util/DefaultImage.java
.../util/DefaultText.java
기본 프로필 이미지 URL, 기본 소개글 상수 제공을 위한 유틸리티 클래스 추가
.../resources/application.properties H2 DB 설정 활성화, MySQL 설정 주석 처리, 개발 환경 데이터베이스를 H2로 전환

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller
    participant Service
    participant Repository

    Client->>Controller: 회원 탈퇴 요청(비밀번호 포함)
    Controller->>Service: withdraw(member, password)
    Service->>Repository: 회원 정보 조회
    Service->>Service: 비밀번호 일치 여부 확인
    alt 비밀번호 불일치
        Service-->>Controller: 예외 발생(INVALID_PASSWORD)
    else 비밀번호 일치
        Service->>Repository: 회원 탈퇴 처리(isDeleted=true)
        Service-->>Controller: 성공 응답
    end
    Controller-->>Client: 탈퇴 결과 반환
Loading
sequenceDiagram
    participant Service
    participant DTO

    Service->>DTO: LoginResponseDto.from(member, token)
    DTO->>DTO: 프로필 이미지 URL null 체크 및 기본값 대입
    DTO-->>Service: LoginResponseDto 반환
Loading

Suggested labels

youngseo

Poem

🐇
오늘도 코드가 바뀌었네,
탈퇴엔 비밀번호 꼭 확인해!
기본 이미지는 DTO에서 척척,
좋아요 목록은 이제 안녕~
H2로 바뀐 개발의 봄,
에러 없는 하루, 우리 모두의 소망!
🌱


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sungchaewon sungchaewon changed the base branch from main to develop June 5, 2025 07:39
@sungchaewon sungchaewon changed the title [FEAT] 회원 정보 수정 [FEAT] 회원 정보 수정 #52 Jun 5, 2025
coderabbitai[bot]
coderabbitai bot previously requested changes Jun 5, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🔭 Outside diff range comments (1)
src/main/java/com/example/FixLog/controller/MemberController.java (1)

44-50: 🛠️ Refactor suggestion

일관성을 위해 팩토리 메서드 사용을 권장합니다.

MemberInfoResponseDto.from(member) 팩토리 메서드를 사용하지 않고 있어 기본값 처리 로직이 중복됩니다. 새로 추가된 팩토리 메서드를 사용하여 일관성을 유지하세요.

다음과 같이 수정하는 것을 권장합니다:

-MemberInfoResponseDto responseDto = new MemberInfoResponseDto(
-        member.getEmail(),
-        member.getNickname(),
-        member.getProfileImageUrl(),
-        member.getBio(),
-        member.getSocialType()
-);
+MemberInfoResponseDto responseDto = MemberInfoResponseDto.from(member);
🧹 Nitpick comments (6)
src/main/java/com/example/FixLog/util/DefaultText.java (1)

3-5: 유틸 클래스 개선 제안: 인스턴스화 방지
DefaultText는 상수만을 보유하는 유틸리티 클래스입니다. 인스턴스 생성을 막기 위해 final 선언과 private 생성자를 추가하는 것이 좋습니다.

src/main/java/com/example/FixLog/util/DefaultImage.java (1)

3-5: 유틸 클래스 개선 제안: 인스턴스화 방지
DefaultImage 역시 상수 전용 클래스이므로 final 선언 및 private 생성자 추가로 인스턴스 생성 방지를 권장합니다.

src/main/resources/application.properties (1)

21-30: 프로파일별 설정 분리 권장
MySQL 설정을 주석 처리하는 대신 Spring 프로파일(application-dev.properties, application-h2.properties)을 활용해 환경별 설정을 분리 관리하면 유지보수가 수월해집니다.

src/main/java/com/example/FixLog/FixLogApplication.java (1)

7-8: 주석 정리 제안
//Create_At 어노테이션 주석은 모호하므로 삭제하거나 보다 명확한 설명으로 교체하는 것이 좋습니다.

src/main/java/com/example/FixLog/controller/MypagePostController.java (1)

36-47: 좋아요 기능 완전 제거를 권장합니다.

현재 코드가 주석 처리되어 있어 기능이 비활성화되었습니다. 이 기능을 완전히 제거할 계획이라면 주석 처리된 코드를 삭제하는 것이 좋겠습니다.

다음 diff를 적용하여 주석 처리된 코드를 완전히 제거하세요:

-//    // 내가 좋아요한 글
-//    @GetMapping("/likes")
-//    public ResponseEntity<Response<PageResponseDto<MyPostPageResponseDto>>> getLikedPosts(
-//            @AuthenticationPrincipal UserDetails userDetails,
-//            @RequestParam(defaultValue = "0") int page,
-//            @RequestParam(defaultValue = "4") int size,
-//            @RequestParam(defaultValue = "0") int sort) {
-//
-//        String email = userDetails.getUsername();
-//        PageResponseDto<MyPostPageResponseDto> result = mypagePostService.getLikedPosts(email, page, sort, size);
-//        return ResponseEntity.ok(Response.success("내가 좋아요한 글 보기 성공", result));
-//    }
src/main/java/com/example/FixLog/dto/WithdrawRequestDto.java (1)

5-8: 비밀번호 필드에 대한 validation 추가를 권장합니다.

회원 탈퇴 시 비밀번호 확인용 DTO가 올바르게 구현되었습니다. 보안 강화를 위해 validation 어노테이션 추가를 고려해보세요.

다음과 같이 validation을 추가할 수 있습니다:

 package com.example.FixLog.dto;
 
 import lombok.Getter;
+import jakarta.validation.constraints.NotBlank;
 
 @Getter
 public class WithdrawRequestDto {
+    @NotBlank(message = "비밀번호는 필수입니다")
     private String password;
 }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c220d4b and 2e413c7.

📒 Files selected for processing (13)
  • src/main/java/com/example/FixLog/FixLogApplication.java (1 hunks)
  • src/main/java/com/example/FixLog/controller/MemberController.java (2 hunks)
  • src/main/java/com/example/FixLog/controller/MypagePostController.java (1 hunks)
  • src/main/java/com/example/FixLog/domain/member/Member.java (2 hunks)
  • src/main/java/com/example/FixLog/dto/WithdrawRequestDto.java (1 hunks)
  • src/main/java/com/example/FixLog/dto/member/LoginResponseDto.java (2 hunks)
  • src/main/java/com/example/FixLog/dto/member/MemberInfoResponseDto.java (2 hunks)
  • src/main/java/com/example/FixLog/service/AuthService.java (1 hunks)
  • src/main/java/com/example/FixLog/service/MemberService.java (2 hunks)
  • src/main/java/com/example/FixLog/service/MypagePostService.java (1 hunks)
  • src/main/java/com/example/FixLog/util/DefaultImage.java (1 hunks)
  • src/main/java/com/example/FixLog/util/DefaultText.java (1 hunks)
  • src/main/resources/application.properties (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
src/main/java/com/example/FixLog/dto/WithdrawRequestDto.java (1)
src/main/java/com/example/FixLog/dto/member/MemberInfoResponseDto.java (1)
  • Getter (10-32)
src/main/java/com/example/FixLog/dto/member/MemberInfoResponseDto.java (2)
src/main/java/com/example/FixLog/util/DefaultImage.java (1)
  • DefaultImage (3-5)
src/main/java/com/example/FixLog/util/DefaultText.java (1)
  • DefaultText (3-5)
src/main/java/com/example/FixLog/dto/member/LoginResponseDto.java (1)
src/main/java/com/example/FixLog/util/DefaultImage.java (1)
  • DefaultImage (3-5)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (12)
src/main/java/com/example/FixLog/FixLogApplication.java (1)

5-6: JPA Auditing 활성화
@EnableJpaAuditing import와 애노테이션 추가가 적절하며, 엔티티 생성·수정 시각 자동 관리가 활성화됩니다.

src/main/java/com/example/FixLog/service/MypagePostService.java (1)

29-33: 의존성 주입 정비 확인
PostLikeRepository 제거 후 PostRepository, MemberRepository, ForkRepository만 주입하도록 변경된 것이 적절합니다. 전체 로직에서 올바르게 사용되고 있어 문제 없습니다.

src/main/java/com/example/FixLog/domain/member/Member.java (2)

60-61: 주석 업데이트가 적절합니다.

주석이 변경된 로직을 정확하게 반영하고 있습니다.


87-87: 기본 이미지 처리 로직 개선이 잘 이루어졌습니다.

도메인 객체에서 null로 저장하고 DTO 레이어에서 기본값을 처리하는 방식은 관심사 분리 원칙에 잘 부합합니다. 주석도 변경 의도를 명확하게 설명하고 있습니다.

src/main/java/com/example/FixLog/service/AuthService.java (1)

32-33: 정적 팩토리 메소드를 사용한 리팩토링이 적절합니다.

기존의 인라인 null 체크와 수동 DTO 생성을 정적 팩토리 메소드로 대체하여 코드가 더 깔끔해졌습니다. 기본 이미지 처리 로직이 DTO 레이어로 적절히 캡슐화되었습니다.

src/main/java/com/example/FixLog/dto/member/LoginResponseDto.java (2)

3-4: 필요한 import가 적절히 추가되었습니다.

새로운 정적 팩토리 메소드를 위해 Member와 DefaultImage import가 올바르게 추가되었습니다.


18-28: 정적 팩토리 메소드가 잘 구현되었습니다.

from 메소드가 올바른 팩토리 메소드 패턴을 따르고 있으며, null 체크와 기본 이미지 처리 로직이 적절히 캡슐화되어 있습니다. 이로써 AuthService의 코드 중복이 제거되고 관심사가 적절히 분리되었습니다.

src/main/java/com/example/FixLog/dto/member/MemberInfoResponseDto.java (1)

3-6: 새로운 의존성 추가가 적절합니다.

Member 도메인과 유틸리티 클래스들의 import가 정확하게 추가되었습니다.

src/main/java/com/example/FixLog/service/MemberService.java (2)

36-45: 프로필 이미지 기본값 처리 방식 개선이 적절합니다.

profileImageUrl을 null로 설정하여 DTO 레이어에서 기본값을 처리하도록 하는 접근 방식이 좋습니다. 관심사의 분리가 잘 이루어졌습니다.


69-76: 비밀번호 검증 로직이 보안상 안전합니다.

회원 탈퇴 전 비밀번호 확인 절차가 적절하게 구현되었습니다. Spring Security의 PasswordEncoder를 사용한 비밀번호 검증과 적절한 예외 처리가 포함되어 있습니다.

src/main/java/com/example/FixLog/controller/MemberController.java (2)

5-5: 새로운 DTO import가 적절합니다.

WithdrawRequestDto import가 정확하게 추가되었습니다.


55-61: 회원 탈퇴 API가 보안 요구사항을 충족합니다.

비밀번호를 포함한 요청 DTO를 받아 서비스 계층에 전달하는 구조가 적절합니다. REST API 설계 원칙을 잘 따르고 있습니다.

Comment on lines 2 to 14
# DB setting
spring.h2.console.enabled=true
''spring.h2.console.path=/h2-console

//# DataBase Info
//spring.datasource.url=jdbc:h2:tcp://localhost/~/fixlog
//spring.datasource.driver-class-name=org.h2.Driver
//spring.datasource.username=sa
//spring.datasource.password=
# DataBase Info
spring.datasource.url=jdbc:h2:tcp://localhost/~/fixlog
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=

//spring.jpa.show-sql=true
//spring.jpa.hibernate.ddl-auto=update
//spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

구성 오류: H2 콘솔 경로 설정 구문 오류
''spring.h2.console.path=/h2-console에 불필요한 작은따옴표('')가 포함되어 있어 적용되지 않습니다. 아래와 같이 오탈자를 수정해야 합니다.

- ''spring.h2.console.path=/h2-console
+ spring.h2.console.path=/h2-console
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# DB setting
spring.h2.console.enabled=true
''spring.h2.console.path=/h2-console
//# DataBase Info
//spring.datasource.url=jdbc:h2:tcp://localhost/~/fixlog
//spring.datasource.driver-class-name=org.h2.Driver
//spring.datasource.username=sa
//spring.datasource.password=
# DataBase Info
spring.datasource.url=jdbc:h2:tcp://localhost/~/fixlog
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
//spring.jpa.show-sql=true
//spring.jpa.hibernate.ddl-auto=update
//spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
# DB setting
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
# DataBase Info
spring.datasource.url=jdbc:h2:tcp://localhost/~/fixlog
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
🤖 Prompt for AI Agents
In src/main/resources/application.properties around lines 2 to 14, the H2
console path setting has incorrect syntax due to unnecessary single quotes
before the property key. Remove the leading two single quotes from the line
`''spring.h2.console.path=/h2-console` so it reads
`spring.h2.console.path=/h2-console` to fix the configuration error.

Comment on lines 19 to 31
public static MemberInfoResponseDto from(Member member) {
return new MemberInfoResponseDto(
member.getEmail(),
member.getNickname(),
member.getProfileImageUrl() != null
? member.getProfileImageUrl()
: DefaultImage.PROFILE,
member.getBio() != null
? member.getBio()
: DefaultText.BIO,
member.getSocialType()
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

팩토리 메서드 구현이 우수합니다.

null 값에 대한 기본값 처리가 올바르게 구현되었고, 유틸리티 상수를 사용하여 일관성을 유지하고 있습니다. 정적 팩토리 메서드 패턴을 잘 활용했습니다.

컨트롤러에서 팩토리 메서드 사용을 권장합니다.

MemberController.getMyInfo 메서드에서 이 새로운 팩토리 메서드를 사용하지 않고 있어 일관성이 부족합니다. 기본값 처리 로직의 중복을 피하기 위해 팩토리 메서드 사용을 고려해보세요.

다음과 같이 수정을 제안합니다:

// MemberController.java의 getMyInfo 메서드에서
-MemberInfoResponseDto responseDto = new MemberInfoResponseDto(
-        member.getEmail(),
-        member.getNickname(),
-        member.getProfileImageUrl(),
-        member.getBio(),
-        member.getSocialType()
-);
+MemberInfoResponseDto responseDto = MemberInfoResponseDto.from(member);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public static MemberInfoResponseDto from(Member member) {
return new MemberInfoResponseDto(
member.getEmail(),
member.getNickname(),
member.getProfileImageUrl() != null
? member.getProfileImageUrl()
: DefaultImage.PROFILE,
member.getBio() != null
? member.getBio()
: DefaultText.BIO,
member.getSocialType()
);
}
// In MemberController.java, inside getMyInfo():
MemberInfoResponseDto responseDto = MemberInfoResponseDto.from(member);
🤖 Prompt for AI Agents
In src/main/java/com/example/FixLog/dto/member/MemberInfoResponseDto.java lines
19 to 31, the static factory method correctly handles null values with default
constants. To fix the issue, update the MemberController.getMyInfo method to use
this factory method when creating MemberInfoResponseDto instances. This will
ensure consistent default value handling and avoid duplication of null checks
across the codebase.

Comment on lines 23 to 28
member.getProfileImageUrl() != null
? member.getProfileImageUrl()
: DefaultImage.PROFILE,
member.getBio() != null
? member.getBio()
: DefaultText.BIO,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분들은 서비스단에서 처리하는 게 더 좋지 않을까요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

말씀 주신 부분을 반영하여 해당 처리는 서비스 단에서 담당하도록 변경했습니다.
확인 부탁드립니다! :)

Comment on lines 37 to 40
@AuthenticationPrincipal UserDetails userDetails,
@RequestBody EditPasswordRequestDto requestDto
) {
Member member = memberService.getCurrentMemberInfo();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AuthenticationPrincipal UserDetails userDetails 이거랑 Member member = memberService.getCurrentMemberInfo(); 이거는 둘 중에 하나만 사용해도 되지 않나요?
저는 매개변수에 @AuthenticationPrincipal 사용은 안하고 서비스 단에서 member 객체 불러와서 사용하도록 했거든요!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 인증 관련 처리를 컨트롤러에서 분리하고자 @AuthenticationPrincipal은 사용하지 않고, 서비스 단에서 SecurityContextHolder를 활용해 getCurrentMemberInfo()로 인증된 회원 정보를 가져오도록 통일했습니다. 확인 부탁드립니다!!

import lombok.Setter;

@Getter
@Setter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setter는 객체 상태를 너무 쉽게 바꿀 수 있어서 setter 사용하면 불변성 유지가 어렵다고 알고있어요!
Setter 사용은 정말 꼭 필요하지 않으면 지양하는 게 좋다고 알고있는데, 혹시 다른 있으면 말씀해주세요!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 필드에 대한 변경은 명시적인 메서드를 통해 처리하도록 Setter를 제거하고 로직을 수정했습니다! 확인 부탁드립니다~

@semsemin semsemin self-requested a review June 10, 2025 08:11
@sungchaewon sungchaewon requested review from semsemin and youngseo22 and removed request for semsemin and youngseo22 June 11, 2025 06:18
@sungchaewon sungchaewon requested a review from youngseo22 June 11, 2025 06:34
@sungchaewon sungchaewon changed the title [FEAT] 회원 정보 수정 #52 [FEAT] 회원 정보 수정 Jun 11, 2025
@FixLog FixLog deleted a comment from coderabbitai bot Jun 12, 2025
@sungchaewon
Copy link
Member Author

@CodeRabbit review this PR with full context

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 12, 2025

Tip

For best results, initiate chat on the files or code changes.

@sungchaewon Below is a comprehensive review of PR #63 based on the full context provided. I focused on correctness, security, future maintainability, and consistency with existing conventions.

────────────────────────
High-level Assessment
────────────────────────
• 👍 Adds password verification on withdrawal – good security hardening.
• 👍 Centralises default profile-image / bio handling in DTOs – keeps service layer clean.
• 👍 Enables JPA Auditing via @EnableJpaAuditing.
⚠️ Removal of “liked-posts” feature deletes service/endpoint but call-sites were not yet removed (see Findings 1).
⚠️ Switching dev DB from MySQL→H2 is useful locally but make sure prod profile still uses MySQL (Findings 4).
⚠️ profileImageUrl = null now persisted; ensure FE really shows placeholder everywhere (signup, login, member-info).
• ❓ H2 URL uses mem:testdb – data lost on server restart; is that intentional?

────────────────────────
Key Findings & Suggestions
────────────────────────

  1. Broken references after removing “liked-posts”
    PostLikeRepository & getLikedPosts were deleted, but src/test and possibly FE swagger docs may still reference them.
    • Run a compile or search to ensure nothing still imports them.

  2. Password verification – Encoder mismatch risk
    • In MemberService.withdraw, you compare raw password with member.getPassword() via passwordEncoder.matches(). Good.
    • Ensure the same encoder bean is used in signup (looks okay via passwordEncoder.encode).

  3. DTO factory methods
    • Nice to push default handling into LoginResponseDto.from & MemberInfoResponseDto.from.
    • Consider marking constructors private to force callers to use from, preventing bypass.

  4. Profile switching
    application.properties now hard-codes H2 and comments out MySQL. Add application-dev.properties vs application-prod.properties with Spring profile activation to avoid accidental prod H2 use.

  5. Validation
    WithdrawRequestDto lacks validation annotations (@NotBlank, @Size(min=8), etc.). Add these plus @Validated on controller for robust checks.

  6. Consistency – default text
    DefaultText.BIO is Korean. All messages/constants should follow i18n strategy; otherwise document decision.

  7. Auditing
    • Ensure entity base class has @CreatedDate, @LastModifiedDate fields to leverage newly enabled auditing.

  8. Tests
    • No unit / integration tests added for new password-check path. Prefer:
    – Service test asserting INVALID_PASSWORD thrown.
    – Controller slice test verifying 400/401 response.

────────────────────────
API Compatibility Matrix
────────────────────────

flowchart LR
A["MemberController.withdraw"] -->|old| S1["Service.withdraw(member)"]
A2["MemberController.withdraw"] -->|new| S2["Service.withdraw(member,password)"]
S2 -->|throws| E["INVALID_PASSWORD"]
Loading

Any client must now supply JSON body:

{ "password": "string" }

Update API docs & FE.

────────────────────────
Minor / Style
────────────────────────
DefaultImage / DefaultText could be enum if future keys grow.
• Remove commented code instead of keeping large blocks. Git retains history.

────────────────────────
Action Items Checklist
────────────────────────

  • Delete remaining imports/usages of removed liked-posts code.
  • Add validation annotations to WithdrawRequestDto.
  • Split DB configs by Spring profiles.
  • Add tests for withdrawal happy-/error-paths.
  • Update OpenAPI/Swagger docs and FE requests.

Let me know if you’d like code snippets or follow-up issues created for any point. Great progress overall!

@sungchaewon sungchaewon merged commit 6d604ed into develop Jun 15, 2025
1 check passed
@sungchaewon sungchaewon deleted the feature/#52-editUserProfile-cw branch June 15, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

del 쓸모없는 코드나 파일 삭제

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] 회원정보 수정

4 participants