Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/#54/게시판 게시글 작성 #74

Merged
merged 11 commits into from
Aug 12, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package space.space_spring.dto.post.request;

import lombok.*;
import org.springframework.web.multipart.MultipartFile;
import space.space_spring.entity.Post;
import space.space_spring.entity.PostImage;
import space.space_spring.entity.Space;
import space.space_spring.entity.User;

import java.util.List;

@Builder
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CreatePostRequest {
private String title;
private String content;
private String type; // "notice" or "general"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

추후에 Enum으로 관리하면 좋을 것 같습니다.

private List<MultipartFile> postImages;

public Post toEntity(User user, Space space, List<PostImage> postImages){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3: 정적 팩토리 메소드 of를 사용하셔도 좋을 것 같아요

return Post.builder()
.user(user)
.space(space)
.title(title)
.content(content)
.type(type)
.postImages(postImages)
.build();
}
}