-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from ssu-student-union/feat/131-infra
Feat/131 infra
- Loading branch information
Showing
17 changed files
with
250 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...in/java/ussum/homepage/application/post/service/dto/request/GeneralPostCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package ussum.homepage.application.post.service.dto.request; | ||
|
||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import ussum.homepage.domain.post.Board; | ||
import ussum.homepage.domain.post.Post; | ||
import ussum.homepage.infra.jpa.post.entity.Category; | ||
|
||
@Getter | ||
public class GeneralPostCreateRequest extends PostCreateRequest { | ||
private final String categoryCode; | ||
|
||
@Builder | ||
public GeneralPostCreateRequest(String title, String content, String thumbNailImage, boolean isNotice, String categoryCode, List<Long> postFileList) { | ||
super(title, content, thumbNailImage, isNotice,postFileList); | ||
this.categoryCode = categoryCode; | ||
this.postFileList = postFileList; | ||
} | ||
|
||
public Post toDomain(Board board, Long userId){ | ||
String status = "새로운"; | ||
if(isNotice){ | ||
status = "긴급공지"; | ||
} | ||
return Post.of(null, | ||
title, | ||
content, | ||
1, | ||
thumbNailImage, | ||
status, | ||
null,null,null, | ||
categoryCode, | ||
userId, | ||
board.getId()); | ||
} | ||
public Post toDomain(Long boardId, Long userId, Category category){ | ||
return Post.of(null, | ||
title, | ||
content, | ||
1, | ||
thumbNailImage, | ||
"새로운", | ||
null,null,null, | ||
categoryCode, | ||
userId, | ||
boardId); | ||
} | ||
|
||
} |
67 changes: 22 additions & 45 deletions
67
src/main/java/ussum/homepage/application/post/service/dto/request/PostCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,40 @@ | ||
package ussum.homepage.application.post.service.dto.request; | ||
|
||
import lombok.Builder; | ||
import java.util.List; | ||
import lombok.Getter; | ||
import ussum.homepage.domain.post.Board; | ||
import ussum.homepage.domain.post.Post; | ||
import ussum.homepage.domain.user.User; | ||
import ussum.homepage.infra.jpa.post.entity.Category; | ||
|
||
import java.util.List; | ||
@Getter | ||
public class PostCreateRequest { | ||
protected String title; | ||
protected String content; | ||
protected String thumbNailImage; | ||
protected boolean isNotice; | ||
protected List<Long> postFileList; | ||
|
||
public record PostCreateRequest( | ||
String title, | ||
String content, | ||
String categoryCode, | ||
String thumbNailImage, | ||
boolean isNotice, | ||
List<Long> postFileList | ||
) { | ||
public Post toDomain(Board board, Long userId) { | ||
public PostCreateRequest(String title, String content, String thumbNailImage, boolean isNotice, List<Long> postFileList) { | ||
this.title = title; | ||
this.content = content; | ||
this.thumbNailImage = thumbNailImage; | ||
this.isNotice = isNotice; | ||
this.postFileList = postFileList; | ||
} | ||
|
||
public Post toDomain(Board board, Long userId){ | ||
String status = "새로운"; | ||
if (isNotice) { | ||
if(isNotice){ | ||
status = "긴급공지"; | ||
} | ||
return Post.of( | ||
null, | ||
return Post.of(null, | ||
title, | ||
content, | ||
1, | ||
thumbNailImage, | ||
status, | ||
// OnGoingStatus, | ||
null,null,null, | ||
null, | ||
null, | ||
null, | ||
categoryCode, | ||
userId, | ||
board.getId() | ||
); | ||
board.getId()); | ||
} | ||
|
||
public Post toDomain(Long boardId, Long userId, Category category) { | ||
// String status = "새로운"; | ||
// if (isNotice) { | ||
// status = "긴급"; | ||
// } | ||
return Post.of( | ||
null, | ||
title, | ||
content, | ||
1, | ||
thumbNailImage, | ||
"새로운", | ||
// OnGoingStatus, | ||
null, | ||
null, | ||
null, | ||
category.getStringCategoryCode(), | ||
userId, | ||
boardId | ||
); | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...main/java/ussum/homepage/application/post/service/dto/request/RigthPostCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ussum.homepage.application.post.service.dto.request; | ||
|
||
import java.util.List; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class RigthPostCreateRequest extends PostCreateRequest { | ||
private final List<RelatedPeople> relatedPeople; | ||
|
||
public RigthPostCreateRequest(String title, String content, String thumbNailImage, boolean isNotice, | ||
List<Long> postFileList) { | ||
super(title, content, thumbNailImage, isNotice, postFileList); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...m/homepage/application/post/service/dto/response/postDetail/RightsPostDetailResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package ussum.homepage.application.post.service.dto.response.postDetail; | ||
|
||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import ussum.homepage.application.comment.service.dto.response.PostOfficialCommentResponse; | ||
import ussum.homepage.application.post.service.dto.response.FileResponse; | ||
|
||
@Getter | ||
public class RightsPostDetailResponse extends PostDetailResDto{ | ||
private List<FileResponse> fileResponseList; | ||
private List<PostOfficialCommentResponse> postOfficialCommentResponseList; | ||
|
||
@Builder | ||
private RightsPostDetailResponse(Long postId, String categoryName, String authorName, String studentId, String title, String content, String createdAt, String lastEditedAt, Boolean isAuthor, | ||
List<FileResponse> fileResponseList, List<PostOfficialCommentResponse> officialCommentList, | ||
List<String> canAuthority ){ | ||
super(postId,categoryName,authorName,title,content,createdAt,lastEditedAt,isAuthor,canAuthority); | ||
this.fileResponseList = fileResponseList; | ||
this.postOfficialCommentResponseList = officialCommentList; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...mepage/application/post/service/dto/response/postDetail/SuggestionPostDetailResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package ussum.homepage.application.post.service.dto.response.postDetail; | ||
|
||
import java.util.List; | ||
import lombok.Builder; | ||
import ussum.homepage.application.comment.service.dto.response.PostOfficialCommentResponse; | ||
import ussum.homepage.application.post.service.dto.response.FileResponse; | ||
|
||
public class SuggestionPostDetailResponse extends PostDetailResDto{ | ||
private List<FileResponse> fileResponseList; | ||
private String studentId; | ||
|
||
@Builder | ||
public SuggestionPostDetailResponse(Long postId, String categoryName, String authorName, String studentId, String title, String content, String createdAt, String lastEditedAt, Boolean isAuthor, | ||
List<FileResponse> fileResponseList, List<PostOfficialCommentResponse> officialCommentList, | ||
List<String> canAuthority){ | ||
super(postId,categoryName,authorName,title,content,createdAt,lastEditedAt,isAuthor,canAuthority); | ||
this.fileResponseList = fileResponseList; | ||
this.studentId = studentId; | ||
|
||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/ussum/homepage/domain/post/service/factory/PostFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package ussum.homepage.domain.post.service.factory; | ||
|
||
import org.springframework.stereotype.Component; | ||
import ussum.homepage.application.post.service.dto.request.PostCreateRequest; | ||
|
||
@Component | ||
public interface PostFactory { | ||
PostCreateRequest convert(String boardCode, PostCreateRequest request); | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/ussum/homepage/domain/post/service/factory/PostFactoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package ussum.homepage.domain.post.service.factory; | ||
|
||
import ussum.homepage.application.post.service.dto.request.GeneralPostCreateRequest; | ||
import ussum.homepage.application.post.service.dto.request.PostCreateRequest; | ||
|
||
public class PostFactoryImpl implements PostFactory { | ||
|
||
@Override | ||
public PostCreateRequest convert(String boardCode, PostCreateRequest request) { | ||
return switch (boardCode){ | ||
case "인권신고게시판" -> | ||
GeneralPostCreateRequest.builder() | ||
.title(request.getTitle()) | ||
.content(request.getContent()) | ||
.isNotice(request.isNotice()) | ||
.thumbNailImage(request.getThumbNailImage()) | ||
.postFileList(request.getPostFileList()) | ||
.build(); | ||
default -> | ||
GeneralPostCreateRequest.builder() | ||
.title(request.getTitle()) | ||
.content(request.getContent()) | ||
.isNotice(request.isNotice()) | ||
.thumbNailImage(request.getThumbNailImage()) | ||
.postFileList(request.getPostFileList()) | ||
.build(); | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.