Skip to content

Commit b0d4955

Browse files
authored
[Fix/#263] 각종 수정 (#264)
* refactor: cloth season 관련 오류 해결 * feat: 룩북 개수 반환 필드 추가 * update: application-test.yml * feat: 기록에 사용자 좋아요 여부 필드 반환 추가 * update: workflows env * refactor: test 위한 수정 * refactor: Spotless 적용
1 parent b9f1898 commit b0d4955

15 files changed

Lines changed: 100 additions & 18 deletions

File tree

.github/workflows/dev-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
username: ubuntu
6464
host: ${{ secrets.DEV_EC2_HOST }}
6565
key: ${{ secrets.DEV_EC2_SSH_KEY }}
66-
envs: DOCKERHUB_USERNAME,DEV_MYSQL_HOST,MYSQL_PORT,DB_NAME,DB_USERNAME,DB_PASSWORD,REDIS_HOST,REDIS_PORT,REDIS_PASSWORD,DEV_KAKAO_CLIENT_ID,DEV_KAKAO_CLIENT_SECRET,DEV_APPLE_CLIENT_ID,DEV_APPLE_CLIENT_SECRET,JWT_ACCESS_TOKEN_SECRET,JWT_REFRESH_TOKEN_SECRET,JWT_ACCESS_TOKEN_EXPIRATION_TIME,JWT_REFRESH_TOKEN_EXPIRATION_TIME,JWT_ISSUER,DEV_AWS_ACCESS_KEY_ID,DEV_AWS_SECRET_ACCESS_KEY,AWS_REGION,DEV_S3_BUCKET,DEV_S3_ENDPOINT,SWAGGER_USERNAME,SWAGGER_PASSWORD,FIREBASE_SA_JSON_B64
66+
envs: DOCKERHUB_USERNAME,DEV_MYSQL_HOST,MYSQL_PORT,DB_NAME,DB_USERNAME,DB_PASSWORD,REDIS_HOST,REDIS_PORT,REDIS_PASSWORD,DEV_KAKAO_CLIENT_ID,DEV_KAKAO_CLIENT_SECRET,DEV_APPLE_CLIENT_ID,DEV_APPLE_CLIENT_SECRET,JWT_ACCESS_TOKEN_SECRET,JWT_REFRESH_TOKEN_SECRET,JWT_ACCESS_TOKEN_EXPIRATION_TIME,JWT_REFRESH_TOKEN_EXPIRATION_TIME,JWT_ISSUER,DEV_AWS_ACCESS_KEY_ID,DEV_AWS_SECRET_ACCESS_KEY,AWS_REGION,DEV_S3_BUCKET,DEV_S3_ENDPOINT,SWAGGER_USERNAME,SWAGGER_PASSWORD,FIREBASE_SA_JSON_B64,MEILISEARCH_ENDPOINT,MEILISEARCH_KEY
6767
script: |
6868
export DOCKERHUB_NAME=${{ secrets.DOCKERHUB_USERNAME }}
6969
export DOCKER_TAG=dev-app

.github/workflows/prod-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
username: ubuntu
7474
host: ${{ secrets.PROD_EC2_HOST }}
7575
key: ${{ secrets.PROD_EC2_SSH_KEY }}
76-
envs: DOCKERHUB_USERNAME,SPRING_PROFILES_ACTIVE,PROD_MYSQL_HOST,MYSQL_PORT,DB_NAME,DB_USERNAME,DB_PASSWORD,REDIS_HOST,REDIS_PORT,REDIS_PASSWORD,PROD_KAKAO_CLIENT_ID,PROD_KAKAO_CLIENT_SECRET,PROD_APPLE_CLIENT_ID,PROD_APPLE_CLIENT_SECRET,JWT_ACCESS_TOKEN_SECRET,JWT_REFRESH_TOKEN_SECRET,JWT_ACCESS_TOKEN_EXPIRATION_TIME,JWT_REFRESH_TOKEN_EXPIRATION_TIME,JWT_ISSUER,PROD_AWS_ACCESS_KEY_ID,PROD_AWS_SECRET_ACCESS_KEY,AWS_REGION,PROD_S3_BUCKET,PROD_S3_ENDPOINT,SWAGGER_USERNAME,SWAGGER_PASSWORD,FIREBASE_SA_JSON_B64
76+
envs: DOCKERHUB_USERNAME,SPRING_PROFILES_ACTIVE,PROD_MYSQL_HOST,MYSQL_PORT,DB_NAME,DB_USERNAME,DB_PASSWORD,REDIS_HOST,REDIS_PORT,REDIS_PASSWORD,PROD_KAKAO_CLIENT_ID,PROD_KAKAO_CLIENT_SECRET,PROD_APPLE_CLIENT_ID,PROD_APPLE_CLIENT_SECRET,JWT_ACCESS_TOKEN_SECRET,JWT_REFRESH_TOKEN_SECRET,JWT_ACCESS_TOKEN_EXPIRATION_TIME,JWT_REFRESH_TOKEN_EXPIRATION_TIME,JWT_ISSUER,PROD_AWS_ACCESS_KEY_ID,PROD_AWS_SECRET_ACCESS_KEY,AWS_REGION,PROD_S3_BUCKET,PROD_S3_ENDPOINT,SWAGGER_USERNAME,SWAGGER_PASSWORD,FIREBASE_SA_JSON_B64,MEILISEARCH_ENDPOINT,MEILISEARCH_KEY
7777
script: |
7878
export DOCKERHUB_NAME=${{ secrets.DOCKERHUB_USERNAME }}
7979
export DOCKER_TAG=prod-app

clokey-api/src/main/java/org/clokey/domain/history/dto/response/DailyHistoryResponse.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public record DailyHistoryResponse(
1111
@Schema(description = "닉네임", example = "포테토남") String nickname,
1212
@Schema(description = "기록 이미지 목록") List<DailyHistoryResponse.ImagePayload> images,
1313
@Schema(description = "좋아요 개수", example = "10") Long likeCount,
14+
@Schema(description = "좋아요 여부", example = "true") Boolean liked,
1415
@Schema(description = "댓글 개수", example = "5") Long commentCount,
1516
@Schema(description = "기록 날짜", example = "2025-01-01") LocalDate historyDate,
1617
@Schema(description = "상황 ID", example = "1") Long situationId,
@@ -25,6 +26,7 @@ public static DailyHistoryResponse of(
2526
String nickname,
2627
List<ImagePayload> images,
2728
Long likeCount,
29+
boolean liked,
2830
Long commentCount,
2931
LocalDate historyDate,
3032
Long situationId,
@@ -38,6 +40,7 @@ public static DailyHistoryResponse of(
3840
nickname,
3941
images,
4042
likeCount,
43+
liked,
4144
commentCount,
4245
historyDate,
4346
situationId,

clokey-api/src/main/java/org/clokey/domain/history/service/HistoryServiceImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ public DailyHistoryResponse getDailyHistory(Long historyId) {
241241
.toList();
242242

243243
long likeCount = memberLikeRepository.countByHistoryId(historyId);
244+
boolean liked =
245+
memberLikeRepository
246+
.findByMemberIdAndHistoryId(currentMember.getId(), historyId)
247+
.isPresent();
244248

245249
long commentCount = commentRepository.countByHistoryIdAndBannedFalse(historyId);
246250

@@ -264,6 +268,7 @@ public DailyHistoryResponse getDailyHistory(Long historyId) {
264268
history.getMember().getNickname(),
265269
images,
266270
likeCount,
271+
liked,
267272
commentCount,
268273
history.getHistoryDate(),
269274
history.getSituation().getId(),

clokey-api/src/main/java/org/clokey/domain/lookbook/dto/response/LookBookListResponse.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
public record LookBookListResponse(
66
@Schema(description = "룩북 ID", example = "1") Long lookBookId,
77
@Schema(description = "룩북 이름", example = "데이트 룩") String lookBookName,
8+
@Schema(description = "룩북 개수", example = "3") Long count,
89
@Schema(description = "대표 코디 사진 (첫 번째 코디)", example = "https://example.jpg")
910
String imageUrl) {}

clokey-api/src/main/java/org/clokey/domain/lookbook/repository/LookBookRepositoryImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public Slice<LookBookListResponse> findAllLookBookByMemberId(
3232
LookBookListResponse.class,
3333
lookBook.id,
3434
lookBook.name,
35+
JPAExpressions.select(coordinate.count())
36+
.from(coordinate)
37+
.where(coordinate.lookBook.id.eq(lookBook.id)),
3538
JPAExpressions.select(coordinate.imageUrl)
3639
.from(coordinate)
3740
.where(coordinate.lookBook.id.eq(lookBook.id))

clokey-api/src/main/java/org/clokey/domain/search/repository/MeiliSearchRepositoryImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
import org.clokey.domain.search.dto.response.SearchedMemberResponse;
1515
import org.clokey.domain.search.enums.HistorySearchSortType;
1616
import org.clokey.response.SliceResponse;
17+
import org.springframework.context.annotation.Profile;
1718
import org.springframework.data.domain.PageRequest;
1819
import org.springframework.data.domain.Sort;
1920
import org.springframework.stereotype.Repository;
2021

2122
@Repository
2223
@RequiredArgsConstructor
24+
@Profile("!test")
2325
public class MeiliSearchRepositoryImpl implements SearchRepository {
2426

2527
private static final String HISTORY_INDEX = "histories";

clokey-api/src/main/java/org/clokey/domain/search/repository/SearchRepositoryCustomImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private BooleanExpression seasonsFilter(List<Season> seasons) {
7373
if (seasons == null || seasons.isEmpty()) {
7474
return null;
7575
}
76-
return cloth.season.in(seasons);
76+
return cloth.seasons.any().in(seasons);
7777
}
7878

7979
private BooleanExpression lastClothIdCursor(Long lastClothId, SortDirection direction) {

clokey-api/src/test/java/org/clokey/domain/history/controller/HistoryControllerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ class 일별_기록_조회_요청_시 {
725725
new DailyHistoryResponse.ImagePayload(1L, "testImageUrl1"),
726726
new DailyHistoryResponse.ImagePayload(2L, "testImageUrl2")),
727727
10L,
728+
false,
728729
5L,
729730
java.time.LocalDate.of(2025, 1, 1),
730731
1L,

clokey-api/src/test/java/org/clokey/domain/history/service/HistoryServiceImplTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,9 +1056,17 @@ void setUp() {
10561056
DailyHistoryResponse::situationName,
10571057
DailyHistoryResponse::content,
10581058
DailyHistoryResponse::likeCount,
1059+
DailyHistoryResponse::liked,
10591060
DailyHistoryResponse::commentCount)
10601061
.containsExactly(
1061-
1L, LocalDate.now(), 1L, "testSituation1", "testContent1", 0L, 0L);
1062+
1L,
1063+
LocalDate.now(),
1064+
1L,
1065+
"testSituation1",
1066+
"testContent1",
1067+
0L,
1068+
false,
1069+
0L);
10621070

10631071
assertThat(response.images()).hasSize(2);
10641072
assertThat(response.images())

0 commit comments

Comments
 (0)