package com.krishna.model; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import jakarta.persistence.*; import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; import java.time.LocalDateTime; @Entity @Table(name = "posts") public class PostModel { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "user_id", nullable = false) @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) private UserModel userModel; @Column(nullable = false, columnDefinition = "TEXT") private String content; @Column(name = "image_url", columnDefinition = "TEXT") private String imageUrl; @CreationTimestamp private LocalDateTime createdAt; @UpdateTimestamp private LocalDateTime updatedAt; // Getters and setters public Long getId() { return id; } public void setId(Long id) { this.id = id; } public UserModel getUserModel() { return userModel; } public void setUserModel(UserModel userModel) { this.userModel = userModel; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public LocalDateTime getCreatedAt() { return createdAt; } public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; } public LocalDateTime getUpdatedAt() { return updatedAt; } public void setUpdatedAt(LocalDateTime updatedAt) { this.updatedAt = updatedAt; } }