Conversation
|
""" Walkthrough투표 기능을 위한 기초 엔티티가 도메인 및 엔티티 패키지에 새로 추가되었습니다. Poll과 Vote 관련 JPA 엔티티, 상태 및 팀 구분을 위한 Enum, 그리고 이에 맞는 DB 마이그레이션 스크립트가 도입되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant PollEntity
participant VoteEntity
participant Database
User->>PollEntity: 투표 생성 요청
PollEntity->>Database: poll 테이블에 저장
User->>VoteEntity: 투표 참여 요청
VoteEntity->>Database: vote 테이블에 저장 (poll_id 참조)
Assessment against linked issues
Assessment against linked issues: Out-of-scope changes(해당 변경사항에는 명확히 범위를 벗어난 코드 변경이 없습니다.) 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
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
Documentation and Community
|
📝 Test Coverage Report
|
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
src/main/java/com/debatetimer/domain/poll/PollStatus.java (1)
5-7: enum 상수 명명 개선 제안
PROGRESS보다는IN_PROGRESS또는ACTIVE가 더 명확한 의미를 전달합니다. 또한 마지막 세미콜론이 불필요합니다.public enum PollStatus { - PROGRESS, - DONE, - ; + IN_PROGRESS, + DONE }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/main/java/com/debatetimer/domain/poll/PollStatus.java(1 hunks)src/main/java/com/debatetimer/domain/poll/VoteTeam.java(1 hunks)src/main/java/com/debatetimer/entity/poll/PollEntity.java(1 hunks)src/main/java/com/debatetimer/entity/poll/VoteEntity.java(1 hunks)src/main/resources/db/migration/V9__create_poll_and_vote_table.sql(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-and-push
🔇 Additional comments (1)
src/main/resources/db/migration/V9__create_poll_and_vote_table.sql (1)
1-25: 데이터베이스 스키마 설계 양호테이블 구조와 제약 조건이 잘 정의되어 있습니다. 외래키 제약 조건과 NOT NULL 제약 조건이 적절히 설정되어 있고, 엔티티 클래스와 일치합니다.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/com/debatetimer/domain/poll/VoteTeam.java (1)
7-7: 불필요한 세미콜론 제거 제안enum 상수 뒤의 세미콜론은 메서드나 필드가 없을 때는 불필요합니다. 코드를 더 간결하게 만들 수 있습니다.
public enum VoteTeam { PROS, - CONS, - ; + CONS }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/com/debatetimer/domain/poll/VoteTeam.java(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-and-push
🔇 Additional comments (1)
src/main/java/com/debatetimer/domain/poll/VoteTeam.java (1)
3-8: 이전 리뷰 이슈가 해결되었습니다.빈 enum으로 인한 런타임 에러 가능성 문제가 해결되었습니다.
PROS와CONS상수를 추가하여 토론 시스템의 찬성팀과 반대팀을 적절히 표현하고 있습니다.
Test Results 69 files 69 suites 11s ⏱️ Results for commit 8ac9fd2. ♻️ This comment has been updated with latest results. |
| @NotBlank | ||
| private String prosTeamName; | ||
|
|
||
| @NotBlank | ||
| private String consTeamName; |
There was a problem hiding this comment.
CustomizeTable에서 검증했기 때문에 여기선 검증하지 않는 건가요?
There was a problem hiding this comment.
네, 그렇게 판단한 이유는 다음과 같아요.
일단, 최대한 도메인 검증에 대한 책임은 Entity 단에서 수행하지 않는 것을 지향합니다.
선거 엔티티가 각 팀 이름을 검증하는 것이 어색하게 느껴졌습니다.
만약 팀이름에 대한 검증로직이 해당 엔티티에 추가되면 중복 검증이 되어 관리포인트가 2가지로 생깁니다.
따라서 생성 루트 일원화를 통해 관리하는 것이 바람직하다고 판단했습니다.
| @Entity | ||
| @Table(name = "poll") | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class PollEntity extends BaseTimeEntity { |
There was a problem hiding this comment.
이럴꺼면 CustomizeTimeBox에도 Entity 붙여주세요
There was a problem hiding this comment.
@unifolio0 이건 다음에 작업하는 사람이 하는 걸로 합시다. 일단은 "투표 API 관련 엔티티"만 보는 건 어떨까요?
There was a problem hiding this comment.
CustomizeTimeBox에도 도메인 -엔티티 분리 작업 리팩터링하면서 Entity suffix 붙을 것 같아요.
| ( | ||
| id BIGINT AUTO_INCREMENT PRIMARY KEY, | ||
| table_id BIGINT NOT NULL, | ||
| status VARCHAR(255) NOT NULL, |
There was a problem hiding this comment.
왜 다른 enum과 달리 얘는 varchar로 하셨나요?
There was a problem hiding this comment.
몰랐어요.
enum으로 변경해주었습니다.
| ( | ||
| id BIGINT AUTO_INCREMENT PRIMARY KEY, | ||
| poll_id BIGINT NOT NULL, | ||
| team VARCHAR(255) NOT NULL, |
There was a problem hiding this comment.
몰랐어요
enum으로 변경해주었습니다.
| created_at DATETIME(6) NOT NULL, | ||
| modified_at DATETIME(6) NOT NULL |
There was a problem hiding this comment.
여기 왜 다른 것과 달리 DATETIME로 하셨나요?
There was a problem hiding this comment.
몰랐어요.
timestamp로 변경해주었습니다.
leegwichan
left a comment
There was a problem hiding this comment.
/noti 고생했고~ 일단은 비토가 코멘트 많이 남겨놔서 제가 더 달건 없을 것 같아요.
모든 코멘트 반영 후에 한 번 더 노티 주세요!
| @Entity | ||
| @Table(name = "poll") | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class PollEntity extends BaseTimeEntity { |
There was a problem hiding this comment.
@unifolio0 이건 다음에 작업하는 사람이 하는 걸로 합시다. 일단은 "투표 API 관련 엔티티"만 보는 건 어떨까요?
There was a problem hiding this comment.
도메인 없이 일단 엔티티만 사용하는 건가요? 아니면 도메인은 다음 작업에서 구현하시는 건가요?
There was a problem hiding this comment.
[의견 🔈 ]
투표 API는 기존 도메인과 분리된 부분이기 때문에 영향 줄 부분이 크게 없다고 생각되어 API 뽑으면서 도메인까지 붙이겠습니다.
coli-geonwoo
left a comment
There was a problem hiding this comment.
/noti
리뷰 반영완료했습니다.
그리고 API 뽑으면서 도메인 객체 분리도 같이 진행하겠습니다.
There was a problem hiding this comment.
[의견 🔈 ]
투표 API는 기존 도메인과 분리된 부분이기 때문에 영향 줄 부분이 크게 없다고 생각되어 API 뽑으면서 도메인까지 붙이겠습니다.
| @Entity | ||
| @Table(name = "poll") | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class PollEntity extends BaseTimeEntity { |
There was a problem hiding this comment.
CustomizeTimeBox에도 도메인 -엔티티 분리 작업 리팩터링하면서 Entity suffix 붙을 것 같아요.
| ( | ||
| id BIGINT AUTO_INCREMENT PRIMARY KEY, | ||
| table_id BIGINT NOT NULL, | ||
| status VARCHAR(255) NOT NULL, |
There was a problem hiding this comment.
몰랐어요.
enum으로 변경해주었습니다.
| created_at DATETIME(6) NOT NULL, | ||
| modified_at DATETIME(6) NOT NULL |
There was a problem hiding this comment.
몰랐어요.
timestamp로 변경해주었습니다.
| ( | ||
| id BIGINT AUTO_INCREMENT PRIMARY KEY, | ||
| poll_id BIGINT NOT NULL, | ||
| team VARCHAR(255) NOT NULL, |
There was a problem hiding this comment.
몰랐어요
enum으로 변경해주었습니다.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
src/main/resources/db/migration/V9__create_poll_and_vote_table.sql (1)
5-5: 타 마이그레이션과 DATETIME/TIMESTAMP 사용 일관성 재검토 필요이전 스키마에서
DATETIME을 사용했던 컬럼들이 존재합니다. 동일 용도의 컬럼이면 형식을 통일해 주세요.
(과거 리뷰와 동일한 논의 사항입니다.)
🧹 Nitpick comments (2)
src/main/resources/db/migration/V9__create_poll_and_vote_table.sql (2)
13-17:vote.poll_id에 인덱스가 없어 조인 성능이 저하될 수 있습니다
vote테이블은 대부분poll_id조건으로 조회될 가능성이 높으므로 인덱스 추가를 권장합니다.+CREATE INDEX idx_vote_poll_id ON vote (poll_id);
22-25: 외래 키에ON DELETE CASCADE옵션을 추가하면 데이터 정합성이 향상됩니다
poll삭제 시 관련vote레코드를 자동으로 정리하지 않으면 불필요한 수작업이 필요합니다.- add constraint vote_to_poll - foreign key (poll_id) - references poll (id); + add constraint vote_to_poll + foreign key (poll_id) + references poll (id) + on delete cascade;
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/resources/db/migration/V9__create_poll_and_vote_table.sql(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: coli-geonwoo
PR: debate-timer/debate-timer-be#196
File: src/main/java/com/debatetimer/entity/poll/VoteEntity.java:19-0
Timestamp: 2025-07-10T01:01:08.926Z
Learning: VoteEntity와 같은 JPA 엔티티에서 getter/setter 메서드는 필요할 때 점진적으로 추가하는 방식을 선호함. 초기 엔티티 설정 단계에서는 최소한의 구조만 유지하고 기능을 점진적으로 확장하는 개발 방식을 사용함.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-and-push
src/main/resources/db/migration/V9__create_poll_and_vote_table.sql
Outdated
Show resolved
Hide resolved
|
/noti |
leegwichan
left a comment
There was a problem hiding this comment.
/noti 머지 ㄱㄱ 다음 작업도 ㄱㄱ
콜리는 힘 많이 내고~
|
/noti 코드래빗 리뷰까지 반영하여 머지하겠습니다~ |
🚩 연관 이슈
closed #195
🗣️ 리뷰 요구사항 (선택)
Summary by CodeRabbit
Summary by CodeRabbit
신규 기능
데이터베이스