You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Facebook/BE/src/main/java/org/example/models/Post.java

102 lines
2.1 KiB

package org.example.models;
import lombok.Getter;
import org.example.repositories.PostRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.neo4j.core.schema.GeneratedValue;
import org.springframework.data.neo4j.core.schema.Id;
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Relationship;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@Getter
@Node
public class Post {
@Id
@GeneratedValue
private Long id;
private String title;
private String content;
private String author;
private String imgUrl;
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
@Relationship(type = "HAS_IMAGE", direction = Relationship.Direction.OUTGOING)
private Image images = new Image();
@Relationship(type = "HAS_VIDEO", direction = Relationship.Direction.OUTGOING)
private List<Video> videos = new ArrayList<>();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Image getImages() {
return images;
}
public void setImages(Image images) {
this.images = images;
}
public List<Video> getVideos() {
return videos;
}
public void setVideos(List<Video> videos) {
this.videos = videos;
}
@Relationship(type = "createPost", direction = Relationship.Direction.INCOMING)
private User creator;
public User getCreator() {
return creator;
}
public void setCreator(User creator) {
this.creator = creator;
}
}