-
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 #53 from ssu-student-union/feat/48-post
[feat] : #48 Post 생성, 수정, 파일 관련 로직 추가, 자잘한 로직 수정
- Loading branch information
Showing
16 changed files
with
254 additions
and
21 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
19 changes: 19 additions & 0 deletions
19
...ava/ussum/homepage/application/post/service/dto/response/postSave/PostCreateResponse.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,19 @@ | ||
package ussum.homepage.application.post.service.dto.response.postSave; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import ussum.homepage.domain.post.Post; | ||
|
||
@Getter | ||
@Builder | ||
public class PostCreateResponse { | ||
private Long post_id; | ||
private String boardCode; | ||
|
||
public static PostCreateResponse of(Long id, String boardCode){ | ||
return PostCreateResponse.builder() | ||
.post_id(id) | ||
.boardCode(boardCode) | ||
.build(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../java/ussum/homepage/application/post/service/dto/response/postSave/PostFileResponse.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,18 @@ | ||
package ussum.homepage.application.post.service.dto.response.postSave; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class PostFileResponse { | ||
private Long id; | ||
private String url; | ||
|
||
public static PostFileResponse of(Long id, String url){ | ||
return PostFileResponse.builder() | ||
.id(id) | ||
.url(url) | ||
.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
4 changes: 4 additions & 0 deletions
4
src/main/java/ussum/homepage/domain/post/PostFileRepository.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,7 +1,11 @@ | ||
package ussum.homepage.domain.post; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public interface PostFileRepository { | ||
List<PostFile> findAllByPostId(Long postId); | ||
Optional<PostFile> findById(Long id); | ||
List<PostFile> saveAll(List<PostFile> postFiles); | ||
void updatePostIdForIds(List<Long> postFileIds, Long postId); | ||
} |
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
27 changes: 27 additions & 0 deletions
27
src/main/java/ussum/homepage/domain/post/service/PostFileAppender.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,27 @@ | ||
package ussum.homepage.domain.post.service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import ussum.homepage.domain.post.Post; | ||
import ussum.homepage.domain.post.PostFile; | ||
import ussum.homepage.domain.post.PostFileRepository; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class PostFileAppender { | ||
private final PostFileRepository postFileRepository; | ||
|
||
@Transactional | ||
public List<PostFile> saveAllPostFile(List<PostFile> fileList) { | ||
return postFileRepository.saveAll(fileList); | ||
} | ||
|
||
@Transactional | ||
public void updatePostIdForIds(List<Long> postFileIds, Long postId) { | ||
postFileRepository.updatePostIdForIds(postFileIds, postId); | ||
} | ||
} |
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
Oops, something went wrong.