[AB-76] adding evaluation job for suggestions

This commit is contained in:
Sheldan
2022-11-11 00:06:16 +01:00
parent ea2f62b721
commit d315113395
18 changed files with 199 additions and 29 deletions

View File

@@ -33,11 +33,16 @@ public class SuggestionFeatureConfig implements FeatureConfig {
@Override
public List<FeatureMode> getAvailableModes() {
return Arrays.asList(SuggestionFeatureMode.SUGGESTION_REMINDER, SuggestionFeatureMode.SUGGESTION_BUTTONS);
return Arrays.asList(
SuggestionFeatureMode.SUGGESTION_REMINDER,
SuggestionFeatureMode.SUGGESTION_BUTTONS,
SuggestionFeatureMode.SUGGESTION_AUTO_EVALUATE);
}
@Override
public List<String> getRequiredSystemConfigKeys() {
return Arrays.asList(SuggestionService.SUGGESTION_REMINDER_DAYS_CONFIG_KEY);
return Arrays.asList(SuggestionService.SUGGESTION_REMINDER_DAYS_CONFIG_KEY,
SuggestionService.SUGGESTION_AUTO_EVALUATE_DAYS_CONFIG_KEY,
SuggestionService.SUGGESTION_AUTO_EVALUATE_PERCENTAGE_CONFIG_KEY);
}
}

View File

@@ -5,7 +5,7 @@ import lombok.Getter;
@Getter
public enum SuggestionFeatureMode implements FeatureMode {
SUGGESTION_REMINDER("suggestionReminder"), SUGGESTION_BUTTONS("suggestionButton");
SUGGESTION_REMINDER("suggestionReminder"), SUGGESTION_BUTTONS("suggestionButton"), SUGGESTION_AUTO_EVALUATE("suggestionAutoEvaluate");
private final String key;

View File

@@ -69,4 +69,7 @@ public class Suggestion implements Serializable {
@Column(name = "job_trigger_key")
private String suggestionReminderJobTriggerKey;
@Column(name = "evaluation_job_trigger_key")
private String suggestionEvaluationJobTriggerKey;
}

View File

@@ -10,6 +10,8 @@ import lombok.experimental.SuperBuilder;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.User;
import java.time.Instant;
@Getter
@Setter
@SuperBuilder
@@ -29,6 +31,8 @@ public class SuggestionLog {
private ButtonConfigModel agreeButtonModel;
private ButtonConfigModel disAgreeButtonModel;
private ButtonConfigModel removeVoteButtonModel;
private Instant autoEvaluationTargetDate;
private Boolean autoEvaluationEnabled;
public String getOriginalMessageUrl() {
return MessageUtils.buildMessageUrl(serverId, originalChannelId , originalMessageId);

View File

@@ -10,14 +10,17 @@ import java.util.concurrent.CompletableFuture;
public interface SuggestionService {
String SUGGESTION_REMINDER_DAYS_CONFIG_KEY = "suggestionReminderDays";
String SUGGESTION_AUTO_EVALUATE_DAYS_CONFIG_KEY = "suggestionAutoEvaluateDays";
String SUGGESTION_AUTO_EVALUATE_PERCENTAGE_CONFIG_KEY = "suggestionAutoEvaluatePercentage";
CompletableFuture<Void> createSuggestionMessage(ServerChannelMessageUser cause, String text, String attachmentURL);
CompletableFuture<Void> acceptSuggestion(Long suggestionId, Member actingMember, String text);
CompletableFuture<Void> vetoSuggestion(Long suggestionId, Member actingMember, String text);
CompletableFuture<Void> rejectSuggestion(Long suggestionId, Member actingMember, String text);
CompletableFuture<Void> removeSuggestion(Long suggestionId, Member member);
CompletableFuture<Void> acceptSuggestion(Long serverId, Long suggestionId, Member actingMember, String text);
CompletableFuture<Void> evaluateSuggestion(Long serverId, Long suggestionId);
CompletableFuture<Void> vetoSuggestion(Long serverId, Long suggestionId, Member actingMember, String text);
CompletableFuture<Void> rejectSuggestion(Long serverId, Long suggestionId, Member actingMember, String text);
CompletableFuture<Void> removeSuggestion(Long serverId, Long suggestionId, Member member);
void cleanUpSuggestions();
CompletableFuture<Void> remindAboutSuggestion(ServerSpecificId suggestionId);
void cancelSuggestionReminder(Suggestion suggestion);
void cancelSuggestionJobs(Suggestion suggestion);
SuggestionInfoModel getSuggestionInfo(Long serverId, Long suggestionId);
SuggestionInfoModel getSuggestionInfo(ServerSpecificId suggestionId);
}