Skip to content

Conversation

@nayonsoso
Copy link
Collaborator

@nayonsoso nayonsoso commented Jun 25, 2025

관련 이슈

작업 내용

6.25 (수) 회의에서 논의된대로

  • 멘토링 관련 flyway 스크립트 추가
  • JPA 엔티티 추가

했습니다.

이번 PR에서 'JPA 엔티티 추가'까지 한 이유는,
flyway 스크립트만 추가한 상태에서는 PR을 머지했을 때,
"스크립트랑 JPA엔티티랑 구조가 일치하지 않는다"라는 이유로 validate 실패할 것이기 때문입니다.

리뷰 요구사항

❗️회의에서 논의된 내용 이외에 이런 것들을 추가 수정했습니다. 검토 부탁드려요❗️

  • mentor 테이블에서 country_code(FK)컬럼을 없앴습니다.
    university_id 컬럼으로 대학을 fetch 할 때 함께 가져올 수 있는 데이터라 생각했기 때문입니다.
  • channel 에서 '순서'를 나타냈던 order컬럼 이름을 sequence로 바꿨습니다.
    order는 MySQL 예약어더라고요😅
  • VerifyStatus enum의 패키지를 applicaiton.domain 에서 common 으로 변경했습니다.
    더 이상 application 패키지에서만 쓰이는게 아니라, Mentoring에서도 쓰이기 때문입니다.

기타

로컬에서 flyway validate 통과 확인했습니다👌

@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Copy link
Contributor

@Gyuhyeok99 Gyuhyeok99 left a comment

Choose a reason for hiding this comment

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

이 PR에서 VerifyStatus 위치 바꾼 거 좋은 거 같습니다! 고생하셨습니다 ㅎㅎ

Copy link
Member

@whqtker whqtker left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 ~ 궁금한 점 코멘트 남겼습니다!

@Gyuhyeok99
Copy link
Contributor

확인했습니다!

coderabbitai[bot]

This comment was marked as resolved.

Copy link
Contributor

@lsy1307 lsy1307 left a comment

Choose a reason for hiding this comment

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

다들 매의 눈으로 어떻게 이렇게 잘 찾아내시는지... 문제가 없어 보여 approve 하겠습니당

@whqtker whqtker self-requested a review June 30, 2025 09:58
Copy link
Member

@whqtker whqtker left a comment

Choose a reason for hiding this comment

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

양뱡향 확인했습니다 !

@whqtker whqtker mentioned this pull request Jun 30, 2025
2 tasks
@whqtker whqtker self-requested a review July 1, 2025 05:24
Copy link
Member

@whqtker whqtker left a comment

Choose a reason for hiding this comment

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

발견한 변경사항 제안드립니다~!

PRIMARY KEY (id),
CONSTRAINT fk_mentoring_mentor_id FOREIGN KEY (mentor_id) REFERENCES mentor (id),
CONSTRAINT fk_mentoring_site_user_id FOREIGN KEY (mentee_id) REFERENCES site_user (id)
);
Copy link
Member

@whqtker whqtker Jul 1, 2025

Choose a reason for hiding this comment

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

    CONSTRAINT chk_verify_status_rejected_reason 
        CHECK (
            (verify_status = 'REJECTED' AND rejected_reason IS NOT NULL) 
            OR 
            (verify_status != 'REJECTED' AND rejected_reason IS NULL)
        )

image

멘토링 거절 시 반드시 거절 사유를 입력하는 거로 알고 있습니다. 관련 검증 있으면 좋을 거 같습니다!

조금 걱정이 되는건, 분명 이렇게 작성하면 무결성 측면에서는 분명 좋은데, 너무 빡빡(?)하게 구는 게 아닌가 생각이 드네요 ..ㅋㅋ

Copy link
Collaborator Author

@nayonsoso nayonsoso Jul 1, 2025

Choose a reason for hiding this comment

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

저도 “빡빡한 check 제약”의 장단점에 대해 아는게 없어, 이번에 Gemini 한테 물어봤습니다.
답변 내용이 합리적이라는 생각이 들어 인용하고, 특히나 공감가는 부분을 표시해봤습니다. 💁🏻‍♀️

