Добавил вывод ssh и http для уведомления о новом репозитории
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Struchkov Mark 2023-03-05 20:59:09 +03:00
parent 6dcd68655a
commit 244902d788
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6
7 changed files with 29 additions and 1 deletions

View File

@ -39,6 +39,12 @@ public class Project {
@Column(name = "web_url") @Column(name = "web_url")
private String webUrl; private String webUrl;
@Column(name = "ssh_url_to_repo")
private String sshUrlToRepo;
@Column(name = "http_url_to_repo")
private String httpUrlToRepo;
@Column(name = "notification") @Column(name = "notification")
private boolean notification; private boolean notification;

View File

@ -21,6 +21,8 @@ public final class NewProjectNotify implements Notify {
private final String projectUrl; private final String projectUrl;
private final String projectDescription; private final String projectDescription;
private final String authorName; private final String authorName;
private final String sshUrlToRepo;
private final String httpUrlToRepo;
@Builder @Builder
public NewProjectNotify( public NewProjectNotify(
@ -28,13 +30,17 @@ public final class NewProjectNotify implements Notify {
String projectName, String projectName,
String projectUrl, String projectUrl,
String projectDescription, String projectDescription,
String authorName String authorName,
String sshUrlToRepo,
String httpUrlToRepo
) { ) {
this.projectId = projectId; this.projectId = projectId;
this.projectName = projectName; this.projectName = projectName;
this.projectUrl = projectUrl; this.projectUrl = projectUrl;
this.projectDescription = projectDescription; this.projectDescription = projectDescription;
this.authorName = authorName; this.authorName = authorName;
this.sshUrlToRepo = sshUrlToRepo;
this.httpUrlToRepo = httpUrlToRepo;
} }
@Override @Override

View File

@ -22,6 +22,8 @@ public class ProjectJsonConverter implements Converter<ProjectJson, Project> {
project.setDescription(source.getDescription()); project.setDescription(source.getDescription());
project.setName(source.getName()); project.setName(source.getName());
project.setWebUrl(source.getWebUrl()); project.setWebUrl(source.getWebUrl());
project.setHttpUrlToRepo(source.getHttpUrlToRepo());
project.setSshUrlToRepo(source.getSshUrlToRepo());
return project; return project;
} }

View File

@ -118,6 +118,8 @@ public class ProjectServiceImpl implements ProjectService {
.projectDescription(newProject.getDescription()) .projectDescription(newProject.getDescription())
.projectName(newProject.getName()) .projectName(newProject.getName())
.projectUrl(newProject.getWebUrl()) .projectUrl(newProject.getWebUrl())
.sshUrlToRepo(newProject.getSshUrlToRepo())
.httpUrlToRepo(newProject.getHttpUrlToRepo())
.authorName(authorName) .authorName(authorName)
.build() .build()
); );

View File

@ -45,6 +45,8 @@
<column name="web_url" type="varchar(300)"> <column name="web_url" type="varchar(300)">
<constraints nullable="false"/> <constraints nullable="false"/>
</column> </column>
<column name="ssh_url_to_repo" type="varchar(300)"/>
<column name="http_url_to_repo" type="varchar(300)"/>
<column name="notification" type="boolean"> <column name="notification" type="boolean">
<constraints nullable="false"/> <constraints nullable="false"/>
</column> </column>

View File

@ -27,6 +27,12 @@ public class ProjectJson {
@JsonProperty("web_url") @JsonProperty("web_url")
private String webUrl; private String webUrl;
@JsonProperty("ssh_url_to_repo")
private String sshUrlToRepo;
@JsonProperty("http_url_to_repo")
private String httpUrlToRepo;
@JsonProperty("creator_id") @JsonProperty("creator_id")
private Long creatorId; private Long creatorId;

View File

@ -38,6 +38,10 @@ public class NewProjectNotifyGenerator implements NotifyBoxAnswerGenerator<NewPr
.append(Icons.HR); .append(Icons.HR);
} }
builder.append("ssh: ").append("`").append(notify.getSshUrlToRepo()).append("`\n\n")
.append("http: ").append("`").append(notify.getHttpUrlToRepo()).append("`")
.append(Icons.HR);
builder.append(Icons.AUTHOR).append(": ").append(escapeMarkdown(notify.getAuthorName())); builder.append(Icons.AUTHOR).append(": ").append(escapeMarkdown(notify.getAuthorName()));
final String notifyMessage = builder.toString(); final String notifyMessage = builder.toString();