-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ReviewComments and refactor IssueComments
- Loading branch information
Showing
9 changed files
with
155 additions
and
27 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...r/application-server/src/main/java/de/tum/in/www1/hephaestus/codereview/base/Comment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package de.tum.in.www1.hephaestus.codereview.base; | ||
|
||
import de.tum.in.www1.hephaestus.codereview.user.User; | ||
import jakarta.persistence.Basic; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.Lob; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.MappedSuperclass; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@MappedSuperclass | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@ToString(callSuper = true) | ||
public abstract class Comment extends BaseGitServiceEntity { | ||
@Lob | ||
@Basic(fetch = FetchType.EAGER) | ||
protected String body; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "author_id") | ||
@ToString.Exclude | ||
protected User author; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...rver/src/main/java/de/tum/in/www1/hephaestus/codereview/comment/review/ReviewComment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package de.tum.in.www1.hephaestus.codereview.comment.review; | ||
|
||
import org.springframework.lang.NonNull; | ||
|
||
import de.tum.in.www1.hephaestus.codereview.base.Comment; | ||
import de.tum.in.www1.hephaestus.codereview.pullrequest.review.PullRequestReview; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.Table; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@Entity | ||
@Table(name = "review_comment") | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@ToString(callSuper = true) | ||
public class ReviewComment extends Comment { | ||
@ManyToOne(optional = false) | ||
@JoinColumn(name = "review_id", referencedColumnName = "id") | ||
@ToString.Exclude | ||
private PullRequestReview review; | ||
|
||
@NonNull | ||
private String commit; | ||
} |
21 changes: 21 additions & 0 deletions
21
...main/java/de/tum/in/www1/hephaestus/codereview/comment/review/ReviewCommentConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package de.tum.in.www1.hephaestus.codereview.comment.review; | ||
|
||
import org.kohsuke.github.GHPullRequestReviewComment; | ||
import org.springframework.lang.NonNull; | ||
import org.springframework.stereotype.Component; | ||
|
||
import de.tum.in.www1.hephaestus.codereview.base.BaseGitServiceEntityConverter; | ||
|
||
@Component | ||
public class ReviewCommentConverter extends BaseGitServiceEntityConverter<GHPullRequestReviewComment, ReviewComment> { | ||
|
||
@Override | ||
public ReviewComment convert(@NonNull GHPullRequestReviewComment source) { | ||
ReviewComment comment = new ReviewComment(); | ||
convertBaseFields(source, comment); | ||
comment.setBody(source.getBody()); | ||
comment.setCommit(source.getCommitId()); | ||
return comment; | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
...ain/java/de/tum/in/www1/hephaestus/codereview/comment/review/ReviewCommentRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package de.tum.in.www1.hephaestus.codereview.comment.review; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface ReviewCommentRepository extends JpaRepository<ReviewComment, Long> { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters