Skip to content

Commit

Permalink
Feat: Member DB 수정
Browse files Browse the repository at this point in the history
- 한글이름, 영어이름, 기수, 과정 추가
- 과정 표현하는 Enumerate 추가
- 수정에 따른 오류 수정
  - getNickname -> getKoreaName of getEnglishName

Related to: KakaoTech-BootCamp-Team-2#2
  • Loading branch information
Taejin1221 committed Aug 30, 2024
1 parent 90052aa commit b47c6a0
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
13 changes: 13 additions & 0 deletions src/main/java/kaboo/kaboo_auth/domain/Course.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package kaboo.kaboo_auth.domain;

public enum Course {
AI("GenAI"),
FULLSTACK("Fullstack"),
CLOUD("Cloud");

private final String course;

Course(String course) {
this.course = course;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public String getUsername() {

@Override
public String getName() {
return member.getNickname();
return member.getKoreaName();
}

@Override
Expand Down
18 changes: 15 additions & 3 deletions src/main/java/kaboo/kaboo_auth/domain/entity/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import kaboo.kaboo_auth.domain.Course;
import kaboo.kaboo_auth.domain.UserRole;
import lombok.Builder;
import lombok.Getter;
Expand All @@ -23,19 +24,30 @@ public class Member {

private String username;
private String email;
private String nickname;
private String koreaName;
private String englishName;
private String password;
private String info;

private int classNum;

@Enumerated(EnumType.STRING)
private Course course;

@Enumerated(EnumType.STRING)
private UserRole role;

@Builder
public Member(String username, String email, String nickname, String password, UserRole role) {
public Member(String username, String email, String koreaName, String englishName, String password, String info,
int classNum, Course course, UserRole role) {
this.username = username;
this.email = email;
this.nickname = nickname;
this.koreaName = koreaName;
this.englishName = englishName;
this.password = password;
this.info = info;
this.classNum = classNum;
this.course = course;
this.role = role;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2Authentic
String rawPassword = username + passwordPostfix;
member = Member.builder()
.username(username)
.nickname(nickname)
.koreaName(nickname)
.email(email)
.password(passwordEncoder.encode(rawPassword))
.role(UserRole.ROLE_USER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MemberRepositoryTest {
@DisplayName("DB 저장 Test")
void saveMemberTest() {
// Given
Member member = Member.builder().username("Alice").nickname("Alice").password("1234").build();
Member member = Member.builder().username("Alice").englishName("Alice").password("1234").build();
memberRepository.save(member);

// When
Expand All @@ -37,7 +37,7 @@ void saveMemberTest() {
@DisplayName("Username으로 찾기 성공 Test")
void findByUsername_Success() {
// Given
Member member1 = Member.builder().username("Alice").nickname("Alice").password("1234").build();
Member member1 = Member.builder().username("Alice").englishName("Alice").password("1234").build();
memberRepository.save(member1);

// When
Expand Down

0 comments on commit b47c6a0

Please sign in to comment.