-
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 issue comments to leaderboard and profile
- Loading branch information
1 parent
73e75d7
commit e5b8cd8
Showing
29 changed files
with
325 additions
and
327 deletions.
There are no files selected for viewing
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
6 changes: 3 additions & 3 deletions
6
...s/gitprovider/issue/dto/IssueInfoDTO.java → ...estus/gitprovider/issue/IssueInfoDTO.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
6 changes: 3 additions & 3 deletions
6
...issuecomment/dto/IssueCommentInfoDTO.java → ...der/issuecomment/IssueCommentInfoDTO.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
40 changes: 40 additions & 0 deletions
40
.../main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueCommentRepository.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 |
---|---|---|
@@ -1,7 +1,47 @@ | ||
package de.tum.in.www1.hephaestus.gitprovider.issuecomment; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
public interface IssueCommentRepository extends JpaRepository<IssueComment, Long> { | ||
|
||
@Query(""" | ||
SELECT ic | ||
FROM IssueComment ic | ||
LEFT JOIN FETCH ic.author | ||
LEFT JOIN FETCH ic.issue | ||
LEFT JOIN FETCH ic.issue.repository | ||
WHERE | ||
ic.author.login = :authorLogin AND ic.createdAt >= :activitySince | ||
AND (:onlyFromPullRequests = false OR ic.issue.htmlUrl LIKE '%/pull/%') | ||
ORDER BY ic.createdAt DESC | ||
""") | ||
List<IssueComment> findAllByAuthorLoginSince( | ||
@Param("authorLogin") String authorLogin, | ||
@Param("activitySince") OffsetDateTime activitySince, | ||
@Param("onlyFromPullRequests") boolean onlyFromPullRequests); | ||
|
||
@Query(""" | ||
SELECT ic | ||
FROM IssueComment ic | ||
LEFT JOIN FETCH ic.author | ||
LEFT JOIN FETCH ic.issue | ||
LEFT JOIN FETCH ic.issue.repository | ||
WHERE | ||
ic.createdAt BETWEEN :after AND :before | ||
AND (:repository IS NULL OR ic.issue.repository.nameWithOwner = :repository) | ||
AND ic.author.type = 'USER' | ||
AND (:onlyFromPullRequests = false OR ic.issue.htmlUrl LIKE '%/pull/%') | ||
ORDER BY ic.createdAt DESC | ||
""") | ||
List<IssueComment> findAllInTimeframe( | ||
@Param("after") OffsetDateTime after, | ||
@Param("before") OffsetDateTime before, | ||
@Param("repository") Optional<String> repository, | ||
@Param("onlyFromPullRequests") boolean onlyFromPullRequests); | ||
} |
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
16 changes: 16 additions & 0 deletions
16
...cation-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/label/LabelInfoDTO.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,16 @@ | ||
package de.tum.in.www1.hephaestus.gitprovider.label; | ||
|
||
import org.springframework.lang.NonNull; | ||
|
||
public record LabelInfoDTO( | ||
@NonNull Long id, | ||
@NonNull String name, | ||
@NonNull String color) { | ||
|
||
public static LabelInfoDTO fromLabel(Label label) { | ||
return new LabelInfoDTO( | ||
label.getId(), | ||
label.getName(), | ||
label.getColor()); | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
...rver/src/main/java/de/tum/in/www1/hephaestus/gitprovider/label/dto/LabelDTOConverter.java
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
...on-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/label/dto/LabelInfoDTO.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...vider/milestone/dto/MilestoneInfoDTO.java → ...tprovider/milestone/MilestoneInfoDTO.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
44 changes: 44 additions & 0 deletions
44
...c/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestBaseInfoDTO.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,44 @@ | ||
package de.tum.in.www1.hephaestus.gitprovider.pullrequest; | ||
|
||
import org.springframework.lang.NonNull; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import de.tum.in.www1.hephaestus.gitprovider.issue.Issue; | ||
import de.tum.in.www1.hephaestus.gitprovider.issue.Issue.State; | ||
import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryInfoDTO; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
public record PullRequestBaseInfoDTO( | ||
@NonNull Long id, | ||
@NonNull Integer number, | ||
@NonNull String title, | ||
@NonNull State state, | ||
@NonNull Boolean isDraft, | ||
@NonNull Boolean isMerged, | ||
RepositoryInfoDTO repository, | ||
@NonNull String htmlUrl) { | ||
|
||
public static PullRequestBaseInfoDTO fromPullRequest(PullRequest pullRequest) { | ||
return new PullRequestBaseInfoDTO( | ||
pullRequest.getId(), | ||
pullRequest.getNumber(), | ||
pullRequest.getTitle(), | ||
pullRequest.getState(), | ||
pullRequest.isDraft(), | ||
pullRequest.isMerged(), | ||
RepositoryInfoDTO.fromRepository(pullRequest.getRepository()), | ||
pullRequest.getHtmlUrl()); | ||
} | ||
|
||
public static PullRequestBaseInfoDTO fromIssue(Issue issue) { | ||
return new PullRequestBaseInfoDTO( | ||
issue.getId(), | ||
issue.getNumber(), | ||
issue.getTitle(), | ||
issue.getState(), | ||
false, | ||
false, | ||
RepositoryInfoDTO.fromRepository(issue.getRepository()), | ||
issue.getHtmlUrl()); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...r/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestInfoDTO.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,66 @@ | ||
package de.tum.in.www1.hephaestus.gitprovider.pullrequest; | ||
|
||
import java.util.Comparator; | ||
import java.util.List; | ||
import java.time.OffsetDateTime; | ||
|
||
import org.springframework.lang.NonNull; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import de.tum.in.www1.hephaestus.gitprovider.issue.Issue.State; | ||
import de.tum.in.www1.hephaestus.gitprovider.label.LabelInfoDTO; | ||
import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryInfoDTO; | ||
import de.tum.in.www1.hephaestus.gitprovider.user.UserInfoDTO; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
public record PullRequestInfoDTO( | ||
@NonNull Long id, | ||
@NonNull Integer number, | ||
@NonNull String title, | ||
@NonNull State state, | ||
@NonNull Boolean isDraft, | ||
@NonNull Boolean isMerged, | ||
@NonNull Integer commentsCount, | ||
UserInfoDTO author, | ||
List<LabelInfoDTO> labels, | ||
List<UserInfoDTO> assignees, | ||
RepositoryInfoDTO repository, | ||
@NonNull Integer additions, | ||
@NonNull Integer deletions, | ||
OffsetDateTime mergedAt, | ||
OffsetDateTime closedAt, | ||
@NonNull String htmlUrl, | ||
OffsetDateTime createdAt, | ||
OffsetDateTime updatedAt) { | ||
|
||
public static PullRequestInfoDTO fromPullRequest(PullRequest pullRequest) { | ||
return new PullRequestInfoDTO( | ||
pullRequest.getId(), | ||
pullRequest.getNumber(), | ||
pullRequest.getTitle(), | ||
pullRequest.getState(), | ||
pullRequest.isDraft(), | ||
pullRequest.isMerged(), | ||
pullRequest.getCommentsCount(), | ||
UserInfoDTO.fromUser(pullRequest.getAuthor()), | ||
pullRequest.getLabels() | ||
.stream() | ||
.map(LabelInfoDTO::fromLabel) | ||
.sorted(Comparator.comparing(LabelInfoDTO::name)) | ||
.toList(), | ||
pullRequest.getAssignees() | ||
.stream() | ||
.map(UserInfoDTO::fromUser) | ||
.sorted(Comparator.comparing(UserInfoDTO::login)) | ||
.toList(), | ||
RepositoryInfoDTO.fromRepository(pullRequest.getRepository()), | ||
pullRequest.getAdditions(), | ||
pullRequest.getDeletions(), | ||
pullRequest.getMergedAt(), | ||
pullRequest.getClosedAt(), | ||
pullRequest.getHtmlUrl(), | ||
pullRequest.getCreatedAt(), | ||
pullRequest.getUpdatedAt()); | ||
} | ||
|
||
} |
20 changes: 0 additions & 20 deletions
20
...in/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/dto/PullRequestBaseInfoDTO.java
This file was deleted.
Oops, something went wrong.
72 changes: 0 additions & 72 deletions
72
...n/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/dto/PullRequestDTOConverter.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.