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

[feat, refactor] : 초기 삽입문 추가 & 에러 처리 방식 변경 #51

Merged
merged 3 commits into from
May 20, 2024
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 @@ -52,11 +52,7 @@ public static DefinePersonaDto.DefinePersonaResponse of(UUID definePersonaId, St
Content content = Arrays.stream(Content.values())
.filter(desc -> desc.getCode().equals(definePersonaCode))
.findFirst()
.orElse(null);

if (content == null) {
throw new PersonaException(PersonaErrorResult.NOT_FOUND_PERSONA_TYPE);
}
.orElseThrow(() -> new PersonaException(PersonaErrorResult.NOT_FOUND_PERSONA_TYPE));

return DefinePersonaDto.DefinePersonaResponse.builder()
.definePersonaId(String.valueOf(definePersonaId))
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kusitms/jangkku/domain/user/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class User extends BaseEntity {
@Column(name = "users_uuid", columnDefinition = "BINARY(16)", unique = true)
private UUID userId;

@Column(name = "name", nullable = false, length = 5)
@Column(name = "name", nullable = false, length = 20)
private String name;

@Column(name = "provider", nullable = false, length = 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class UserOnboardingInfo extends BaseEntity {
@JoinColumn(name = "users_id", foreignKey = @ForeignKey(name = "users_onboarding_infos_fk_users_id"))
private User user;

@Column(name = "nickname", nullable = false, length = 10)
@Column(name = "nickname", nullable = false, length = 20)
private String nickname;

@Column(name = "job", nullable = false, length = 10)
Expand Down
24 changes: 24 additions & 0 deletions src/main/resources/data.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
-- 테스트 유저 삽입
INSERT INTO users (id, name, provider, provider_id, users_uuid, created_date, updated_date)
VALUES (100001, '테스트1', 'kakao', '3471511962', UNHEX(REPLACE('159f4542-ebff-4acd-a603-a4fb4c94526a', '-', '')), LOCALTIMESTAMP, LOCALTIMESTAMP),
(100002, '테스트2', 'kakao', '3471511963', UNHEX(REPLACE('159f4542-ebff-4acd-a603-a4fb4c94526b', '-', '')), LOCALTIMESTAMP, LOCALTIMESTAMP)
ON DUPLICATE KEY UPDATE name = VALUES(name);

-- 테스트 유저 온보딩 정보 삽입
INSERT INTO users_onboarding_infos (users_id, nickname, job, understanding_score, profile_img_url, created_date, updated_date) VALUES
(100001, '테스트1', '개발자', '100', '1234asdf', LOCALTIMESTAMP, LOCALTIMESTAMP),
(100002, '테스트2', '개발자', '100', '1234asdf', LOCALTIMESTAMP, LOCALTIMESTAMP)
ON DUPLICATE KEY UPDATE nickname = VALUES(nickname);

-- 테스트 유저 관심분야 정보 삽입
INSERT INTO users_interests (id, users_id, interests_id, created_date, updated_date) VALUES
(100001, 100001, 1, LOCALTIMESTAMP, LOCALTIMESTAMP),
(100002, 100002, 1, LOCALTIMESTAMP, LOCALTIMESTAMP)
ON DUPLICATE KEY UPDATE id = VALUES(id);

-- 테스트 유저 키워드 정보 삽입
INSERT INTO users_keywords (id, users_id, keywords_id, created_date, updated_date) VALUES
(100001, 100001, 1, LOCALTIMESTAMP, LOCALTIMESTAMP),
(100002, 100002, 1, LOCALTIMESTAMP, LOCALTIMESTAMP)
ON DUPLICATE KEY UPDATE id = VALUES(id);

-- 관심 분야 전체 삽입
INSERT INTO interests (interests_id, name) VALUES
(1, '드로잉'),
Expand Down
Loading