implemented friendship system
This commit is contained in:
@@ -5,8 +5,14 @@ import jakarta.persistence.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* For explanation of statuses, also see "getFriendships" in UserController.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "friendships")
|
||||
@Table(
|
||||
name = "friendships",
|
||||
uniqueConstraints = @UniqueConstraint(columnNames = {"user_id", "friend_id"})
|
||||
)
|
||||
public class Friendship {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@@ -30,12 +36,11 @@ public class Friendship {
|
||||
public Friendship() {
|
||||
}
|
||||
|
||||
public Friendship(Long id, User user, User friend, FriendShipStatus status, LocalDateTime createdAt) {
|
||||
this.id = id;
|
||||
public Friendship(User user, User friend, FriendShipStatus status) {
|
||||
this.user = user;
|
||||
this.friend = friend;
|
||||
this.status = status;
|
||||
this.createdAt = createdAt;
|
||||
this.createdAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
|
||||
Reference in New Issue
Block a user