mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-14 03:45:57 +00:00
added columns for tracking created/updated
This commit is contained in:
@@ -7,6 +7,7 @@ import lombok.*;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@@ -57,6 +58,14 @@ public class EmbeddedMessage {
|
||||
@Id
|
||||
private Long embeddingMessageId;
|
||||
|
||||
@Column(name = "created")
|
||||
private Instant created;
|
||||
|
||||
@PrePersist
|
||||
private void onInsert() {
|
||||
this.created = Instant.now();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -44,9 +44,22 @@ public class Reminder {
|
||||
@JoinColumn(name = "serverId", nullable = false)
|
||||
private AServer server;
|
||||
|
||||
@Getter
|
||||
@Column(name = "created")
|
||||
private Instant reminderDate;
|
||||
|
||||
@PrePersist
|
||||
private void onInsert() {
|
||||
this.reminderDate = Instant.now();
|
||||
}
|
||||
|
||||
@Column(name = "updated")
|
||||
private Instant updated;
|
||||
|
||||
@PreUpdate
|
||||
private void onUpdate() {
|
||||
this.updated = Instant.now();
|
||||
}
|
||||
|
||||
@Getter
|
||||
private Instant targetDate;
|
||||
|
||||
|
||||
@@ -46,6 +46,22 @@ public class StarboardPost {
|
||||
@Transient
|
||||
private Integer reactionCount;
|
||||
|
||||
@Column(name = "created")
|
||||
private Instant created;
|
||||
|
||||
@PrePersist
|
||||
private void onInsert() {
|
||||
this.created = Instant.now();
|
||||
}
|
||||
|
||||
@Column(name = "updated")
|
||||
private Instant updated;
|
||||
|
||||
@PreUpdate
|
||||
private void onUpdate() {
|
||||
this.updated = Instant.now();
|
||||
}
|
||||
|
||||
@PostLoad
|
||||
private void onLoad() {
|
||||
this.reactionCount = this.reactions.size();
|
||||
|
||||
@@ -5,6 +5,7 @@ import lombok.*;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
|
||||
@Entity
|
||||
@@ -31,6 +32,14 @@ public class StarboardPostReaction {
|
||||
@JoinColumn(name = "post_id")
|
||||
private StarboardPost starboardPost;
|
||||
|
||||
@Column(name = "created")
|
||||
private Instant created;
|
||||
|
||||
@PrePersist
|
||||
private void onInsert() {
|
||||
this.created = Instant.now();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -50,6 +50,22 @@ public class Suggestion {
|
||||
@Enumerated(EnumType.STRING)
|
||||
private SuggestionState state;
|
||||
|
||||
@Column(name = "created")
|
||||
private Instant created;
|
||||
|
||||
@PrePersist
|
||||
private void onInsert() {
|
||||
this.created = Instant.now();
|
||||
}
|
||||
|
||||
@Column(name = "updated")
|
||||
private Instant updated;
|
||||
|
||||
@PreUpdate
|
||||
private void onUpdate() {
|
||||
this.updated = Instant.now();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
Reference in New Issue
Block a user