Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import com.example.solidconnection.siteuser.domain.AuthType;
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.type.Gender;
import com.example.solidconnection.type.PreparationStatus;
import com.example.solidconnection.type.Role;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;

import java.util.List;
Expand All @@ -16,23 +14,17 @@ public record SignUpRequest(
List<String> interestedCountries,
PreparationStatus preparationStatus,
String profileImageUrl,
Gender gender,

@NotBlank(message = "닉네임을 입력해주세요.")
String nickname,

@JsonFormat(pattern = "yyyy-MM-dd")
String birth) {
String nickname) {

public SiteUser toOAuthSiteUser(String email, AuthType authType) {
return new SiteUser(
email,
this.nickname,
this.profileImageUrl,
this.birth,
this.preparationStatus,
Role.MENTEE,
this.gender,
authType
);
}
Expand All @@ -42,10 +34,8 @@ public SiteUser toEmailSiteUser(String email, String encodedPassword) {
email,
this.nickname,
this.profileImageUrl,
this.birth,
this.preparationStatus,
Role.MENTEE,
this.gender,
AuthType.EMAIL,
encodedPassword
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.example.solidconnection.community.post.domain.PostLike;
import com.example.solidconnection.score.domain.GpaScore;
import com.example.solidconnection.score.domain.LanguageTestScore;
import com.example.solidconnection.type.Gender;
import com.example.solidconnection.type.PreparationStatus;
import com.example.solidconnection.type.Role;
import jakarta.persistence.CascadeType;
Expand Down Expand Up @@ -61,9 +60,6 @@ public class SiteUser {
@Column(length = 500)
private String profileImageUrl;

@Column(nullable = false, length = 20)
private String birth;

@Column(nullable = false)
@Enumerated(EnumType.STRING)
private PreparationStatus preparationStage;
Expand All @@ -72,10 +68,6 @@ public class SiteUser {
@Enumerated(EnumType.STRING)
private Role role;

@Column(nullable = false)
@Enumerated(EnumType.STRING)
private Gender gender;

@Setter
private LocalDateTime nicknameModifiedAt;

Expand Down Expand Up @@ -104,36 +96,28 @@ public SiteUser(
String email,
String nickname,
String profileImageUrl,
String birth,
PreparationStatus preparationStage,
Role role,
Gender gender) {
Role role) {
this.email = email;
this.nickname = nickname;
this.profileImageUrl = profileImageUrl;
this.birth = birth;
this.preparationStage = preparationStage;
this.role = role;
this.gender = gender;
this.authType = AuthType.KAKAO;
}

public SiteUser(
String email,
String nickname,
String profileImageUrl,
String birth,
PreparationStatus preparationStage,
Role role,
Gender gender,
AuthType authType) {
this.email = email;
this.nickname = nickname;
this.profileImageUrl = profileImageUrl;
this.birth = birth;
this.preparationStage = preparationStage;
this.role = role;
this.gender = gender;
this.authType = authType;
}

Expand All @@ -142,19 +126,15 @@ public SiteUser(
String email,
String nickname,
String profileImageUrl,
String birth,
PreparationStatus preparationStage,
Role role,
Gender gender,
AuthType authType,
String password) {
this.email = email;
this.nickname = nickname;
this.profileImageUrl = profileImageUrl;
this.birth = birth;
this.preparationStage = preparationStage;
this.role = role;
this.gender = gender;
this.authType = authType;
this.password = password;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public record MyPageResponse(
String profileImageUrl,
Role role,
AuthType authType,
String birth,
String email,
int likedPostCount,
int likedMentorCount,
Expand All @@ -21,7 +20,6 @@ public static MyPageResponse of(SiteUser siteUser, int likedUniversityCount) {
siteUser.getProfileImageUrl(),
siteUser.getRole(),
siteUser.getAuthType(),
siteUser.getBirth(),
siteUser.getEmail(),
0, // TODO: 커뮤니티 기능 생기면 업데이트 필요
0, // TODO: 멘토 기능 생기면 업데이트 필요
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/example/solidconnection/type/Gender.java

This file was deleted.

6 changes: 3 additions & 3 deletions src/main/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ VALUES ('BN', '브루나이', 'ASIA'),
('MY', '말레이시아', 'ASIA'),
('RU', '러시아', 'EUROPE');

INSERT INTO site_user (birth, email, nickname, profile_image_url, gender, preparation_stage, role, password, auth_type)
VALUES ('1999-01-01', 'test@test.email', 'yonso','https://github.com/nayonsoso.png',
'FEMALE', 'CONSIDERING', 'MENTEE',
INSERT INTO site_user (email, nickname, profile_image_url, preparation_stage, role, password, auth_type)
VALUES ('test@test.email', 'yonso', 'https://github.com/nayonsoso.png',
'CONSIDERING', 'MENTEE',
'$2a$10$psmwlxPfqWnIlq9JrlQJkuXr1XtjRNsyVOgcTWYZub5jFfn0TML76', 'EMAIL'); -- 12341234

INSERT INTO university(id, country_code, region_code, english_name, format_name, korean_name,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE site_user
DROP COLUMN gender,
DROP COLUMN birth;
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.siteuser.repository.SiteUserRepository;
import com.example.solidconnection.support.integration.BaseIntegrationTest;
import com.example.solidconnection.type.Gender;
import com.example.solidconnection.type.PreparationStatus;
import com.example.solidconnection.type.Role;
import com.example.solidconnection.type.VerifyStatus;
Expand Down Expand Up @@ -215,10 +214,8 @@ private SiteUser createSiteUser(int index, String nickname) {
"test" + index + " @example.com",
nickname,
"profileImageUrl",
"1999-01-01",
PreparationStatus.CONSIDERING,
Role.MENTEE,
Gender.MALE
Role.MENTEE
);
return siteUserRepository.save(siteUser);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.siteuser.repository.SiteUserRepository;
import com.example.solidconnection.support.integration.BaseIntegrationTest;
import com.example.solidconnection.type.Gender;
import com.example.solidconnection.type.PreparationStatus;
import com.example.solidconnection.type.Role;
import com.example.solidconnection.type.VerifyStatus;
Expand Down Expand Up @@ -225,10 +224,8 @@ private SiteUser createSiteUser(int index, String nickname) {
"test" + index + " @example.com",
nickname,
"profileImageUrl",
"1999-01-01",
PreparationStatus.CONSIDERING,
Role.MENTEE,
Gender.MALE
Role.MENTEE
);
return siteUserRepository.save(siteUser);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.siteuser.repository.SiteUserRepository;
import com.example.solidconnection.support.TestContainerSpringBootTest;
import com.example.solidconnection.type.Gender;
import com.example.solidconnection.type.PreparationStatus;
import com.example.solidconnection.type.Role;
import com.example.solidconnection.util.JwtUtils;
Expand All @@ -28,7 +27,7 @@ class AuthTokenProviderTest {

@Autowired
private AuthTokenProvider authTokenProvider;

@Autowired
private SiteUserRepository siteUserRepository;

Expand All @@ -37,10 +36,10 @@ class AuthTokenProviderTest {

@Autowired
private JwtProperties jwtProperties;

private SiteUser siteUser;
private String subject;

@BeforeEach
void setUp() {
siteUser = createSiteUser();
Expand All @@ -50,7 +49,7 @@ void setUp() {

@Nested
class 액세스_토큰을_제공한다 {

@Test
void SiteUser_로_액세스_토큰을_생성한다() {
// when
Expand All @@ -74,10 +73,10 @@ class 액세스_토큰을_제공한다 {
assertThat(actualSubject).isEqualTo(subject);
}
}

@Nested
class 리프레시_토큰을_제공한다 {

@Test
void SiteUser_로_리프레시_토큰을_생성하고_저장한다() {
// when
Expand Down Expand Up @@ -177,10 +176,8 @@ private SiteUser createSiteUser() {
"test@example.com",
"nickname",
"profileImageUrl",
"1999-01-01",
PreparationStatus.CONSIDERING,
Role.MENTEE,
Gender.MALE
Role.MENTEE
);
return siteUserRepository.save(siteUser);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.siteuser.repository.SiteUserRepository;
import com.example.solidconnection.support.TestContainerSpringBootTest;
import com.example.solidconnection.type.Gender;
import com.example.solidconnection.type.PreparationStatus;
import com.example.solidconnection.type.Role;
import org.assertj.core.api.Assertions;
Expand Down Expand Up @@ -88,10 +87,8 @@ private SiteUser createSiteUser(String email, String rawPassword) {
email,
"nickname",
"profileImageUrl",
"1999-01-01",
PreparationStatus.CONSIDERING,
Role.MENTEE,
Gender.MALE,
AuthType.EMAIL,
encodedPassword
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.siteuser.repository.SiteUserRepository;
import com.example.solidconnection.support.TestContainerSpringBootTest;
import com.example.solidconnection.type.Gender;
import com.example.solidconnection.type.PreparationStatus;
import com.example.solidconnection.type.Role;
import com.example.solidconnection.util.JwtUtils;
Expand Down Expand Up @@ -79,10 +78,8 @@ private SiteUser createSiteUser() {
"test@example.com",
"nickname",
"profileImageUrl",
"1999-01-01",
PreparationStatus.CONSIDERING,
Role.MENTEE,
Gender.MALE
Role.MENTEE
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.siteuser.repository.SiteUserRepository;
import com.example.solidconnection.support.TestContainerSpringBootTest;
import com.example.solidconnection.type.Gender;
import com.example.solidconnection.type.PostCategory;
import com.example.solidconnection.type.PreparationStatus;
import com.example.solidconnection.type.Role;
Expand Down Expand Up @@ -64,10 +63,8 @@ private SiteUser createSiteUser() {
"test@example.com",
"nickname",
"profileImageUrl",
"1999-01-01",
PreparationStatus.CONSIDERING,
Role.MENTEE,
Gender.MALE
Role.MENTEE
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.siteuser.repository.SiteUserRepository;
import com.example.solidconnection.support.TestContainerSpringBootTest;
import com.example.solidconnection.type.Gender;
import com.example.solidconnection.type.PostCategory;
import com.example.solidconnection.type.PreparationStatus;
import com.example.solidconnection.type.Role;
Expand Down Expand Up @@ -67,10 +66,8 @@ private SiteUser createSiteUser() {
"test@example.com",
"nickname",
"profileImageUrl",
"1999-01-01",
PreparationStatus.CONSIDERING,
Role.MENTEE,
Gender.MALE
Role.MENTEE
);
}

Expand Down Expand Up @@ -118,7 +115,7 @@ private Post createPost(Board board, SiteUser siteUser) {
System.err.println("ExecutorService did not terminate in the expected time.");
}

Thread.sleep(SCHEDULING_DELAY_MS+1000);
Thread.sleep(SCHEDULING_DELAY_MS + 1000);

assertEquals(THREAD_NUMS, postRepository.getById(post.getId()).getViewCount());
}
Expand Down Expand Up @@ -164,7 +161,7 @@ private Post createPost(Board board, SiteUser siteUser) {
System.err.println("ExecutorService did not terminate in the expected time.");
}

Thread.sleep(SCHEDULING_DELAY_MS+1000);
Thread.sleep(SCHEDULING_DELAY_MS + 1000);

assertEquals(2L, postRepository.getById(post.getId()).getViewCount());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.example.solidconnection.siteuser.domain.SiteUser;
import com.example.solidconnection.siteuser.repository.SiteUserRepository;
import com.example.solidconnection.support.TestContainerSpringBootTest;
import com.example.solidconnection.type.Gender;
import com.example.solidconnection.type.PreparationStatus;
import com.example.solidconnection.type.Role;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -46,10 +45,8 @@ private SiteUser createSiteUser() {
"test@example.com",
"nickname",
"profileImageUrl",
"1999-01-01",
PreparationStatus.CONSIDERING,
Role.MENTEE,
Gender.MALE
Role.MENTEE
);
}

Expand Down
Loading
Loading