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.
 
 
 

37 lines
883 B

package com.mydreamjob.messaging;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "conversation_members",
uniqueConstraints = @UniqueConstraint(columnNames = {"conversation_id", "user_id"}))
public class ConversationMember {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "conversation_id", nullable = false)
private Long conversationId;
@Column(name = "user_id", nullable = false)
private Long userId;
@Column(name = "joined_at", nullable = false)
private LocalDateTime joinedAt;
@PrePersist
void prePersist() {
if (joinedAt == null) joinedAt = LocalDateTime.now();
}
}