image
image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

위 내용을 참고하여 생각을 정리해봤는데,
"거절 시 사유를 입력해야한다"는 절대 변경되지 않을 규칙은 아니므로
(입력 시 검증 Dto Validation + 도메인 생성자에서 검증)으로 충분할 것 같다는 생각이 들었습니다!

우선 이 PR에서는 도메인 생성자에 검증을 추가하는 방식만 구현해도 괜찮을까요?

Copy link
Member

Choose a reason for hiding this comment

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

저도 동의합니다. '검증의 세기'를 결정하는 기준 중 하나로 '과연 이 규칙이 변경되지 않을까?'를 따져보는 것도 괜찮네요!


@Column
@Enumerated(EnumType.STRING)
private VerifyStatus verifyStatus;
Copy link
Member

Choose a reason for hiding this comment

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

다른 도메인verifyStatus@Column(columnDefinition = "varchar(50) not null default 'PENDING'")을 작성하였는데, Mentoring 엔티티에도 작성하면 좋을 것 같습니다.

Copy link
Collaborator Author

@nayonsoso nayonsoso Jul 1, 2025

Choose a reason for hiding this comment

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

링크 걸어주셔서 빠르게 확인할 수 있었습니다! 🙇🏻‍♀️

다른 도메인은 verifyStatus 에 @Column(columnDefinition = "varchar(50) not null default 'PENDING'")을 작성하였는데

이걸 보고 ‘오잉? ENUM이 아니라 VARCHAR로 columnDefinition을 설정했었나?!’라는 생각이 들어 DB 확인해보니..
다른 도메인들의 verifyStatus는 정말로 varchar(50)으로 되어있더라고요🥲
모든 도메인의 verifyStatus은 ENUM으로 관리하는 것이 원래 의도였습니다. 혼란을 드려 죄송합니다.
그리고 실수 짚어주셔서 감사합니다!

수정은 다음과 같이 진행하려합니다.

1/ DB 스키마 변경
Flyway 스크립트를 사용하여 gpa_score, language_test_score, application의
verify_status 컬럼들을 ENUM 타입으로 수정하겠습니다.
- as-is : VARCHAR(50) DEFAULT 'PENDING' NOT NULL,
- to-do : ENUM(‘PENDING', 'REJECTED', 'APPROVED') NOT NULL DEFAULT 'PENDING'

2/ JPA 코드 통일
아래와 같이 도메인 필드에서 직접 기본값을 초기화하는 방식으로 통일하겠습니다.

@Column(nullable = false)
@Enumerated(EnumType.STRING)
private VerifyStatus verifyStatus = VerifyStatus.PENDING; // 필드에서 기본값 초기화

columnDefinition 옵션을 사용하지 않는 이유는,
columnDefinition을 사용한다면 코드가 지나치게 길어집니다.
@Column(nullable = false, columnDefinition = "ENUM('PENDING', 'REJECTED', 'APPROVED') DEFAULT 'PENDING'")
그리고 이 경우, 새로운 enum이 추가될 때 관리 포인트가 증가한다고 생각했습니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

성혁님이 이 방식에 동의하시면, 이슈 만들고 다른 PR에서 수정 진행하겠습니다! 🫡

Copy link
Member

Choose a reason for hiding this comment

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

그러고보니 ENUMVARCHAR 로 관리하는 것이 어색하긴 하네요. 제안하신 방법 좋습니다!

Copy link
Collaborator Author

@nayonsoso nayonsoso Jul 1, 2025

Choose a reason for hiding this comment

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

#365

이슈 만들어두었고, 추가 커밋으로 기본 값 설정하도록 반영했습니다! 753168d

Copy link
Member

@whqtker whqtker left a comment

Choose a reason for hiding this comment

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

확인했습니다 ~!

@nayonsoso nayonsoso merged commit 985d2b2 into solid-connection:develop Jul 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 멘토 관련 엔티티 추가

4 participants