Skip to content

Commit

Permalink
EPMRPP-89659 || Update Notification tab (#994)
Browse files Browse the repository at this point in the history
* EPMRPP-89659 || Update Notification tab
  • Loading branch information
APiankouski authored Apr 17, 2024
1 parent ff1ae9d commit c20154e
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 37 deletions.
3 changes: 2 additions & 1 deletion project-properties.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ project.ext {
releaseMode = project.hasProperty("releaseMode")
hasDBSchema = project.hasProperty("DB_SCHEMA_POSTGRES")
scriptsUrl = commonScriptsUrl + (releaseMode ? getProperty('scripts.version') : 'develop')
migrationsUrl = migrationsScriptsUrl + (releaseMode ? getProperty('migrations.version') : 'develop')
migrationsUrl = migrationsScriptsUrl + (releaseMode ? getProperty('migrations.version') : 'EPMRPP-89659')

//TODO refactor with archive download
testScriptsSrc = [
Expand Down Expand Up @@ -80,6 +80,7 @@ project.ext {
(migrationsUrl + '/migrations/76_user_bid_extension.up.sql') : 'V076__user_bid_extension.sql',
(migrationsUrl + '/migrations/77_email_server_documentation_link.up.sql') : 'V077__email_server_documentation_link.sql',
(migrationsUrl + '/migrations/78_drop_redundant_index.up.sql') : 'V078__drop_redundant_index.sql',
(migrationsUrl + '/migrations/86_notication_update.up.sql') : 'V086__notication_update.sql',

]
excludeTests = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface SenderCaseRepository extends ReportPortalRepository<SenderCase,
@Query(value = "SELECT sc FROM SenderCase sc WHERE sc.project.id = :projectId ORDER BY sc.id")
List<SenderCase> findAllByProjectId(@Param(value = "projectId") Long projectId);

Optional<SenderCase> findByProjectIdAndRuleNameIgnoreCase(Long projectId, String ruleName);
Optional<SenderCase> findByProjectIdAndTypeAndRuleNameIgnoreCase(Long projectId, String ruleType, String ruleName);

@Modifying
@Query(value = "DELETE FROM recipients WHERE sender_case_id = :id AND recipient IN (:recipients)", nativeQuery = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.epam.ta.reportportal.entity.enums.LogicalOperator;
import com.epam.ta.reportportal.entity.enums.PostgreSQLEnumType;
import com.epam.ta.reportportal.entity.enums.SendCase;
import com.epam.ta.reportportal.entity.integration.IntegrationParams;
import com.epam.ta.reportportal.entity.project.Project;
import java.io.Serializable;
import java.util.Set;
Expand Down Expand Up @@ -47,6 +48,7 @@
@Entity
@Table(name = "sender_case")
@TypeDef(name = "pqsql_enum", typeClass = PostgreSQLEnumType.class)
@TypeDef(name = "ruleDetails", typeClass = SenderCaseOptions.class)
public class SenderCase implements Serializable {

@Id
Expand Down Expand Up @@ -83,6 +85,13 @@ public class SenderCase implements Serializable {
@Column(name = "enabled")
private boolean enabled;

@Column(name = "rule_type")
private String type;

@Type(type = "ruleDetails")
@Column(name = "rule_details")
private SenderCaseOptions ruleDetails;

@Enumerated(EnumType.STRING)
@Column(name = "attributes_operator")
@Type(type = "pqsql_enum")
Expand All @@ -91,13 +100,16 @@ public class SenderCase implements Serializable {
public SenderCase() {
}

public SenderCase(Set<String> recipients, Set<String> launchNames, Set<LaunchAttributeRule> launchAttributeRules, SendCase sendCase,
boolean enabled, LogicalOperator attributesOperator) {
public SenderCase(String ruleName, Set<String> recipients, Set<String> launchNames,
Set<LaunchAttributeRule> launchAttributeRules, SendCase sendCase,
boolean enabled, String type, LogicalOperator attributesOperator) {
this.ruleName = ruleName;
this.recipients = recipients;
this.launchNames = launchNames;
this.launchAttributeRules = launchAttributeRules;
this.sendCase = sendCase;
this.enabled = enabled;
this.type = type;
this.attributesOperator = attributesOperator;
}

Expand Down Expand Up @@ -172,4 +184,20 @@ public LogicalOperator getAttributesOperator() {
public void setAttributesOperator(LogicalOperator attributesOperator) {
this.attributesOperator = attributesOperator;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public SenderCaseOptions getRuleDetails() {
return ruleDetails;
}

public void setRuleDetails(SenderCaseOptions ruleDetails) {
this.ruleDetails = ruleDetails;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2023 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.epam.ta.reportportal.entity.project.email;

import com.epam.ta.reportportal.commons.JsonbUserType;
import java.io.Serializable;
import java.util.Map;
import lombok.Data;

/**
* @author <a href="mailto:andrei_piankouski@epam.com">Andrei Piankouski</a>
*/
@Data
public class SenderCaseOptions extends JsonbUserType implements Serializable {

private Map<String, Object> options;

public SenderCaseOptions() {
}

public SenderCaseOptions(Map<String, Object> options) {
this.options = options;
}

@Override
public Class<?> returnedClass() {
return SenderCaseOptions.class;
}
}
6 changes: 2 additions & 4 deletions src/main/java/com/epam/ta/reportportal/jooq/Indexes.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c20154e

Please sign in to comment.