Первая версия нотификации при упоминании в комментарии
This commit is contained in:
parent
e9d43f8e66
commit
41b329cc7f
@ -13,7 +13,7 @@ public class AppConfig {
|
||||
@Bean
|
||||
public TaskScheduler taskScheduler() {
|
||||
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
|
||||
taskScheduler.setPoolSize(5);
|
||||
taskScheduler.setPoolSize(6);
|
||||
return taskScheduler;
|
||||
}
|
||||
|
||||
|
@ -17,5 +17,6 @@ public class BitbucketConfig {
|
||||
private String token;
|
||||
private String urlPullRequestOpen;
|
||||
private String urlPullRequestClose;
|
||||
private String urlPullRequestComment;
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.tsc.bitbucketbot.dto.bitbucket;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProjectJson {
|
||||
|
||||
private String key;
|
||||
|
||||
}
|
@ -11,5 +11,7 @@ import lombok.Data;
|
||||
public class RepositoryJson {
|
||||
|
||||
private Long id;
|
||||
private String slug;
|
||||
private ProjectJson project;
|
||||
|
||||
}
|
||||
|
@ -18,4 +18,8 @@ public abstract class Sheet<T> {
|
||||
private List<T> values;
|
||||
private Integer nextPageStart;
|
||||
|
||||
public boolean hasContent() {
|
||||
return values != null && !values.isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<Long> getAllId();
|
||||
|
||||
Page<PullRequest> getAll(@NonNull Pagination pagination);
|
||||
|
||||
}
|
||||
|
@ -42,6 +42,8 @@ public class PullRequestJsonConverter implements Converter<PullRequestJson, Pull
|
||||
.name(json.getTitle())
|
||||
.url(json.getLinks().getSelf().get(0).getHref())
|
||||
.status(convertPullRequestStatus(json.getState()))
|
||||
.projectKey(json.getFromRef().getRepository().getProject().getKey())
|
||||
.repositorySlug(json.getFromRef().getRepository().getSlug())
|
||||
.reviewers(convertReviewers(json.getReviewers()))
|
||||
.build();
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
package com.tsc.bitbucketbot.service.impl;
|
||||
|
||||
import com.tsc.bitbucketbot.domain.Pagination;
|
||||
import com.tsc.bitbucketbot.domain.ReviewerStatus;
|
||||
import com.tsc.bitbucketbot.domain.entity.PullRequest;
|
||||
import com.tsc.bitbucketbot.repository.jpa.PullRequestsRepository;
|
||||
import com.tsc.bitbucketbot.service.PullRequestsService;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
@ -77,4 +80,9 @@ public class PullRequestsServiceImpl implements PullRequestsService {
|
||||
return pullRequestsRepository.getAllIds();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PullRequest> getAll(@NonNull Pagination pagination) {
|
||||
return pullRequestsRepository.findAll(PageRequest.of(pagination.getPage(), pagination.getSize()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -5,5 +5,6 @@
|
||||
|
||||
<include file="liquibase/change-set/create-table.xml"/>
|
||||
<include file="liquibase/change-set/v1.2.0.xml"/>
|
||||
<include file="liquibase/change-set/v1.3.0.xml"/>
|
||||
|
||||
</databaseChangeLog>
|
28
src/main/resources/liquibase/change-set/v1.3.0.xml
Normal file
28
src/main/resources/liquibase/change-set/v1.3.0.xml
Normal file
@ -0,0 +1,28 @@
|
||||
<databaseChangeLog
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
|
||||
<changeSet id="v1.3.0-add-column-pr" author="upagge">
|
||||
<addColumn tableName="pull_request" schemaName="public" catalogName="pg_catalog">
|
||||
<column name="project_key" type="varchar(50)"/>
|
||||
</addColumn>
|
||||
|
||||
<addColumn tableName="pull_request" schemaName="public" catalogName="pg_catalog">
|
||||
<column name="repository_slug" type="varchar(50)"/>
|
||||
</addColumn>
|
||||
|
||||
<createTable tableName="tech_info">
|
||||
<column name="surogat_id" type="int">
|
||||
<constraints primaryKey="true"/>
|
||||
</column>
|
||||
<column name="last_comment_id" type="int"/>
|
||||
</createTable>
|
||||
|
||||
<insert tableName="tech_info" schemaName="public" catalogName="pg_catalog">
|
||||
<column name="surogat_id" value="1"/>
|
||||
<column name="last_comment_id" value="4500"/>
|
||||
</insert>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
Loading…
Reference in New Issue
Block a user