Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
#️⃣ 연관된 이슈
📝 작업 내용
## 프로필 이미지 업로드 및 삭제
프로필 이미지 업로드 및 삭제 기능을 구현했습니다.
회원 가입시에도 이미지 업로드를 진행할 수 있기에 signUp api에 s3Uploader를 사용하여 이미지 업로드 기능을 추가하였습니다.
1️⃣ 이미지 업로드 기능
POST /api/profile2️⃣ 이미지 삭제 기능
DELETE /api/profile유효성 검증
유의 사항
간단 예제
1. ValidationErrorCode 클래스
Dto 검증 시, 유효성 검증 오류를 나타내는 클래스입니다.
간단 예제
2. ValidationExceptionHandler
전역 예외 처리기로 유효성 검증 오류들을 잡아 HTTP 상태와 바디를 즉시 반환합니다.
흐름
도메인 테이블 이름 규칙
@table(name = " ") 을 사용하여 테이블 명을 소문자로 만듭니다.
fcmToken과 같은 경우도 fcmtoken으로 단어를 잇고, 모두 소문자로 만듭니다.
application-local.yml로 운영환경 h2 설정
기존 환경에서는 로컬에서 서버가 켜지지 않았는데, 로컬 및 테스트 데이터베이스를 h2로 설정하여, 서버 운용이 가능하도록 환경설정을 추가하였습니다.
테스트 global 설정
통합 테스트 파일 및 데이터 생성 및 삭제를 도와주는 클래스들을 만들었습니다.
각 통합 테스트 파일을 상황에 맞게, 상속받아 사용하면 됩니다.
1. BaseRestDocs 클래스
RestDocs 테스트 용 통합 클래스 파일입니다.
application-test.yml 파일을 사용하는 걸로 되어 있습니다.
application-secret.yml 파일은 application.yml (기본값)에서 active 하였기에 항상 적용됩니다.
각 테스트 메서드 실행 전, 데이터베이스를 초기화하고, 공용 member와 accessToken을 발급합니다.
간단 예제
2. BaseIntegrationTest 클래스
전체 테스트 용 통합 클래스 파일입니다.
application-test.yml 파일을 사용하는 걸로 되어 있습니다.
각 테스트 메서드 실행 전, 데이터베이스를 초기화합니다.
3. DummyGenerator 클래스
더미 데이터를 생성하는 클래스입니다.
4. DatabaseCleanUp 클래스
@entity가 걸린 클래스명을 이용하여 테이블을 초기화하는 클래스입니다.
CommonSuccessResponseField
5. CommonSuccessResponseField클래스
공통 성공 응답 필드를 쉽게 사용할 수 있도록 만든 클래스입니다.
6. CommonErrorResponseField 클래스
공통 에러 응답 필드를 쉽게 사용할 수 있도록 만든 클래스입니다.
테스트 구조 컨벤션
given-when-then 구조 사용
예시
### DynamicTest - 현재 각 메서드마다 데이터베이스를 초기화하기 때문에 연속된 시나리오를 테스트하려면 한 테스트에 몰아서 적을 수밖에 없습니다. - 하지만, 한 테스트에 한 주제만 있는 것이 좋기에, 일련의 연속적인 테스트를 진행할 경우 DynamicTest를 진행하는 것이 좋습니다. ```java @Autowired S3Service s3Service; @Autowired DummyGenerator dummyGenerator;