-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
서포터 피드백 작성 유무 반환 추가, 러너 게시글 조회수 flyway 컬럼명 수정, 서포터 지원자 수 조회시 dto 사용하도…
…록 수정 (#555) * feat: 러너 게시글의 서포터 피드백 유무 필드(컬럼) 구현 * test: 러너 게시글에 서포터 피드백 유무 컬럼 추가 후 테스트 변경 * feat: 러너 게시글 응답에 서포터 피드백 유무 정보 추가 * chore: 러너 게시글에 서포터 피드백 유무 flyway 테이블 컬럼 추가 * chore: 러너 게시글 조회수 컬럼명 flyway 수정 추가 * style: IsReviewed get 메서드 네이밍 get으로 통일되게 수정 * fix: IsReviewed 내부 값 반환 수정 * test: 테스트 내부 entityManager 사용 후 close 하도록 수정 * refactor: 러너 게시글 식별자값 목록으로 서포터 지원자 수 조회시 매핑된 서포터 지원자 수 객체를 반환하도록 레포지터리 메서드 변경 * refactor: 매핑된 서포터 지원자 수 객체를 사용하도록 서비스, 컨트롤러 변경 * style: 공백 및 개행 스타일 수정 * style: toString 메서드 삭제 * refactor: dto 클래스를 레코드로 변경 * test: entityManager flush, close 순서 변경
- Loading branch information
Showing
30 changed files
with
333 additions
and
105 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
4 changes: 4 additions & 0 deletions
4
...d/baton/src/main/java/touch/baton/domain/runnerpost/repository/dto/ApplicantCountDto.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,4 @@ | ||
package touch.baton.domain.runnerpost.repository.dto; | ||
|
||
public record ApplicantCountDto(Long runnerPostId, Long applicantCount) { | ||
} |
10 changes: 10 additions & 0 deletions
10
.../src/main/java/touch/baton/domain/runnerpost/repository/dto/ApplicantCountMappingDto.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,10 @@ | ||
package touch.baton.domain.runnerpost.repository.dto; | ||
|
||
import java.util.Map; | ||
|
||
public record ApplicantCountMappingDto(Map<Long, Long> applicantCounts) { | ||
|
||
public Long getApplicantCountByRunnerPostId(final Long runnerPostId) { | ||
return applicantCounts.get(runnerPostId); | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
backend/baton/src/main/java/touch/baton/domain/runnerpost/vo/IsReviewed.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,35 @@ | ||
package touch.baton.domain.runnerpost.vo; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Embeddable; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.ColumnDefault; | ||
|
||
import static lombok.AccessLevel.PROTECTED; | ||
|
||
@EqualsAndHashCode | ||
@NoArgsConstructor(access = PROTECTED) | ||
@Embeddable | ||
public class IsReviewed { | ||
|
||
@ColumnDefault(value = "false") | ||
@Column(name = "is_reviewed", nullable = false) | ||
private boolean value = false; | ||
|
||
private IsReviewed(final boolean value) { | ||
this.value = value; | ||
} | ||
|
||
public static IsReviewed notReviewed() { | ||
return new IsReviewed(false); | ||
} | ||
|
||
public static IsReviewed reviewed() { | ||
return new IsReviewed(true); | ||
} | ||
|
||
public boolean getValue() { | ||
return value; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...n/src/main/resources/db/migration/V20230920_1__add_new_runner_post_is_reviewed_column.sql
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 @@ | ||
ALTER TABLE runner_post ADD COLUMN is_reviewed BOOLEAN DEFAULT FALSE; |
1 change: 1 addition & 0 deletions
1
.../main/resources/db/migration/V20230920_2__alter_runner_post_watched_count_column_name.sql
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 @@ | ||
ALTER TABLE runner_post CHANGE COLUMN watch_count watched_count INT DEFAULT 0 NOT NULL; |
5 changes: 3 additions & 2 deletions
5
backend/baton/src/test/java/touch/baton/assure/repository/TestRunnerPostReadRepository.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,17 +1,18 @@ | ||
package touch.baton.assure.repository; | ||
|
||
import touch.baton.domain.runnerpost.repository.RunnerPostReadRepository; | ||
import touch.baton.domain.runnerpost.repository.dto.ApplicantCountDto; | ||
|
||
import java.util.List; | ||
|
||
public interface TestRunnerPostReadRepository extends RunnerPostReadRepository { | ||
|
||
default Long countApplicantByRunnerPostId(final Long runnerPostId) { | ||
final List<Long> foundApplicants = countApplicantsByRunnerPostIds(List.of(runnerPostId)); | ||
final List<ApplicantCountDto> foundApplicants = countApplicantsByRunnerPostIds(List.of(runnerPostId)); | ||
if (foundApplicants.isEmpty()) { | ||
throw new IllegalArgumentException("테스트에서 러너 게시글 식별자값으로 서포터 지원자 수 조회에 실패하였습니다."); | ||
} | ||
|
||
return foundApplicants.get(0); | ||
return foundApplicants.get(0).applicantCount(); | ||
} | ||
} |
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.