Last active
February 24, 2021 12:05
-
-
Save TorkelV/dffbb98ceab137a53220662c541c56b4 to your computer and use it in GitHub Desktop.
snapshot_flow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun collection(path: String) = Firebase.firestore.collection(path) | |
override fun getLeaders(): Flow<List<User>> { | |
return collection("users") | |
.whereGreaterThan("points", 0) | |
.orderBy("points", Query.Direction.DESCENDING) | |
.limit(50) | |
.asFlow().map { snapshots -> | |
snapshots.map { it.toUserDto().toUser() } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment