refactor: make PostComments non-nullable

This commit is contained in:
Harsh Shandilya 2024-08-21 13:37:12 +05:30
parent c50790e4f9
commit 39e3d783cd
4 changed files with 14 additions and 9 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright © 2021-2023 Harsh Shandilya.
* Copyright © 2021-2024 Harsh Shandilya.
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
@ -22,7 +22,10 @@ constructor(
) {
suspend fun getSeenComments(postId: String) =
withContext(dbDispatcher) { postCommentsQueries.getCommentIds(postId).executeAsOneOrNull() }
withContext(dbDispatcher) {
postCommentsQueries.getCommentIds(postId).executeAsOneOrNull()
?: PostComments(postId = postId, commentIds = emptyList())
}
suspend fun markSeenComments(postId: String, comments: List<Comment>) {
withContext(dbDispatcher) {