Skip to content

Commit 0cde809

Browse files
committed
✨ runningHistoryId, updatedAt 필드 Id 상수로 추가
1 parent 8f9feef commit 0cde809

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

data/src/main/java/com/whyranoid/data/Post/PostDataSource.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package com.whyranoid.data.Post
33
import com.google.firebase.firestore.FirebaseFirestore
44
import com.google.firebase.firestore.Query
55
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
68
import com.whyranoid.data.model.GroupInfoResponse
79
import com.whyranoid.data.model.RecruitPostResponse
810
import com.whyranoid.data.model.RunningPostResponse
@@ -30,12 +32,12 @@ class PostDataSource @Inject constructor(
3032
fun getAllPostFlow(): Flow<List<Post>> =
3133
callbackFlow {
3234
db.collection(CollectionId.POST_COLLECTION)
33-
.orderBy("updatedAt", Query.Direction.DESCENDING)
35+
.orderBy(UPDATED_AT, Query.Direction.DESCENDING)
3436
.addSnapshotListener { snapshot, _ ->
3537
val postList = mutableListOf<Post>()
3638
snapshot?.forEach { docuemnt ->
3739

38-
if (docuemnt["runningHistoryId"] != null) {
40+
if (docuemnt[RUNNING_HISTORY_ID] != null) {
3941
docuemnt.toObject(RunningPostResponse::class.java).let { postResponse ->
4042
db.collection(CollectionId.USERS_COLLECTION)
4143
.document(postResponse.authorId)

data/src/main/java/com/whyranoid/data/constant/FieldId.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ object FieldId {
88
const val GROUP_INTRODUCE = "introduce"
99
const val RULES = "rules"
1010
const val JOINED_GROUP_LIST = "joinedGroupList"
11+
const val UPDATED_AT = "updatedAt"
12+
const val RUNNING_HISTORY_ID = "runningHistoryId"
1113
}

0 commit comments

Comments
 (0)