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] 황인우 #16

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

[BE4] 황인우 #16

wants to merge 14 commits into from

Conversation

iaminwoo
Copy link

@iaminwoo iaminwoo commented Jan 3, 2025

새로운 기능 구현 커밋 전에 기본 상태를 한번 커밋 해놓으면 변경 상태를 확인하기 더 좋겠네요..! 다음부턴 그렇게 해야겠습니다ㅎㅎㅎ

Comment on lines +11 to +29
public static void permission(Object object, String username, HttpMethod httpMethod) {
SiteUser author;

if(object instanceof Question) {
Question question = (Question) object;
author = question.getAuthor();
} else if(object instanceof Answer) {
Answer answer = (Answer) object;
author = answer.getAuthor();
} else if(object instanceof Comment) {
Comment comment = (Comment) object;
author = comment.getAuthor();
} else {
throw new IllegalArgumentException("잘못된 데이터 타입입니다.");
}

if(!author.getUsername().equals(username)){
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "%s권한이 없습니다.".formatted(httpMethod.getValue()));
}

Choose a reason for hiding this comment

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

Object대신 BaseEntity타입을 받았다면 당장은 간결한 코드로 만들 수 있었을 것 같은데, 확장성을 위해서인가요?

Comment on lines +14 to +16
private Integer questionId;

private Integer parentId;

Choose a reason for hiding this comment

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

외래키로 연결하지 않은 이유가 있나요?

Comment on lines +19 to +27
private String content;

private LocalDateTime createDate;

@ManyToOne
private SiteUser author;

private LocalDateTime modifyDate;
}

Choose a reason for hiding this comment

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

변수를 관련있는 순으로 정렬 하는 걸 추천드립니다. ex) author, content, createDate, modifyDate순


// 임시 비밀번호 발송
System.out.println("임시 비밀번호 생성 : " + tempPassword);
this.emailService.sendTempPassword(user.getEmail(), tempPassword);

Choose a reason for hiding this comment

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

이메일 송신은 비동기 처리를 하는 것이 좋아보입니다.

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