forked from mtusi2026/mtusi2026lab3
Добавление реплик и балансировщик миграции отдельно
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
package org.example.model;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "chats")
|
||||
@Setter
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
|
||||
public class Chat {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
@Column(nullable = false, length = 100)
|
||||
private String title;
|
||||
|
||||
@OneToMany(mappedBy = "chat", fetch = FetchType.LAZY)
|
||||
@JsonIgnore
|
||||
@Builder.Default
|
||||
private List<ChatMember> members =new ArrayList<>();
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(name = "created_at", nullable = false, updatable = false)
|
||||
@JsonProperty("created_at")
|
||||
private Instant createdAt;
|
||||
|
||||
@Transient
|
||||
@JsonProperty("member_ids")
|
||||
private List<UUID> memberIds;
|
||||
public void setMemberIdsForResponse(List<UUID> ids) {
|
||||
this.memberIds = ids;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user