File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
data/src/main/java/com/whyranoid/data Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ package com.whyranoid.data.Post
3
3
import com.google.firebase.firestore.FirebaseFirestore
4
4
import com.google.firebase.firestore.Query
5
5
import com.whyranoid.data.constant.CollectionId
6
+ import com.whyranoid.data.constant.FieldId.RUNNING_HISTORY_ID
7
+ import com.whyranoid.data.constant.FieldId.UPDATED_AT
6
8
import com.whyranoid.data.model.GroupInfoResponse
7
9
import com.whyranoid.data.model.RecruitPostResponse
8
10
import com.whyranoid.data.model.RunningPostResponse
@@ -30,12 +32,12 @@ class PostDataSource @Inject constructor(
30
32
fun getAllPostFlow (): Flow <List <Post >> =
31
33
callbackFlow {
32
34
db.collection(CollectionId .POST_COLLECTION )
33
- .orderBy(" updatedAt " , Query .Direction .DESCENDING )
35
+ .orderBy(UPDATED_AT , Query .Direction .DESCENDING )
34
36
.addSnapshotListener { snapshot, _ ->
35
37
val postList = mutableListOf<Post >()
36
38
snapshot?.forEach { docuemnt ->
37
39
38
- if (docuemnt[" runningHistoryId " ] != null ) {
40
+ if (docuemnt[RUNNING_HISTORY_ID ] != null ) {
39
41
docuemnt.toObject(RunningPostResponse ::class .java).let { postResponse ->
40
42
db.collection(CollectionId .USERS_COLLECTION )
41
43
.document(postResponse.authorId)
Original file line number Diff line number Diff line change @@ -8,4 +8,6 @@ object FieldId {
8
8
const val GROUP_INTRODUCE = " introduce"
9
9
const val RULES = " rules"
10
10
const val JOINED_GROUP_LIST = " joinedGroupList"
11
+ const val UPDATED_AT = " updatedAt"
12
+ const val RUNNING_HISTORY_ID = " runningHistoryId"
11
13
}
You can’t perform that action at this time.
0 commit comments