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

[BE4] 장세계 #19

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

[BE4] 장세계 #19

wants to merge 11 commits into from

Conversation

segye
Copy link

@segye segye commented Jan 3, 2025

pr이 close 되어 다시올립니다!

Comment on lines +30 to +50
private LocalDateTime createDate;

@OneToMany(mappedBy = "question", cascade = CascadeType.REMOVE)
private List<Answer> answerList;

@ManyToOne
private SiteUser author;

private LocalDateTime modifyDate;

@ManyToMany
Set<SiteUser> voter; // set은 중복데이터 불가

@OneToMany(mappedBy = "question", cascade = CascadeType.REMOVE)
private List<Comment> commentList;

@ManyToOne
private Category category;

@Column(columnDefinition = "integer default 0", nullable = false)
private int view;

Choose a reason for hiding this comment

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

상위 엔티티에 대한 필드, 날짜에 대한 필드, 자식들에 대한 필드는 서로 관련있는 것끼리 정렬되면 더 보기 좋겠습니다.

Comment on lines +54 to +58
if (question.isPresent()) {
return question.get();
} else{
throw new DataNotFoundException("question not found");
}

Choose a reason for hiding this comment

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

옵셔널을 if로 체크하는 부분이 많이 보이는데 orElseThrow나 orElseGet으로 처리하면 더 깔끔해 보일 것 같습니다.

Comment on lines +100 to +103
public void plusView(Question question) {
question.setView(question.getView() + 1);
this.questionRepository.save(question);
}

Choose a reason for hiding this comment

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

plus라는 네이밍이 완전 틀린것은 아니지만 add나 increase 처럼 동사로 시작하는 편이 좋을 것 같습니다

@farrar142
Copy link

전체적으로 잘해주셨고, main패키지안에 main이 중복으로 들어가있네요, 파일 정리가 필요해보입니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants