-
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.
Browse files
Browse the repository at this point in the history
* feat: PostTitleResponse 구현 * refactor: 게시글 상세조회 이전, 다음 게시글 정보 추가 * feat: 이전, 다음 게시글 조회 query 작성 * refactor: 게시글 상세 조회 메소드 이름, 로직 수정 * refactor: 게시글 상세조회 테스트 코드 수정 * refactor: schema example 수정 * feat: 마지막 게시글 조회 테스트케이스 추가 * refactor: schema example 수정 * Update PostDetailResponse.java * refactor: deprecated된 메소드 수정 * refactor: 게시글 제목 컬럼 수정 * refactor: nullable 수정
- Loading branch information
Showing
10 changed files
with
163 additions
and
44 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
27 changes: 27 additions & 0 deletions
27
aics-api/src/main/java/kgu/developers/api/post/presentation/response/PostTitleResponse.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 kgu.developers.api.post.presentation.response; | ||
|
||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import kgu.developers.domain.post.domain.Post; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record PostTitleResponse( | ||
@Schema(description = "게시글 id", example = "1", requiredMode = REQUIRED) | ||
Long postId, | ||
|
||
@Schema(description = "게시글 제목", example = "SW 부트캠프 4기 교육생 모집", requiredMode = REQUIRED) | ||
String title | ||
) { | ||
public static PostTitleResponse from(Post post) { | ||
if (post == null) { | ||
return null; | ||
} | ||
|
||
return PostTitleResponse.builder() | ||
.postId(post.getId()) | ||
.title(post.getTitle()) | ||
.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
12 changes: 11 additions & 1 deletion
12
aics-domain/src/main/java/kgu/developers/domain/post/infrastructure/JpaPostRepository.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,17 @@ | ||
package kgu.developers.domain.post.infrastructure; | ||
|
||
import kgu.developers.domain.post.domain.Post; | ||
import java.time.LocalDateTime; | ||
import java.util.Optional; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import kgu.developers.domain.post.domain.Category; | ||
import kgu.developers.domain.post.domain.Post; | ||
|
||
public interface JpaPostRepository extends JpaRepository<Post, Long> { | ||
Optional<Post> findFirstByCreatedAtLessThanAndDeletedAtIsNullAndCategoryOrderByCreatedAtDesc( | ||
LocalDateTime createdAt, Category category); | ||
|
||
Optional<Post> findFirstByCreatedAtGreaterThanAndDeletedAtIsNullAndCategoryOrderByCreatedAtAsc( | ||
LocalDateTime createdAt, Category category); | ||
} |
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