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

[BE] fix: Highlight 엔티티의 데이터 타입을 db 테이블와 일치시킨다. #829

Merged
merged 4 commits into from
Oct 11, 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 @@ -29,7 +29,7 @@ public class Highlight {
@Embedded
private HighlightPosition highlightPosition;

public Highlight(long answerId, long lineIndex, long startIndex, long endIndex) {
public Highlight(long answerId, int lineIndex, int startIndex, int endIndex) {
this.answerId = answerId;
this.highlightPosition = new HighlightPosition(lineIndex, startIndex, endIndex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
public class HighlightPosition {

@Column(name = "line_index", nullable = false)
private long lineIndex;
private int lineIndex;

@Column(name = "start_index", nullable = false)
private long startIndex;
private int startIndex;

@Column(name = "end_index", nullable = false)
private long endIndex;
private int endIndex;

public HighlightPosition(long lineIndex, long startIndex, long endIndex) {
public HighlightPosition(int lineIndex, int startIndex, int endIndex) {
validateNonNegativeIndexNumber(startIndex, endIndex);
validateEndIndexOverStartIndex(startIndex, endIndex);
this.lineIndex = lineIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
public record HighlightIndexRangeRequest(

@NotNull(message = "시작 인덱스를 입력해주세요.")
Long startIndex,
Integer startIndex,

@NotNull(message = "끝 인덱스를 입력해주세요.")
Long endIndex
Integer endIndex
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public record HighlightedLineRequest(

@NotNull(message = "인덱스를 입력해주세요.")
Long index,
Integer index,

@Valid @NotEmpty(message = "하이라이트 범위를 입력해주세요.")
List<HighlightIndexRangeRequest> ranges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class HighlightServiceTest {
TextAnswer textAnswer2 = new TextAnswer(questionId, "text answer2");
Review review = reviewRepository.save(new Review(templateId, reviewGroupId, List.of(textAnswer1, textAnswer2)));

HighlightIndexRangeRequest indexRangeRequest = new HighlightIndexRangeRequest(1L, 1L);
HighlightedLineRequest lineRequest = new HighlightedLineRequest(0L, List.of(indexRangeRequest));
HighlightIndexRangeRequest indexRangeRequest = new HighlightIndexRangeRequest(1, 1);
HighlightedLineRequest lineRequest = new HighlightedLineRequest(0, List.of(indexRangeRequest));
HighlightRequest highlightRequest1 = new HighlightRequest(textAnswer1.getId(), List.of(lineRequest));
HighlightRequest highlightRequest2 = new HighlightRequest(textAnswer2.getId(), List.of(lineRequest));
HighlightsRequest highlightsRequest = new HighlightsRequest(
Expand Down Expand Up @@ -99,9 +99,9 @@ class HighlightServiceTest {
TextAnswer textAnswer2 = new TextAnswer(questionId, "text answer2");
Review review = reviewRepository.save(new Review(templateId, reviewGroupId, List.of(textAnswer1, textAnswer2)));

long startIndex = 2L;
long endIndex = 2L;
long lineIndex = 0;
int startIndex = 2;
int endIndex = 2;
int lineIndex = 0;
HighlightIndexRangeRequest indexRangeRequest = new HighlightIndexRangeRequest(startIndex, endIndex);
HighlightedLineRequest lineRequest1 = new HighlightedLineRequest(lineIndex, List.of(indexRangeRequest));
HighlightedLineRequest lineRequest2 = new HighlightedLineRequest(lineIndex, List.of(indexRangeRequest));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class HighlightValidatorTest {
Review review = reviewRepository.save(new Review(templateId, reviewGroupId, List.of(textAnswer)));

long answerLineCount = textAnswer.getContent().lines().count();
HighlightedLineRequest highlightedLineRequest = new HighlightedLineRequest(answerLineCount, List.of());
HighlightedLineRequest highlightedLineRequest = new HighlightedLineRequest((int) answerLineCount, List.of());
HighlightRequest highlightRequest = new HighlightRequest(textAnswer.getId(), List.of(highlightedLineRequest));
HighlightsRequest highlightsRequest = new HighlightsRequest(questionId, List.of(highlightRequest));

Expand Down