Skip to content

Commit c65a44e

Browse files
authored
[refactor] 사용자 피드 인증 횟수 모아보기 조회, 사용자 피드 인증 개별 날짜 조회 API 수정 (#240)
* #239 [refactor] 탈퇴한 챌린지 여부 필드 추가 * #239 [refactor] dto 반영 및 탈퇴한 챌린지 파티원의 피드도 조회하도록 수정 * #239 [refactor] 응답 필드 추가 * #239 [test] 테스트 코드 오류 수정
1 parent 4eb026e commit c65a44e

File tree

7 files changed

+23
-7
lines changed

7 files changed

+23
-7
lines changed

src/main/kotlin/com/photi/server/api/controller/user/response/FindUserFeedHistoryResponse.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ data class FindUserFeedHistoryResponse(
2424

2525
@Schema(description = "챌린지 초대코드", example = "478DS")
2626
val invitationCode: String,
27+
28+
@Schema(description = "탈퇴한 챌린지 여부", example = "true")
29+
val isDeleted: Boolean,
2730
) {
2831

2932
companion object {
@@ -36,6 +39,7 @@ data class FindUserFeedHistoryResponse(
3639
feedHistory.createdDate.toLocalDate(),
3740
feedHistory.name,
3841
feedHistory.invitationCode,
42+
feedHistory.status.isDeleted(),
3943
)
4044
}
4145
}

src/main/kotlin/com/photi/server/api/controller/user/response/FindUserFeedsByDateResponse.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ data class FindUserFeedsByDateResponse(
2323
@Schema(description = "피드 인증 시간", example = "13:00")
2424
@field:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "kk:mm")
2525
val proveTime: LocalTime,
26+
27+
@Schema(description = "탈퇴한 챌린지 여부", example = "true")
28+
val isDeleted: Boolean,
2629
) {
2730

2831
companion object {
@@ -34,6 +37,7 @@ data class FindUserFeedsByDateResponse(
3437
feed.imageUrl,
3538
feed.name,
3639
feed.proveTime.toLocalTime(),
40+
feed.status.isDeleted(),
3741
)
3842
}
3943

src/main/kotlin/com/photi/server/domain/challenge/ChallengeMemberStatus.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ enum class ChallengeMemberStatus(
55
) {
66
PROGRESS("진행중"),
77
COMPLETE("완료"),
8-
DELETED("탈퇴"),
8+
DELETED("탈퇴");
9+
10+
fun isDeleted() = this == DELETED
911
}

src/main/kotlin/com/photi/server/domain/user/custom/UserCustomRepositoryImpl.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class UserCustomRepositoryImpl(
126126
feed.imageUrl,
127127
feed.challenge.name,
128128
feed.createDateTime,
129+
feed.challengeMember.status,
129130
)
130131
)
131132
.from(feed)
@@ -155,15 +156,13 @@ class UserCustomRepositoryImpl(
155156
feed.createDateTime,
156157
feed.challenge.name,
157158
feed.challenge.invitationCode,
159+
feed.challengeMember.status,
158160
)
159161
)
160162
.from(feed)
161163
.join(feed.challenge)
162164
.join(feed.challengeMember.user)
163-
.where(
164-
feed.challengeMember.user.id.eq(userId),
165-
feed.challengeMember.status.eq(PROGRESS),
166-
)
165+
.where(feed.challengeMember.user.id.eq(userId))
167166
.orderBy(feed.createDateTime.desc())
168167
.offset(pageable.offset)
169168
.limit(pageSize + 1L)

src/main/kotlin/com/photi/server/service/user/dto/FindUserFeedHistoryDto.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.photi.server.service.user.dto
22

3+
import com.photi.server.domain.challenge.ChallengeMemberStatus
34
import com.querydsl.core.annotations.QueryProjection
45
import java.time.LocalDateTime
56

@@ -10,4 +11,5 @@ data class FindUserFeedHistoryDto @QueryProjection constructor(
1011
val createdDate: LocalDateTime,
1112
val name: String,
1213
val invitationCode: String,
14+
val status: ChallengeMemberStatus,
1315
)

src/main/kotlin/com/photi/server/service/user/dto/FindUserFeedsByDateDto.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.photi.server.service.user.dto
22

3+
import com.photi.server.domain.challenge.ChallengeMemberStatus
34
import com.querydsl.core.annotations.QueryProjection
45
import java.time.LocalDateTime
56

@@ -9,4 +10,5 @@ data class FindUserFeedsByDateDto @QueryProjection constructor(
910
val imageUrl: String,
1011
val name: String,
1112
val proveTime: LocalDateTime,
13+
val status: ChallengeMemberStatus,
1214
)

src/test/kotlin/com/photi/server/service/user/UserServiceTest.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.photi.server.service.user
33
import com.photi.server.common.constant.ExceptionCode.USER_NOT_FOUND
44
import com.photi.server.common.response.CustomException
55
import com.photi.server.domain.challenge.ChallengeMemberRepository
6+
import com.photi.server.domain.challenge.ChallengeMemberStatus
67
import com.photi.server.domain.challenge.ChallengeRepository
78
import com.photi.server.domain.user.Contact
89
import com.photi.server.domain.user.User
@@ -232,7 +233,8 @@ class UserServiceTest {
232233
"https://url.kr/5MhHhD",
233234
LocalDateTime.now(),
234235
"챌린지 이름",
235-
"ABC12"
236+
"ABC12",
237+
ChallengeMemberStatus.DELETED,
236238
)
237239
val content = listOf(dto, dto, dto)
238240
val pageable = PageRequest.of(0, 10)
@@ -326,7 +328,8 @@ class UserServiceTest {
326328
1L,
327329
"https://url.kr/5MhHhD",
328330
"챌린지 이름",
329-
LocalDateTime.of(2025, 6, 3, 13, 0)
331+
LocalDateTime.of(2025, 6, 3, 13, 0),
332+
ChallengeMemberStatus.PROGRESS,
330333
)
331334
}
332335

0 commit comments

Comments
 (0)