-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] 라이브 코테 #359
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] 라이브 코테 #359
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,5 +2,6 @@ | |
|
|
||
| public enum InterviewType { | ||
| CATEGORY_BASED, | ||
| RESUME_BASED | ||
| RESUME_BASED, | ||
| LIVE_CODING | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| import com.samhap.kokomen.category.domain.Category; | ||||||||||||||||||||||||||
| import com.samhap.kokomen.global.domain.BaseEntity; | ||||||||||||||||||||||||||
| import com.samhap.kokomen.global.exception.BadRequestException; | ||||||||||||||||||||||||||
| import jakarta.persistence.Column; | ||||||||||||||||||||||||||
| import jakarta.persistence.Entity; | ||||||||||||||||||||||||||
| import jakarta.persistence.EnumType; | ||||||||||||||||||||||||||
|
|
@@ -38,7 +39,14 @@ public class RootQuestion extends BaseEntity { | |||||||||||||||||||||||||
| @Column(name = "state", nullable = false) | ||||||||||||||||||||||||||
| private RootQuestionState state; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @Column(name = "content", nullable = false, length = 1_000) | ||||||||||||||||||||||||||
| @Enumerated(EnumType.STRING) | ||||||||||||||||||||||||||
| @Column(name = "question_type", nullable = false) | ||||||||||||||||||||||||||
| private RootQuestionType questionType; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @Column(name = "title", length = 255) | ||||||||||||||||||||||||||
| private String title; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @Column(name = "content", nullable = false, columnDefinition = "TEXT") | ||||||||||||||||||||||||||
| private String content; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @Column(name = "question_order") | ||||||||||||||||||||||||||
|
|
@@ -47,6 +55,31 @@ public class RootQuestion extends BaseEntity { | |||||||||||||||||||||||||
| public RootQuestion(Category category, String content) { | ||||||||||||||||||||||||||
| this.category = category; | ||||||||||||||||||||||||||
| this.state = RootQuestionState.ACTIVE; | ||||||||||||||||||||||||||
| this.questionType = RootQuestionType.GENERAL; | ||||||||||||||||||||||||||
| this.content = content; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| public static RootQuestion forCode(Category category, String title, String content) { | ||||||||||||||||||||||||||
| if (title == null || title.isBlank()) { | ||||||||||||||||||||||||||
| throw new BadRequestException("코드 타입 루트 질문은 제목(title)이 필수입니다."); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| RootQuestion rootQuestion = new RootQuestion(); | ||||||||||||||||||||||||||
| rootQuestion.category = category; | ||||||||||||||||||||||||||
| rootQuestion.state = RootQuestionState.ACTIVE; | ||||||||||||||||||||||||||
| rootQuestion.questionType = RootQuestionType.CODE; | ||||||||||||||||||||||||||
| rootQuestion.title = title; | ||||||||||||||||||||||||||
| rootQuestion.content = content; | ||||||||||||||||||||||||||
| return rootQuestion; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+62
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
public static RootQuestion forCode(Category category, String title, String content) {
if (title == null || title.isBlank()) {
throw new IllegalArgumentException("코드 타입 질문은 제목(title)이 필수입니다.");
}
RootQuestion rootQuestion = new RootQuestion();
rootQuestion.category = category;
rootQuestion.state = RootQuestionState.ACTIVE;
rootQuestion.questionType = RootQuestionType.CODE;
rootQuestion.title = title;
rootQuestion.content = content;
return rootQuestion;
} |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| public String createInitialQuestionContent() { | ||||||||||||||||||||||||||
| if (questionType == RootQuestionType.CODE && title != null && !title.isBlank()) { | ||||||||||||||||||||||||||
| return title + "\n\n" + content; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| return content; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+75
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| public boolean isCode() { | ||||||||||||||||||||||||||
| return this.questionType == RootQuestionType.CODE; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package com.samhap.kokomen.interview.domain; | ||
|
|
||
| public enum RootQuestionType { | ||
| GENERAL, | ||
| CODE, | ||
| ; | ||
| } |
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.
CODE 루트 질문 생성 시 제목/본문 유효성 검증이 필요합니다.
forCode(...)가title/content의 null·blank를 허용해서 CODE 질문의 필수 의미가 깨질 수 있고, 이후 초기 질문 생성 시 비정상 문자열이 생성될 수 있습니다.수정 제안
As per coding guidelines, "Use
@Validannotation in DTOs for validation, entity-level validation in constructors, business validation in service layer".🤖 Prompt for AI Agents
Source: Coding guidelines