@@ -0,0 +1,58 @@
|
||||
package ru.soune.nocopy.entity.complaint;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
import ru.soune.nocopy.entity.violation.Violation;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "complaint")
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter @Setter
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
public class ComplaintEntity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "status")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private ComplaintStatus status;
|
||||
|
||||
@Column(name = "complaint_text", columnDefinition = "TEXT")
|
||||
private String complaintText;
|
||||
|
||||
@Column(name = "email")
|
||||
private String email;
|
||||
|
||||
@Column(name = "links", columnDefinition = "TEXT")
|
||||
private String links;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "violation_id")
|
||||
@ToString.Exclude
|
||||
@JsonIgnore
|
||||
private Violation violation;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "law_case_id")
|
||||
@ToString.Exclude
|
||||
@JsonIgnore
|
||||
private LawCase lawCase;
|
||||
|
||||
@Column(name = "created_at", updatable = false)
|
||||
@CreatedDate
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@Column(name = "updated_at")
|
||||
@LastModifiedDate
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package ru.soune.nocopy.entity.complaint;
|
||||
|
||||
public enum ComplaintStatus {
|
||||
CREATED, IN_WORK, COMPLETED, CANCELLED
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package ru.soune.nocopy.entity.complaint;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
|
||||
@Entity
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Getter @Setter
|
||||
@Table(name = "law_case")
|
||||
public class LawCase {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
}
|
||||
Reference in New Issue
Block a user