You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

82 lines
2.4 KiB

package com.mydreamjob.messaging;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import java.time.LocalDateTime;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "messages")
@EntityListeners(AuditingEntityListener.class)
public class Message {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "conversation_id", nullable = false)
private Long conversationId;
@Column(name = "sender_user_id", nullable = false)
private Long senderUserId;
@Column(nullable = false, columnDefinition = "text")
private String content;
@Column(name = "client_message_id", length = 64)
private String clientMessageId;
@Column(name = "request_content_hash", length = 64)
private String requestContentHash;
@Builder.Default
@Column(name = "message_type", nullable = false, length = 20)
private String messageType = "TEXT";
@Column(name = "resume_filename", length = 255)
private String resumeFilename;
@Column(name = "resume_content_type", length = 120)
private String resumeContentType;
@Column(name = "resume_size")
private Long resumeSize;
@Builder.Default
@Column(name = "resume_revoked", nullable = false)
private Boolean resumeRevoked = false;
@Column(name = "attachment_filename", length = 255)
private String attachmentFilename;
@Column(name = "attachment_content_type", length = 120)
private String attachmentContentType;
@Column(name = "attachment_size")
private Long attachmentSize;
@Column(name = "attachment_sha256", length = 64)
private String attachmentSha256;
@Column(name = "attachment_width")
private Integer attachmentWidth;
@Column(name = "attachment_height")
private Integer attachmentHeight;
@Column(nullable = false, length = 20)
@Builder.Default
private String status = "SENT";
@Column(name = "recalled_at")
private LocalDateTime recalledAt;
@Version
@Column(nullable = false)
@Builder.Default
private Long version = 0L;
@CreatedDate
@Column(name = "created_at", nullable = false, updatable = false)
private LocalDateTime createdAt;
}