Добавил генерацию типов нотификаций

This commit is contained in:
Struchkov Mark 2023-02-21 12:13:56 +03:00
parent 09e963bae6
commit d12b8f816b
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6
12 changed files with 58 additions and 14 deletions

View File

@ -1,10 +1,12 @@
package dev.struchkov.bot.gitlab.context.domain.notify.comment; package dev.struchkov.bot.gitlab.context.domain.notify.comment;
import dev.struchkov.bot.gitlab.context.domain.notify.Notify; import dev.struchkov.bot.gitlab.context.domain.notify.Notify;
import dev.struchkov.haiti.utils.fieldconstants.annotation.FieldNames;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
@Getter @Getter
@FieldNames
public final class NewCommentNotify implements Notify { public final class NewCommentNotify implements Notify {
public static final String TYPE = "NewCommentNotify"; public static final String TYPE = "NewCommentNotify";

View File

@ -1,12 +1,16 @@
package dev.struchkov.bot.gitlab.context.domain.notify.mergerequest; package dev.struchkov.bot.gitlab.context.domain.notify.mergerequest;
import dev.struchkov.haiti.utils.fieldconstants.annotation.FieldNames;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import static dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.ConflictMrNotifyFields.CLASS_NAME;
@Getter @Getter
@FieldNames
public class ConflictMrNotify extends MrNotify { public class ConflictMrNotify extends MrNotify {
public static final String TYPE = "ConflictPrNotify"; public static final String TYPE = CLASS_NAME;
private final String sourceBranch; private final String sourceBranch;

View File

@ -1,12 +1,16 @@
package dev.struchkov.bot.gitlab.context.domain.notify.mergerequest; package dev.struchkov.bot.gitlab.context.domain.notify.mergerequest;
import dev.struchkov.haiti.utils.fieldconstants.annotation.FieldNames;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import static dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.ConflictResolveMrNotifyFields.CLASS_NAME;
@Getter @Getter
@FieldNames
public class ConflictResolveMrNotify extends MrNotify { public class ConflictResolveMrNotify extends MrNotify {
public static final String TYPE = "ConflictResolveMrNotify"; public static final String TYPE = CLASS_NAME;
private final String sourceBranch; private final String sourceBranch;

View File

@ -1,5 +1,6 @@
package dev.struchkov.bot.gitlab.context.domain.notify.mergerequest; package dev.struchkov.bot.gitlab.context.domain.notify.mergerequest;
import dev.struchkov.haiti.utils.fieldconstants.annotation.FieldNames;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import lombok.Singular; import lombok.Singular;
@ -7,10 +8,13 @@ import lombok.Singular;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import static dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.NewMrForAssigneeFields.CLASS_NAME;
@Getter @Getter
@FieldNames
public class NewMrForAssignee extends NewMrNotify { public class NewMrForAssignee extends NewMrNotify {
public static final String TYPE = "NewMrForAssignee"; public static final String TYPE = CLASS_NAME;
private final List<String> reviewers; private final List<String> reviewers;
private final String oldAssigneeName; private final String oldAssigneeName;

View File

@ -1,14 +1,18 @@
package dev.struchkov.bot.gitlab.context.domain.notify.mergerequest; package dev.struchkov.bot.gitlab.context.domain.notify.mergerequest;
import dev.struchkov.haiti.utils.fieldconstants.annotation.FieldNames;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import java.util.Set; import java.util.Set;
import static dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.NewMrForReviewFields.CLASS_NAME;
@Getter @Getter
@FieldNames
public class NewMrForReview extends NewMrNotify { public class NewMrForReview extends NewMrNotify {
public static final String TYPE = "NewMrForReview"; public static final String TYPE = CLASS_NAME;
private final String assignee; private final String assignee;

View File

@ -1,13 +1,17 @@
package dev.struchkov.bot.gitlab.context.domain.notify.mergerequest; package dev.struchkov.bot.gitlab.context.domain.notify.mergerequest;
import dev.struchkov.bot.gitlab.context.domain.MergeRequestState; import dev.struchkov.bot.gitlab.context.domain.MergeRequestState;
import dev.struchkov.haiti.utils.fieldconstants.annotation.FieldNames;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import static dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.StatusMrNotifyFields.CLASS_NAME;
@Getter @Getter
@FieldNames
public class StatusMrNotify extends MrNotify { public class StatusMrNotify extends MrNotify {
public static final String TYPE = "StatusPrNotify"; public static final String TYPE = CLASS_NAME;
private final MergeRequestState oldStatus; private final MergeRequestState oldStatus;
private final MergeRequestState newStatus; private final MergeRequestState newStatus;

View File

@ -1,12 +1,16 @@
package dev.struchkov.bot.gitlab.context.domain.notify.mergerequest; package dev.struchkov.bot.gitlab.context.domain.notify.mergerequest;
import dev.struchkov.haiti.utils.fieldconstants.annotation.FieldNames;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import static dev.struchkov.bot.gitlab.context.domain.notify.mergerequest.UpdateMrNotifyFields.CLASS_NAME;
@Getter @Getter
@FieldNames
public class UpdateMrNotify extends MrNotify { public class UpdateMrNotify extends MrNotify {
public static final String TYPE = "UpdatePrNotify"; public static final String TYPE = CLASS_NAME;
private final String author; private final String author;
private final Long allTasks; private final Long allTasks;

View File

@ -2,18 +2,21 @@ package dev.struchkov.bot.gitlab.context.domain.notify.pipeline;
import dev.struchkov.bot.gitlab.context.domain.PipelineStatus; import dev.struchkov.bot.gitlab.context.domain.PipelineStatus;
import dev.struchkov.bot.gitlab.context.domain.notify.Notify; import dev.struchkov.bot.gitlab.context.domain.notify.Notify;
import dev.struchkov.haiti.utils.fieldconstants.annotation.FieldNames;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import static dev.struchkov.bot.gitlab.context.domain.notify.pipeline.PipelineNotifyFields.CLASS_NAME;
/** /**
* @author upagge 17.01.2021 * @author upagge 17.01.2021
*/ */
//TODO [16.12.2022|uPagge]: Нужно реализовать заполнение projectName //TODO [16.12.2022|uPagge]: Нужно реализовать заполнение projectName
@Getter @Getter
@FieldNames
public final class PipelineNotify implements Notify { public final class PipelineNotify implements Notify {
public static final String TYPE = "PipelineNotify"; public static final String TYPE = CLASS_NAME;
private final Long projectId; private final Long projectId;
private final Long pipelineId; private final Long pipelineId;

View File

@ -1,16 +1,20 @@
package dev.struchkov.bot.gitlab.context.domain.notify.project; package dev.struchkov.bot.gitlab.context.domain.notify.project;
import dev.struchkov.bot.gitlab.context.domain.notify.Notify; import dev.struchkov.bot.gitlab.context.domain.notify.Notify;
import dev.struchkov.haiti.utils.fieldconstants.annotation.FieldNames;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import static dev.struchkov.bot.gitlab.context.domain.notify.project.NewProjectNotifyFields.CLASS_NAME;
/** /**
* @author upagge 15.01.2021 * @author upagge 15.01.2021
*/ */
@Getter @Getter
@FieldNames
public final class NewProjectNotify implements Notify { public final class NewProjectNotify implements Notify {
public static final String TYPE = "NewProjectNotify"; public static final String TYPE = CLASS_NAME;
private final Long projectId; private final Long projectId;
private final String projectName; private final String projectName;

View File

@ -1,19 +1,23 @@
package dev.struchkov.bot.gitlab.context.domain.notify.task; package dev.struchkov.bot.gitlab.context.domain.notify.task;
import dev.struchkov.haiti.utils.container.Pair; import dev.struchkov.haiti.utils.container.Pair;
import dev.struchkov.haiti.utils.fieldconstants.annotation.FieldNames;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import lombok.Singular; import lombok.Singular;
import java.util.List; import java.util.List;
import static dev.struchkov.bot.gitlab.context.domain.notify.task.DiscussionNewNotifyFields.CLASS_NAME;
/** /**
* @author upagge 10.09.2020 * @author upagge 10.09.2020
*/ */
@Getter @Getter
@FieldNames
public class DiscussionNewNotify extends TaskNotify { public class DiscussionNewNotify extends TaskNotify {
public static final String TYPE = "DiscussionNewNotify"; public static final String TYPE = CLASS_NAME;
private final String threadId; private final String threadId;
private final String mrName; private final String mrName;

View File

@ -1,15 +1,19 @@
package dev.struchkov.bot.gitlab.context.domain.notify.task; package dev.struchkov.bot.gitlab.context.domain.notify.task;
import dev.struchkov.haiti.utils.fieldconstants.annotation.FieldNames;
import lombok.Builder; import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import static dev.struchkov.bot.gitlab.context.domain.notify.task.TaskCloseNotifyFields.CLASS_NAME;
/** /**
* @author upagge 10.09.2020 * @author upagge 10.09.2020
*/ */
@Getter @Getter
@FieldNames
public class TaskCloseNotify extends TaskNotify { public class TaskCloseNotify extends TaskNotify {
public static final String TYPE = "TaskCloseNotify"; public static final String TYPE = CLASS_NAME;
private final Long personTasks; private final Long personTasks;
private final Long personResolvedTasks; private final Long personResolvedTasks;

View File

@ -1,17 +1,19 @@
package dev.struchkov.bot.gitlab.telegram.service; package dev.struchkov.bot.gitlab.telegram.service;
import dev.struchkov.bot.gitlab.context.service.AppSettingService; import dev.struchkov.bot.gitlab.context.service.AppSettingService;
import dev.struchkov.bot.gitlab.context.utils.Icons;
import dev.struchkov.bot.gitlab.core.config.properties.AppProperty; import dev.struchkov.bot.gitlab.core.config.properties.AppProperty;
import dev.struchkov.bot.gitlab.core.config.properties.PersonProperty; import dev.struchkov.bot.gitlab.core.config.properties.PersonProperty;
import dev.struchkov.godfather.simple.domain.BoxAnswer; import dev.struchkov.godfather.simple.domain.BoxAnswer;
import dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload;
import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending; import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending;
import jakarta.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import static dev.struchkov.bot.gitlab.telegram.utils.UnitName.DELETE_MESSAGE;
import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton; import static dev.struchkov.godfather.main.domain.keyboard.button.SimpleButton.simpleButton;
import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard; import static dev.struchkov.godfather.telegram.domain.keyboard.InlineKeyBoard.inlineKeyBoard;
import static dev.struchkov.godfather.telegram.main.context.BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW;
/** /**
* @author upagge 19.01.2021 * @author upagge 19.01.2021
@ -39,10 +41,11 @@ public class StartNotify {
) )
.keyBoard( .keyBoard(
inlineKeyBoard( inlineKeyBoard(
simpleButton("Open General Menu", "/start") simpleButton(Icons.VIEW, DELETE_MESSAGE),
simpleButton("Open Menu", "/start")
) )
) )
.payload(BoxAnswerPayload.DISABLE_WEB_PAGE_PREVIEW, true) .payload(DISABLE_WEB_PAGE_PREVIEW, true)
.build(); .build();
sending.send(boxAnswer); sending.send(boxAnswer);
} }