-
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
Showing
10 changed files
with
148 additions
and
43 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
21 changes: 21 additions & 0 deletions
21
...rc/main/java/de/tum/in/www1/hephaestus/activity/PullRequestBadPracticeRuleRepository.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.activity; | ||
|
||
import de.tum.in.www1.hephaestus.activity.model.PullRequestBadPracticeRule; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface PullRequestBadPracticeRuleRepository extends JpaRepository<PullRequestBadPracticeRule, Long> { | ||
|
||
@Query( | ||
""" | ||
SELECT prbp | ||
FROM PullRequestBadPracticeRule prbp | ||
WHERE prbp.repository.name = :repositoryName | ||
""" | ||
) | ||
List<PullRequestBadPracticeRule> findByRepositoryName(String repositoryName); | ||
} |
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
7 changes: 2 additions & 5 deletions
7
...ver/src/main/java/de/tum/in/www1/hephaestus/activity/model/PullRequestBadPracticeDTO.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,11 +1,8 @@ | ||
package de.tum.in.www1.hephaestus.activity.model; | ||
|
||
public record PullRequestBadPracticeDTO(String title, String description) { | ||
public static PullRequestBadPracticeDTO fromPullRequestBadPracticeType(PullRequestBadPracticeType type) { | ||
return new PullRequestBadPracticeDTO(type.title, type.description); | ||
} | ||
public record PullRequestBadPracticeDTO(String title, String description, boolean resolved) { | ||
|
||
public static PullRequestBadPracticeDTO fromPullRequestBadPractice(PullRequestBadPractice badPractice) { | ||
return new PullRequestBadPracticeDTO(badPractice.getType().title, badPractice.getType().description); | ||
return new PullRequestBadPracticeDTO(badPractice.getRule().getTitle(), badPractice.getRule().getDescription(), badPractice.isResolved()); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...er/src/main/java/de/tum/in/www1/hephaestus/activity/model/PullRequestBadPracticeRule.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,34 @@ | ||
package de.tum.in.www1.hephaestus.activity.model; | ||
|
||
import de.tum.in.www1.hephaestus.gitprovider.repository.Repository; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@Entity | ||
@Setter | ||
@Getter | ||
@NoArgsConstructor | ||
@ToString | ||
public class PullRequestBadPracticeRule { | ||
|
||
@Id | ||
private Long id; | ||
|
||
private String title; | ||
|
||
private String description; | ||
|
||
private String conditions; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "repository_id") | ||
private Repository repository; | ||
|
||
private boolean active; | ||
} |
24 changes: 24 additions & 0 deletions
24
...src/main/java/de/tum/in/www1/hephaestus/activity/model/PullRequestBadPracticeRuleDTO.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,24 @@ | ||
package de.tum.in.www1.hephaestus.activity.model; | ||
|
||
|
||
import de.tum.in.www1.hephaestus.gitprovider.repository.RepositoryInfoDTO; | ||
|
||
public record PullRequestBadPracticeRuleDTO( | ||
Long id, | ||
String title, | ||
String description, | ||
String conditions, | ||
RepositoryInfoDTO repository, | ||
boolean active | ||
) { | ||
public static PullRequestBadPracticeRuleDTO fromPullRequestBadPracticeRule(PullRequestBadPracticeRule rule) { | ||
return new PullRequestBadPracticeRuleDTO( | ||
rule.getId(), | ||
rule.getTitle(), | ||
rule.getDescription(), | ||
rule.getConditions(), | ||
RepositoryInfoDTO.fromRepository(rule.getRepository()), | ||
rule.isActive() | ||
); | ||
} | ||
} |
19 changes: 0 additions & 19 deletions
19
...er/src/main/java/de/tum/in/www1/hephaestus/activity/model/PullRequestBadPracticeType.java
This file was deleted.
Oops, something went wrong.
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