added model indexes
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
@@ -17,15 +12,21 @@ import zw.qantra.tm.domain.enums.RequestType;
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@Table(name = "additional_data", indexes = {
|
||||
@Index(name = "idx_additional_data_txn_id", columnList = "transaction_id"),
|
||||
@Index(name = "idx_additional_data_txn_type", columnList = "transaction_id, request_type"),
|
||||
})
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AdditionalData extends BaseEntity {
|
||||
@Column(name = "transaction_id")
|
||||
private String transactionId;
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
private String jsonString;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "request_type")
|
||||
private RequestType requestType;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.SQLRestriction;
|
||||
|
||||
@Entity
|
||||
@Table(name = "category", indexes = {
|
||||
@Index(name = "idx_category_name", columnList = "name"),
|
||||
})
|
||||
@Setter
|
||||
@Getter
|
||||
@Builder
|
||||
|
||||
@@ -12,6 +12,10 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@Entity
|
||||
@Table(name = "charge", indexes = {
|
||||
@Index(name = "idx_charge_currency", columnList = "currency"),
|
||||
@Index(name = "idx_charge_label_currency", columnList = "charge_label, currency"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -32,6 +36,7 @@ public class Charge extends BaseEntity {
|
||||
private BigDecimal maximumAmount;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "charge_label")
|
||||
private ChargeLabelEnum chargeLabel;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private CurrencyType currency;
|
||||
|
||||
@@ -7,6 +7,9 @@ import zw.qantra.tm.domain.enums.ChargeConditionType;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "charge_condition", indexes = {
|
||||
@Index(name = "idx_charge_condition_codes", columnList = "codes"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "currency", indexes = {
|
||||
@Index(name = "idx_currency_iso_code", columnList = "iso_code"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Currency extends BaseEntity {
|
||||
@Column(name = "iso_code")
|
||||
private String isoCode;
|
||||
private String name;
|
||||
private String displayName;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
@@ -18,6 +15,13 @@ import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "group_batch", indexes = {
|
||||
@Index(name = "idx_group_batch_user_id", columnList = "user_id"),
|
||||
@Index(name = "idx_group_batch_status", columnList = "status"),
|
||||
@Index(name = "idx_group_batch_recipient_group_id", columnList = "recipient_group_id"),
|
||||
@Index(name = "idx_group_batch_created_at", columnList = "created_at"),
|
||||
@Index(name = "idx_group_batch_payment_ref", columnList = "payment_reference"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -26,7 +30,9 @@ import java.util.UUID;
|
||||
@SQLRestriction("deleted = false")
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class GroupBatch extends BaseEntity {
|
||||
@Column(name = "recipient_group_id")
|
||||
private UUID recipientGroupId;
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
private String description;
|
||||
private String requestedBy;
|
||||
@@ -35,8 +41,11 @@ public class GroupBatch extends BaseEntity {
|
||||
@Enumerated(EnumType.STRING)
|
||||
private GroupBatchStatus status;
|
||||
|
||||
@Column(name = "payment_reference")
|
||||
private String paymentReference;
|
||||
@Column(name = "payment_transaction_id")
|
||||
private UUID paymentTransactionId;
|
||||
@Column(name = "workflow_id")
|
||||
private Long workflowId;
|
||||
|
||||
private String confirmIdempotencyKey;
|
||||
|
||||
@@ -15,6 +15,12 @@ import java.math.BigDecimal;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "group_batch_item", indexes = {
|
||||
@Index(name = "idx_gbi_batch_id", columnList = "group_batch_id"),
|
||||
@Index(name = "idx_gbi_batch_confirm", columnList = "group_batch_id, confirm_status"),
|
||||
@Index(name = "idx_gbi_batch_integ", columnList = "group_batch_id, integration_status"),
|
||||
@Index(name = "idx_gbi_txn_id", columnList = "transaction_id"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -22,9 +28,13 @@ import java.util.UUID;
|
||||
@NoArgsConstructor
|
||||
@SQLRestriction("deleted = false")
|
||||
public class GroupBatchItem extends BaseEntity {
|
||||
@Column(name = "group_batch_id")
|
||||
private UUID groupBatchId;
|
||||
@Column(name = "recipient_id")
|
||||
private UUID recipientId;
|
||||
@Column(name = "recipient_name")
|
||||
private String recipientName;
|
||||
@Column(name = "recipient_phone")
|
||||
private String recipientPhone;
|
||||
private BigDecimal amount;
|
||||
|
||||
@@ -32,9 +42,11 @@ public class GroupBatchItem extends BaseEntity {
|
||||
private GroupBatchItemStatus status;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "confirm_status")
|
||||
private GroupBatchItemConfirmStatus confirmStatus;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "integration_status")
|
||||
private GroupBatchItemIntegrationStatus integrationStatus;
|
||||
|
||||
@Column(columnDefinition = "TEXT")
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import zw.qantra.tm.domain.enums.Status;
|
||||
|
||||
@Entity
|
||||
@Table(name = "otp", indexes = {
|
||||
@Index(name = "idx_otp_username_type", columnList = "username, otp_type"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -17,6 +18,8 @@ public class Otp extends BaseEntity{
|
||||
private String username;
|
||||
private String otp;
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "otp_status")
|
||||
private Status otpStatus;
|
||||
@Column(name = "otp_type")
|
||||
private String otpType;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.SQLRestriction;
|
||||
|
||||
@Entity
|
||||
@Table(name = "payment_processor", indexes = {
|
||||
@Index(name = "idx_payment_processor_label", columnList = "label"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.SQLRestriction;
|
||||
import zw.qantra.tm.domain.enums.CurrencyType;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "provider", indexes = {
|
||||
@Index(name = "idx_provider_category", columnList = "category"),
|
||||
@Index(name = "idx_provider_client_id", columnList = "client_id"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -17,6 +18,7 @@ import zw.qantra.tm.domain.enums.CurrencyType;
|
||||
@NoArgsConstructor
|
||||
@SQLRestriction("deleted = false")
|
||||
public class Provider extends BaseEntity {
|
||||
@Column(name = "client_id")
|
||||
private String clientId;
|
||||
private String label;
|
||||
private String name;
|
||||
|
||||
@@ -2,12 +2,18 @@ package zw.qantra.tm.domain.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.SQLRestriction;
|
||||
|
||||
@Entity
|
||||
@Table(name = "recipient", indexes = {
|
||||
@Index(name = "idx_recipient_account_user", columnList = "account, user_id"),
|
||||
@Index(name = "idx_recipient_user_id", columnList = "user_id"),
|
||||
@Index(name = "idx_recipient_phone", columnList = "phone_number"),
|
||||
@Index(name = "idx_recipient_email", columnList = "email"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -18,10 +24,13 @@ import org.hibernate.annotations.SQLRestriction;
|
||||
public class Recipient extends BaseEntity {
|
||||
private String name;
|
||||
private String email;
|
||||
@Column(name = "phone_number")
|
||||
private String phoneNumber;
|
||||
private String address;
|
||||
private String account;
|
||||
private String initials;
|
||||
@Column(name = "latest_provider_label")
|
||||
private String latestProviderLabel;
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
@@ -10,6 +10,9 @@ import lombok.Setter;
|
||||
import org.hibernate.annotations.SQLRestriction;
|
||||
|
||||
@Entity
|
||||
@Table(name = "recipient_group", indexes = {
|
||||
@Index(name = "idx_recipient_group_user_id", columnList = "user_id"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -20,6 +23,7 @@ import org.hibernate.annotations.SQLRestriction;
|
||||
public class RecipientGroup extends BaseEntity {
|
||||
private String name;
|
||||
private String description;
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
@@ -14,6 +12,10 @@ import org.hibernate.annotations.SQLRestriction;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "recipient_group_member", indexes = {
|
||||
@Index(name = "idx_rgm_group_id", columnList = "recipient_group_id"),
|
||||
@Index(name = "idx_rgm_group_recipient", columnList = "recipient_group_id, recipient_id"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -22,12 +24,15 @@ import java.util.UUID;
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@SQLRestriction("deleted = false")
|
||||
public class RecipientGroupMember extends BaseEntity {
|
||||
@Column(name = "recipient_group_id")
|
||||
private UUID recipientGroupId;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "recipient_id")
|
||||
private Recipient recipient;
|
||||
@Column(name = "recipient_uid")
|
||||
private UUID recipientUid;
|
||||
private String account;
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package zw.qantra.tm.domain.models;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
@@ -8,12 +8,17 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Entity
|
||||
@Table(name = "setting", indexes = {
|
||||
@Index(name = "idx_setting_name", columnList = "setting_name"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Setting extends BaseEntity {
|
||||
@Column(name = "setting_name")
|
||||
private String settingName;
|
||||
@Column(name = "setting_value")
|
||||
private String settingValue;
|
||||
}
|
||||
@@ -12,6 +12,18 @@ import java.math.BigDecimal;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "transaction", indexes = {
|
||||
@Index(name = "idx_transaction_trace_type", columnList = "trace, type"),
|
||||
@Index(name = "idx_transaction_reference", columnList = "reference"),
|
||||
@Index(name = "idx_transaction_user_id", columnList = "user_id"),
|
||||
@Index(name = "idx_transaction_confirm_pay_integ", columnList = "confirmation_status, payment_status, integration_status"),
|
||||
@Index(name = "idx_transaction_pay_poll", columnList = "payment_status, polling_status"),
|
||||
@Index(name = "idx_transaction_status", columnList = "status"),
|
||||
@Index(name = "idx_transaction_created_at", columnList = "created_at"),
|
||||
@Index(name = "idx_transaction_debit_phone", columnList = "debit_phone"),
|
||||
@Index(name = "idx_transaction_credit_phone", columnList = "credit_phone"),
|
||||
@Index(name = "idx_transaction_workflow_id", columnList = "workflow_id"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -19,7 +31,9 @@ import java.util.UUID;
|
||||
@NoArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@SQLRestriction("deleted = false")
|
||||
public class Transaction extends BaseEntity {
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
private String trace;
|
||||
private String region;
|
||||
@@ -39,6 +53,7 @@ public class Transaction extends BaseEntity {
|
||||
private String rrn;
|
||||
private String channelName;
|
||||
private String channel;
|
||||
@Column(name = "debit_phone")
|
||||
private String debitPhone;
|
||||
private String debitAccount;
|
||||
@Enumerated(EnumType.STRING)
|
||||
@@ -47,6 +62,7 @@ public class Transaction extends BaseEntity {
|
||||
private String debitCard;
|
||||
private String debitRef;
|
||||
private String debitEmail;
|
||||
@Column(name = "credit_phone")
|
||||
private String creditPhone;
|
||||
private String creditAccount;
|
||||
@Enumerated(EnumType.STRING)
|
||||
@@ -69,14 +85,18 @@ public class Transaction extends BaseEntity {
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Status authorizationStatus;
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "confirmation_status")
|
||||
private Status confirmationStatus;
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "payment_status")
|
||||
private Status paymentStatus;
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "integration_status")
|
||||
private Status integrationStatus;
|
||||
@Enumerated(EnumType.STRING)
|
||||
private Status reversalStatus;
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "polling_status")
|
||||
private Status pollingStatus;
|
||||
|
||||
|
||||
@@ -92,7 +112,7 @@ public class Transaction extends BaseEntity {
|
||||
private String erpPurchasePaymentRef;
|
||||
private String erpCommissionJournalRef;
|
||||
|
||||
@Column(nullable = true)
|
||||
@Column(name = "workflow_id", nullable = true)
|
||||
private long workflowId;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
|
||||
@@ -2,10 +2,7 @@ package zw.qantra.tm.domain.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Enumerated;
|
||||
import jakarta.persistence.EnumType;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
@@ -14,6 +11,9 @@ import lombok.Setter;
|
||||
import zw.qantra.tm.domain.enums.Status;
|
||||
|
||||
@Entity
|
||||
@Table(name = "transaction_event", indexes = {
|
||||
@Index(name = "idx_txn_event_txn_id", columnList = "transaction_id"),
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@@ -21,6 +21,7 @@ import zw.qantra.tm.domain.enums.Status;
|
||||
@NoArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class TransactionEvent extends BaseEntity {
|
||||
@Column(name = "transaction_id")
|
||||
private String transactionId;
|
||||
private String event;
|
||||
@Enumerated(EnumType.STRING)
|
||||
|
||||
@@ -12,7 +12,9 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "users")
|
||||
@Table(name = "users", indexes = {
|
||||
@Index(name = "idx_user_phone", columnList = "phone"),
|
||||
})
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@SQLRestriction("deleted = false")
|
||||
|
||||
Reference in New Issue
Block a user