-
Notifications
You must be signed in to change notification settings - Fork 2
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] feat: 하이라이트 추가 및 수정 API 구현 #813
Changes from 1 commit
c62884c
5979829
fa5aa38
b55df2f
cbbc950
84898cf
2b74e5e
eb1459e
f4418cc
921cc6e
b3a58c3
a88d090
b8ce456
ad59c37
f87efad
d3abfd3
95cf051
bb9ebb1
c700e45
834d900
16f5d34
f71d9de
4b28bd4
cd6a16c
fbd8fc4
1ce93e6
ba72762
1c16507
a7f25b8
52c350b
7e546aa
55895db
aaf1c6c
560faec
a3a968f
c226e21
132ff57
a9ceb36
24b706b
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package reviewme.highlight.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import lombok.AccessLevel; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Table(name = "highlight") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@EqualsAndHashCode(of = "id") | ||
@Getter | ||
public class HighLight { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(name = "question_id", nullable = false) | ||
private long questionId; | ||
|
||
@Column(name = "review_group_id", nullable = false) | ||
private long reviewGroupId; | ||
|
||
@Column(name = "answer_id", nullable = false) | ||
private long answerId; | ||
|
||
@Column(name = "line_index", nullable = false) | ||
private long lineIndex; | ||
|
||
@Column(name = "start_index", nullable = false) | ||
private long startIndex; | ||
|
||
@Column(name = "end_index", nullable = false) | ||
private long endIndex; | ||
|
||
public HighLight(long answerId, long questionId, long reviewGroupId, | ||
long lineIndex, long startIndex, long endIndex) { | ||
this.answerId = answerId; | ||
this.questionId = questionId; | ||
this.reviewGroupId = reviewGroupId; | ||
this.lineIndex = lineIndex; | ||
this.startIndex = startIndex; | ||
this.endIndex = endIndex; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package reviewme.highlight.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import reviewme.highlight.domain.HighLight; | ||
|
||
public interface HighlightRepository extends JpaRepository<HighLight, Long> { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- highlight 테이블을 생성합니다. | ||
|
||
CREATE TABLE highlight | ||
( | ||
id BIGINT AUTO_INCREMENT, | ||
questionId BIGINT NOT NULl, | ||
review_group_id BIGINT NOT NULl, | ||
answer_id BIGINT NOT NULl, | ||
line_index BIGINT NOT NULl, | ||
start_index BIGINT NOT NULl, | ||
end_index BIGINT NOT NULl, | ||
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.
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.
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. db에 차지하는 크기를 줄이는 목적이니 ddl만 바꾸면 된다는 말이죠? 반영완! 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. (어플리케이션이 DB에 종속적일 필요가 없다는 맥락에서 바꾸지 않아도 된다는 이야기를 했슴다) |
||
PRIMARY KEY (id) | ||
); |
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.
굳이 questionId와 reviewId를 가지고 있지 않아도 되지 않을까요?
answerId로 소속은 충분히 알 수 있다고 생각해요,
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.
questionId와 reviewGroupId를 말하는 게 맞겠죠?
새로운 하이라이트가 들어왔을 때 question id = ? and review_group_id = ? 인 조건문으로 기존 데이터 삭제를 진행하기 떄문에 넣었어요~
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.
JOIN
해서DELETE
하는 게 좋지 않을까요? 데이터 삭제에만 필요한 것이 DB에 속성으로 등록될 필요가 있을지 고민해보아야겠네용,,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.
맞네요 answerId로 처리하고 review group id와 question id는 뺐어요!