Skip to content

Conversation

@nayoung04
Copy link

No description provided.

Copy link
Member

@Chuseok22 Chuseok22 left a comment

Choose a reason for hiding this comment

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

제약조건에 있는 username, nickname 중복 처리 부분만 추가해주면 될 것 같아
고생했어~~

Comment on lines 17 to 24
@Column(nullable = false)
private String username;

@Column(nullable = false)
private String password;

@Column(nullable = false)
private String nickname;
Copy link
Member

Choose a reason for hiding this comment

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

@column(nullable = false, unique = true)
이렇게 설정하면 null 값 들어오는거 막을 수 있고, 중복된 값 들어오는거 막을 수 있어

Copy link
Author

Choose a reason for hiding this comment

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

아하 제약조건을 제대로 안봤군,,
수정했습니다!

Copy link
Member

Choose a reason for hiding this comment

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

굳굳!!!

Comment on lines +29 to +35
User user = userRepository.findByUsername(userDto.getUsername());
if (user != null) {
if (user.getPassword().equals(userDto.getPassword())) {
return user.getNickname() + "님, 환영합니다!!";
}
}
return "아이디 및 비밀번호가 일치하지 않습니다.";
Copy link
Member

Choose a reason for hiding this comment

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

user가 null인 경우를 대비해서 if 조건문으로 로직 작성했는데
Optional로 받아서 처리하는 것도 괜찮습니다~

Comment on lines +14 to 16

// 회원 가입
public UserDto join(UserDto userDto) {
Copy link
Member

Choose a reason for hiding this comment

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

플젝에서는 @transactional 붙여주면 좋아용~

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.

3 participants