diff --git a/src/main/java/com/tsc/bitbucketbot/config/AppConfig.java b/src/main/java/com/tsc/bitbucketbot/config/AppConfig.java index f978d82..1dd0ae6 100644 --- a/src/main/java/com/tsc/bitbucketbot/config/AppConfig.java +++ b/src/main/java/com/tsc/bitbucketbot/config/AppConfig.java @@ -13,7 +13,7 @@ public class AppConfig { @Bean public TaskScheduler taskScheduler() { ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler(); - taskScheduler.setPoolSize(5); + taskScheduler.setPoolSize(6); return taskScheduler; } diff --git a/src/main/java/com/tsc/bitbucketbot/config/BitbucketConfig.java b/src/main/java/com/tsc/bitbucketbot/config/BitbucketConfig.java index 32a173e..90ba88d 100644 --- a/src/main/java/com/tsc/bitbucketbot/config/BitbucketConfig.java +++ b/src/main/java/com/tsc/bitbucketbot/config/BitbucketConfig.java @@ -17,5 +17,6 @@ public class BitbucketConfig { private String token; private String urlPullRequestOpen; private String urlPullRequestClose; + private String urlPullRequestComment; } diff --git a/src/main/java/com/tsc/bitbucketbot/domain/entity/PullRequest.java b/src/main/java/com/tsc/bitbucketbot/domain/entity/PullRequest.java index 4462b52..834c098 100644 --- a/src/main/java/com/tsc/bitbucketbot/domain/entity/PullRequest.java +++ b/src/main/java/com/tsc/bitbucketbot/domain/entity/PullRequest.java @@ -50,6 +50,12 @@ public class PullRequest { @Column(name = "repository_id") private Long repositoryId; + @Column(name = "project_key") + private String projectKey; + + @Column(name = "repository_slug") + private String repositorySlug; + @Column(name = "version") private Integer version; diff --git a/src/main/java/com/tsc/bitbucketbot/dto/bitbucket/ProjectJson.java b/src/main/java/com/tsc/bitbucketbot/dto/bitbucket/ProjectJson.java new file mode 100644 index 0000000..08337ea --- /dev/null +++ b/src/main/java/com/tsc/bitbucketbot/dto/bitbucket/ProjectJson.java @@ -0,0 +1,10 @@ +package com.tsc.bitbucketbot.dto.bitbucket; + +import lombok.Data; + +@Data +public class ProjectJson { + + private String key; + +} diff --git a/src/main/java/com/tsc/bitbucketbot/dto/bitbucket/RepositoryJson.java b/src/main/java/com/tsc/bitbucketbot/dto/bitbucket/RepositoryJson.java index 1f81498..3817e39 100644 --- a/src/main/java/com/tsc/bitbucketbot/dto/bitbucket/RepositoryJson.java +++ b/src/main/java/com/tsc/bitbucketbot/dto/bitbucket/RepositoryJson.java @@ -11,5 +11,7 @@ import lombok.Data; public class RepositoryJson { private Long id; + private String slug; + private ProjectJson project; } diff --git a/src/main/java/com/tsc/bitbucketbot/dto/bitbucket/Sheet.java b/src/main/java/com/tsc/bitbucketbot/dto/bitbucket/Sheet.java index f440ca4..5bb3e5d 100644 --- a/src/main/java/com/tsc/bitbucketbot/dto/bitbucket/Sheet.java +++ b/src/main/java/com/tsc/bitbucketbot/dto/bitbucket/Sheet.java @@ -18,4 +18,8 @@ public abstract class Sheet { private List values; private Integer nextPageStart; + public boolean hasContent() { + return values != null && !values.isEmpty(); + } + } diff --git a/src/main/java/com/tsc/bitbucketbot/service/PullRequestsService.java b/src/main/java/com/tsc/bitbucketbot/service/PullRequestsService.java index aedb15c..9173549 100644 --- a/src/main/java/com/tsc/bitbucketbot/service/PullRequestsService.java +++ b/src/main/java/com/tsc/bitbucketbot/service/PullRequestsService.java @@ -1,8 +1,10 @@ package com.tsc.bitbucketbot.service; +import com.tsc.bitbucketbot.domain.Pagination; import com.tsc.bitbucketbot.domain.ReviewerStatus; import com.tsc.bitbucketbot.domain.entity.PullRequest; import lombok.NonNull; +import org.springframework.data.domain.Page; import java.util.Collection; import java.util.List; @@ -37,4 +39,6 @@ public interface PullRequestsService { Set getAllId(); + Page getAll(@NonNull Pagination pagination); + } diff --git a/src/main/java/com/tsc/bitbucketbot/service/converter/PullRequestJsonConverter.java b/src/main/java/com/tsc/bitbucketbot/service/converter/PullRequestJsonConverter.java index eebc845..e9e708a 100644 --- a/src/main/java/com/tsc/bitbucketbot/service/converter/PullRequestJsonConverter.java +++ b/src/main/java/com/tsc/bitbucketbot/service/converter/PullRequestJsonConverter.java @@ -42,6 +42,8 @@ public class PullRequestJsonConverter implements Converter getAll(@NonNull Pagination pagination) { + return pullRequestsRepository.findAll(PageRequest.of(pagination.getPage(), pagination.getSize())); + } + } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 2ad64c1..932c4cc 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -23,5 +23,6 @@ bitbucketbot: token: Nzg5NjUyNDQwMzk2OlA+6naQz02+GxOG0Q9li/jnsn7E url-pull-request-open: http://localhost:7990/rest/api/1.0/dashboard/pull-requests?limit=150&state=OPEN url-pull-request-close: http://localhost:7990/rest/api/1.0/dashboard/pull-requests?limit=150&closedSince=86400 + url-pull-request-comment: http://localhost:7990/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments/{commentId} server: port: 8018 diff --git a/src/main/resources/liquibase/change-log.xml b/src/main/resources/liquibase/change-log.xml index a84e0ec..db0a65f 100644 --- a/src/main/resources/liquibase/change-log.xml +++ b/src/main/resources/liquibase/change-log.xml @@ -5,5 +5,6 @@ + \ No newline at end of file diff --git a/src/main/resources/liquibase/change-set/v1.3.0.xml b/src/main/resources/liquibase/change-set/v1.3.0.xml new file mode 100644 index 0000000..eddfc13 --- /dev/null +++ b/src/main/resources/liquibase/change-set/v1.3.0.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file