refactor Friendship entity to use Lombok annotations for boilerplate code reduction
This commit is contained in:
@@ -2,17 +2,19 @@ package SuMoC.backend.user.models;
|
||||
|
||||
import SuMoC.backend.user.enums.FriendShipStatus;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* For explanation of statuses, also see "getFriendships" in UserController.
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
@Entity
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Table(
|
||||
name = "friendships",
|
||||
uniqueConstraints = @UniqueConstraint(columnNames = {"user_id", "friend_id"})
|
||||
@@ -37,9 +39,6 @@ public class Friendship {
|
||||
@Column(nullable = false)
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
public Friendship() {
|
||||
}
|
||||
|
||||
public Friendship(User user, User friend, FriendShipStatus status) {
|
||||
this.user = user;
|
||||
this.friend = friend;
|
||||
@@ -47,43 +46,4 @@ public class Friendship {
|
||||
this.createdAt = LocalDateTime.now();
|
||||
}
|
||||
|
||||
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