Skip to content

Commit

Permalink
feat : 생성자 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
rivkode committed Oct 28, 2023
1 parent 7ea67d3 commit a415971
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.snsIntegrationFeedService.postHashtag.entity.PostHashtag;
import jakarta.persistence.*;
import lombok.Builder;
import lombok.Getter;

import java.util.ArrayList;
Expand All @@ -19,4 +20,13 @@ public class Hashtag {

@OneToMany(mappedBy = "hashtag", orphanRemoval = true)
private List<PostHashtag> postHashtagList = new ArrayList<>();

@Builder
public Hashtag(String name) {
this.name = name;
}

public Hashtag() {

}
}
18 changes: 18 additions & 0 deletions src/main/java/com/snsIntegrationFeedService/post/entity/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import java.util.UUID;
import lombok.Builder;
import lombok.Getter;

@Entity
Expand Down Expand Up @@ -60,4 +62,20 @@ public class Post extends Timestamped {
public void view() {
this.viewCount++;
}

@Builder
public Post(User user, PostTypeEnum type, String title, String content) {
this.user = user;
this.postId = UUID.randomUUID().toString();
this.type = type;
this.title = title;
this.content = content;
this.viewCount = 0L;
this.likeCount = 0L;
this.shareCount = 0L;
}

public Post() {

}
}
12 changes: 12 additions & 0 deletions src/main/java/com/snsIntegrationFeedService/user/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.snsIntegrationFeedService.certificateCode.entity.CertificateCode;
import com.snsIntegrationFeedService.post.entity.Post;
import jakarta.persistence.*;
import lombok.Builder;
import lombok.Getter;

import java.util.ArrayList;
Expand Down Expand Up @@ -32,4 +33,15 @@ public class User {

@OneToOne(mappedBy = "user")
private CertificateCode certificateCode;

@Builder
public User(String account, String password, String email) {
this.account = account;
this.password = password;
this.email = email;
}

public User() {

}
}

0 comments on commit a415971

Please sign in to comment.