-
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.
- Loading branch information
1 parent
38a7af8
commit db23fe7
Showing
25 changed files
with
235 additions
and
269 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
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
25 changes: 25 additions & 0 deletions
25
...on-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issue/dto/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package de.tum.in.www1.hephaestus.gitprovider.issue.dto; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.lang.NonNull; | ||
|
||
import de.tum.in.www1.hephaestus.gitprovider.issue.Issue.State; | ||
import de.tum.in.www1.hephaestus.gitprovider.label.dto.LabelInfoDTO; | ||
import de.tum.in.www1.hephaestus.gitprovider.user.dto.UserInfoDTO; | ||
|
||
public record IssueInfoDTO( | ||
@NonNull Long id, | ||
@NonNull Integer number, | ||
@NonNull String title, | ||
@NonNull State state, | ||
@NonNull Integer commentsCount, | ||
UserInfoDTO author, | ||
List<LabelInfoDTO> labels, | ||
List<UserInfoDTO> assignees, | ||
@NonNull String repositoryNameWithOwner, | ||
@NonNull String htmlUrl, | ||
@NonNull String createdAt, | ||
@NonNull String updatedAt | ||
) { | ||
} |
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
25 changes: 0 additions & 25 deletions
25
...ver/src/main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/IssueCommentDTO.java
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
...main/java/de/tum/in/www1/hephaestus/gitprovider/issuecomment/dto/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package de.tum.in.www1.hephaestus.gitprovider.issuecomment.dto; | ||
|
||
import org.springframework.lang.NonNull; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import de.tum.in.www1.hephaestus.gitprovider.common.AuthorAssociation; | ||
import de.tum.in.www1.hephaestus.gitprovider.issue.dto.IssueInfoDTO; | ||
import de.tum.in.www1.hephaestus.gitprovider.user.dto.UserInfoDTO; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
public record IssueCommentInfoDTO( | ||
@NonNull Long id, | ||
@NonNull AuthorAssociation authorAssociation, | ||
UserInfoDTO author, | ||
IssueInfoDTO issue, | ||
@NonNull String htmlUrl, | ||
@NonNull String createdAt, | ||
@NonNull String updatedAt) { | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...on-server/src/main/java/de/tum/in/www1/hephaestus/gitprovider/label/dto/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,9 @@ | ||
package de.tum.in.www1.hephaestus.gitprovider.label.dto; | ||
|
||
import org.springframework.lang.NonNull; | ||
|
||
public record LabelInfoDTO( | ||
@NonNull Long id, | ||
@NonNull String name, | ||
@NonNull String color) { | ||
} |
19 changes: 19 additions & 0 deletions
19
...r/src/main/java/de/tum/in/www1/hephaestus/gitprovider/milestone/dto/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package de.tum.in.www1.hephaestus.gitprovider.milestone.dto; | ||
|
||
import org.springframework.lang.NonNull; | ||
|
||
import de.tum.in.www1.hephaestus.gitprovider.milestone.Milestone.State; | ||
|
||
public record MilestoneInfoDTO( | ||
@NonNull Long id, | ||
@NonNull Integer number, | ||
@NonNull State state, | ||
@NonNull String title, | ||
String description, | ||
String closedAt, | ||
String dueOn, | ||
@NonNull String htmlUrl, | ||
@NonNull String createdAt, | ||
@NonNull String updatedAt | ||
) { | ||
} |
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
36 changes: 0 additions & 36 deletions
36
...erver/src/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestDTO.java
This file was deleted.
Oops, something went wrong.
38 changes: 33 additions & 5 deletions
38
...rc/main/java/de/tum/in/www1/hephaestus/gitprovider/pullrequest/PullRequestRepository.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,23 +1,51 @@ | ||
package de.tum.in.www1.hephaestus.gitprovider.pullrequest; | ||
|
||
import java.util.Optional; | ||
import java.time.OffsetDateTime; | ||
import java.util.Set; | ||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import de.tum.in.www1.hephaestus.gitprovider.pullrequest.dto.PullRequestInfoDTO; | ||
|
||
@Repository | ||
public interface PullRequestRepository extends JpaRepository<PullRequest, Long> { | ||
|
||
Set<PullRequest> findByAuthor_Login(String authorLogin); | ||
|
||
@Query(""" | ||
SELECT p | ||
SELECT MIN(p.createdAt) | ||
FROM PullRequest p | ||
WHERE p.author.login = :authorLogin | ||
""") | ||
Optional<OffsetDateTime> firstContributionByAuthorLogin(@Param("authorLogin") String authorLogin); | ||
|
||
@Query(""" | ||
SELECT new PullRequestInfoDTO( | ||
p.id, | ||
p.number, | ||
p.title, | ||
p.state, | ||
p.commentCount, | ||
new UserInfoDTO(p.author.id, p.author.login, p.author.avatarUrl, p.author.name, p.author.htmlUrl, p.author.createdAt, p.author.updatedAt), | ||
(SELECT new LabelInfoDTO(l.id, l.name, l.color) FROM Label l WHERE l MEMBER OF p.labels ORDER BY l.name), | ||
(SELECT new UserInfoDTO(u.id, u.login, u.avatarUrl, u.name, u.htmlUrl, u.createdAt, u.updatedAt) FROM User u WHERE u MEMBER OF p.assignees ORDER BY u.login), | ||
p.repository.nameWithOwner, | ||
p.additions, | ||
p.deletions, | ||
p.mergedAt, | ||
p.htmlUrl, | ||
p.createdAt, | ||
p.updatedAt) | ||
FROM PullRequest p | ||
JOIN FETCH p.comments | ||
JOIN FETCH p.reviews | ||
WHERE p.id = :id | ||
WHERE (p.author.login = :assigneeLogin OR :assigneeLogin IN (SELECT u.login FROM p.assignees u)) AND p.state IN :states | ||
ORDER BY p.createdAt DESC | ||
""") | ||
Optional<PullRequest> findByIdWithEagerRelations(Long id); | ||
List<PullRequestInfoDTO> findAssignedByLoginAndStates( | ||
@Param("assigneeLogin") String assigneeLogin, | ||
@Param("states") Set<PullRequest.State> states); | ||
} |
Oops, something went wrong.