add basic models for user and trip schema

This commit is contained in:
2025-12-02 16:11:31 +01:00
parent cf1819dd1f
commit 6f7185236c
8 changed files with 328 additions and 39 deletions
@@ -2,6 +2,8 @@ package SuMoC.backend.models;
import jakarta.persistence.*;
import java.time.LocalDateTime;
@Entity
@Table(name = "friendships")
public class Friendship {
@@ -9,9 +11,69 @@ public class Friendship {
@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 Long userId1;
private FriendShipStatus status;
@Column(nullable = false)
private Long userId2;
private LocalDateTime createAt;
public Friendship() {
}
public Friendship(Long id, User user, User friend, FriendShipStatus status, LocalDateTime createAt) {
this.id = id;
this.user = user;
this.friend = friend;
this.status = status;
this.createAt = createAt;
}
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 getCreateAt() {
return createAt;
}
public void setCreateAt(LocalDateTime createAt) {
this.createAt = createAt;
}
}