-
Notifications
You must be signed in to change notification settings - Fork 2
hw3-1 #2
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
base: main
Are you sure you want to change the base?
Conversation
Chuseok22
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제약조건에 있는 username, nickname 중복 처리 부분만 추가해주면 될 것 같아
고생했어~~
| @Column(nullable = false) | ||
| private String username; | ||
|
|
||
| @Column(nullable = false) | ||
| private String password; | ||
|
|
||
| @Column(nullable = false) | ||
| private String nickname; |
There was a problem hiding this comment.
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 값 들어오는거 막을 수 있고, 중복된 값 들어오는거 막을 수 있어
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아하 제약조건을 제대로 안봤군,,
수정했습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굳굳!!!
| User user = userRepository.findByUsername(userDto.getUsername()); | ||
| if (user != null) { | ||
| if (user.getPassword().equals(userDto.getPassword())) { | ||
| return user.getNickname() + "님, 환영합니다!!"; | ||
| } | ||
| } | ||
| return "아이디 및 비밀번호가 일치하지 않습니다."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user가 null인 경우를 대비해서 if 조건문으로 로직 작성했는데
Optional로 받아서 처리하는 것도 괜찮습니다~
|
|
||
| // 회원 가입 | ||
| public UserDto join(UserDto userDto) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
플젝에서는 @transactional 붙여주면 좋아용~
No description provided.