mirror of https://github.com/usbharu/Hideout.git
feat: ホームタイムラインが読めるように
This commit is contained in:
parent
e1787423e8
commit
d53cdca9e5
|
@ -8,6 +8,5 @@ interface FilterRepository {
|
||||||
|
|
||||||
suspend fun findByFilterKeywordId(filterKeywordId: FilterKeywordId): Filter?
|
suspend fun findByFilterKeywordId(filterKeywordId: FilterKeywordId): Filter?
|
||||||
suspend fun findByFilterId(filterId: FilterId): Filter?
|
suspend fun findByFilterId(filterId: FilterId): Filter?
|
||||||
|
|
||||||
suspend fun findByUserDetailId(userDetailId: UserDetailId): List<Filter>
|
suspend fun findByUserDetailId(userDetailId: UserDetailId): List<Filter>
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,22 +59,22 @@ class ExposedFilterRepository(private val filterQueryMapper: QueryMapper<Filter>
|
||||||
Filters.deleteWhere { id eq filter.id.id }
|
Filters.deleteWhere { id eq filter.id.id }
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun findByFilterKeywordId(filterKeywordId: FilterKeywordId): Filter? {
|
override suspend fun findByFilterKeywordId(filterKeywordId: FilterKeywordId): Filter? = query {
|
||||||
val filterId = FilterKeywords
|
val filterId = FilterKeywords
|
||||||
.selectAll()
|
.selectAll()
|
||||||
.where { FilterKeywords.id eq filterKeywordId.id }
|
.where { FilterKeywords.id eq filterKeywordId.id }
|
||||||
.firstOrNull()?.get(FilterKeywords.filterId) ?: return null
|
.firstOrNull()?.get(FilterKeywords.filterId) ?: return@query null
|
||||||
val where = Filters.selectAll().where { Filters.id eq filterId }
|
val where = Filters.selectAll().where { Filters.id eq filterId }
|
||||||
return filterQueryMapper.map(where).firstOrNull()
|
return@query filterQueryMapper.map(where).firstOrNull()
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun findByFilterId(filterId: FilterId): Filter? {
|
override suspend fun findByFilterId(filterId: FilterId): Filter? = query {
|
||||||
val where = Filters.selectAll().where { Filters.id eq filterId.id }
|
val where = Filters.selectAll().where { Filters.id eq filterId.id }
|
||||||
return filterQueryMapper.map(where).firstOrNull()
|
return@query filterQueryMapper.map(where).firstOrNull()
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun findByUserDetailId(userDetailId: UserDetailId): List<Filter> {
|
override suspend fun findByUserDetailId(userDetailId: UserDetailId): List<Filter> = query {
|
||||||
return Filters.selectAll().where { Filters.userId eq userDetailId.id }.let(filterQueryMapper::map)
|
return@query Filters.selectAll().where { Filters.userId eq userDetailId.id }.let(filterQueryMapper::map)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -67,7 +67,7 @@ open class DefaultTimelineStore(
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun getNewerFilters(userDetailId: UserDetailId, lastUpdateAt: Instant): List<Filter> {
|
override suspend fun getNewerFilters(userDetailId: UserDetailId, lastUpdateAt: Instant): List<Filter> {
|
||||||
TODO("Not yet implemented")
|
return filterRepository.findByUserDetailId(userDetailId)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun applyFilters(post: Post, filters: List<Filter>): FilteredPost {
|
override suspend fun applyFilters(post: Post, filters: List<Filter>): FilteredPost {
|
||||||
|
|
Loading…
Reference in New Issue