refactor structure of user to feature based structure
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
package SuMoC.backend.user.models;
|
||||
|
||||
import SuMoC.backend.user.enums.FriendShipStatus;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "friendships")
|
||||
public class Friendship {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id", nullable = false)
|
||||
private User user;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "friend_id", nullable = false)
|
||||
private User friend;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(nullable = false)
|
||||
private FriendShipStatus status;
|
||||
|
||||
@Column(nullable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
public Friendship() {
|
||||
}
|
||||
|
||||
public Friendship(Long id, User user, User friend, FriendShipStatus status, LocalDateTime createdAt) {
|
||||
this.id = id;
|
||||
this.user = user;
|
||||
this.friend = friend;
|
||||
this.status = status;
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public User getFriend() {
|
||||
return friend;
|
||||
}
|
||||
|
||||
public void setFriend(User friend) {
|
||||
this.friend = friend;
|
||||
}
|
||||
|
||||
public FriendShipStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(FriendShipStatus status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public LocalDateTime getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(LocalDateTime createAt) {
|
||||
this.createdAt = createAt;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user