package com.kamco.cd.kamcoback.postgres;

import jakarta.persistence.Column;
import jakarta.persistence.MappedSuperclass;
import jakarta.persistence.PrePersist;
import java.time.ZonedDateTime;
import lombok.Getter;
import org.springframework.data.annotation.CreatedDate;

@Getter
@MappedSuperclass
public class CommonCreateEntity {

  @CreatedDate
  @Column(name = "created_dttm", updatable = false, nullable = false)
  private ZonedDateTime createdDate;

  @PrePersist
  protected void onPersist() {
    this.createdDate = ZonedDateTime.now();
  }
}
