package dev.nincodedo.ninbot.common.persistence;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

@Data
@MappedSuperclass
@AllArgsConstructor
@NoArgsConstructor
public class BaseEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(nullable = false)
    @EqualsAndHashCode.Exclude
    private Long id;
    @Embedded
    private AuditMetadata audit;
}


@@ -385,16 +385,121 @@
 erclass;
+%0Aimport javax.persistence.PrePersist;%0Aimport javax.persistence.PreUpdate;%0Aimport java.time.LocalDateTime;
 %0A%0A@Data%0A
@@ -772,13 +772,254 @@
 ta audit
-;
+ = new AuditMetadata();%0A%0A    @PrePersist%0A    private void prePersist() %7B%0A        audit.setCreatedDateTime(LocalDateTime.now());%0A    %7D%0A%0A    @PreUpdate%0A    private void preUpdate() %7B%0A        audit.setModifiedDateTime(LocalDateTime.now());%0A    %7D
 %0A%7D%0A%0A

Fix audit issues