Skip to content

Commit 408ddbd

Browse files
authored
Merge pull request #1036 from tunjid/joel/expose-post-thread-parent-uri
Expose parentPostUri in ThreadPostEntity
2 parents 31ed2d8 + d78e18c commit 408ddbd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

data/database/src/commonMain/kotlin/com/tunjid/heron/data/database/daos/PostDao.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,14 @@ interface PostDao {
396396
ft.rootPostUri AS rootPostUri,
397397
ft.generation AS generation,
398398
ft.ancestorCreated AS ancestorCreated,
399-
ft.postCreated AS postCreated
399+
ft.postCreated AS postCreated,
400+
pt.parentPostUri AS parentPostUri
400401
FROM
401402
posts p
402403
JOIN
403404
FullThread ft ON p.uri = ft.uri
405+
LEFT JOIN
406+
postThreads pt ON pt.postUri = p.uri
404407
ORDER BY
405408
ft.ancestorCreated, ft.generation, ft.postCreated; -- sort by the first reply to the op, then the generation, then the post itself
406409
""",

data/database/src/commonMain/kotlin/com/tunjid/heron/data/database/entities/PostEntity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ data class ThreadedPostEntity(
206206
val entity: PostEntity,
207207
val generation: Long,
208208
val rootPostUri: PostUri?,
209+
val parentPostUri: PostUri?,
209210
)
210211

211212
fun PopulatedPostEntity.asExternalModel(

0 commit comments

Comments
 (0)