File tree 1 file changed +8
-2
lines changed
Whatnow-Api/src/main/kotlin/com/depromeet/whatnow/api/promise/usecase
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,13 @@ class PromiseReadUseCase(
69
69
}
70
70
71
71
val action: (Entry <PromiseType , MutableList <PromiseFindDto >>) -> Unit = { (promiseType, promiseFindDtos) ->
72
- promiseFindDtos.sortBy { it.endTime }
72
+ // promiseType == BEFORE 인 것만 정렬
73
+ when (promiseType) {
74
+ // 예정된 약속은 오름차순 정렬
75
+ PromiseType .BEFORE -> promiseFindDtos.sortBy { it.endTime }
76
+ // 종료된 약속은 내림차순 정렬
77
+ else -> promiseFindDtos.sortByDescending { it.endTime }
78
+ }
73
79
}
74
80
promiseSplitByPromiseTypeDto.forEach(action)
75
81
}
@@ -119,7 +125,7 @@ class PromiseReadUseCase(
119
125
}
120
126
121
127
val promiseImagesUrls = promiseImageAdapter.findAllByPromiseId(promise.id!! )
122
- .sortedByDescending { it.createdAt }
128
+ .sortedBy { it.createdAt }
123
129
.map { it.uri }
124
130
125
131
val timeOverLocations = promiseUsers.mapNotNull { promiseUser ->
You can’t perform that action at this time.
0 commit comments