mirror of https://github.com/usbharu/Hideout.git
refactor: 命名規則に従って名前を変更
This commit is contained in:
parent
2501990dac
commit
95c901790f
|
@ -40,7 +40,7 @@ class GetPostDetailApplicationService(
|
|||
|
||||
val iconMedia = actor.icon?.let { mediaRepository.findById(it) }
|
||||
|
||||
val mediaList = mediaRepository.findByIds(post.mediaIds)
|
||||
val mediaList = mediaRepository.findByIdIn(post.mediaIds)
|
||||
|
||||
val reactions = reactionsQueryService.findAllByPostId(post.id)
|
||||
|
||||
|
@ -82,7 +82,7 @@ class GetPostDetailApplicationService(
|
|||
actor to iconMedia
|
||||
}
|
||||
|
||||
val mediaList = mediaRepository.findByIds(post.mediaIds)
|
||||
val mediaList = mediaRepository.findByIdIn(post.mediaIds)
|
||||
return PostDetail.of(
|
||||
post = post,
|
||||
actor = first,
|
||||
|
|
|
@ -19,6 +19,6 @@ package dev.usbharu.hideout.core.domain.model.media
|
|||
interface MediaRepository {
|
||||
suspend fun save(media: Media): Media
|
||||
suspend fun findById(id: MediaId): Media?
|
||||
suspend fun findByIds(ids: List<MediaId>): List<Media>
|
||||
suspend fun findByIdIn(ids: List<MediaId>): List<Media>
|
||||
suspend fun delete(media: Media)
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.net.URI
|
|||
import dev.usbharu.hideout.core.domain.model.media.Media as EntityMedia
|
||||
|
||||
@Repository
|
||||
class MediaRepositoryImpl : MediaRepository, AbstractRepository() {
|
||||
class ExposedMediaRepository : MediaRepository, AbstractRepository() {
|
||||
override val logger: Logger
|
||||
get() = Companion.logger
|
||||
|
||||
|
@ -51,12 +51,13 @@ class MediaRepositoryImpl : MediaRepository, AbstractRepository() {
|
|||
return query {
|
||||
return@query Media
|
||||
.selectAll().where { Media.id eq id.id }
|
||||
.limit(1)
|
||||
.singleOrNull()
|
||||
?.toMedia()
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun findByIds(ids: List<MediaId>): List<dev.usbharu.hideout.core.domain.model.media.Media> {
|
||||
override suspend fun findByIdIn(ids: List<MediaId>): List<dev.usbharu.hideout.core.domain.model.media.Media> {
|
||||
return query {
|
||||
return@query Media
|
||||
.selectAll()
|
||||
|
@ -72,7 +73,7 @@ class MediaRepositoryImpl : MediaRepository, AbstractRepository() {
|
|||
}
|
||||
|
||||
companion object {
|
||||
private val logger = LoggerFactory.getLogger(MediaRepositoryImpl::class.java)
|
||||
private val logger = LoggerFactory.getLogger(ExposedMediaRepository::class.java)
|
||||
}
|
||||
}
|
||||
|
|
@ -158,7 +158,7 @@ open class DefaultTimelineStore(
|
|||
actorRepository.findAllById(actorIds).associateBy { it.id }
|
||||
|
||||
override suspend fun getMedias(mediaIds: List<MediaId>): Map<MediaId, Media> =
|
||||
mediaRepository.findByIds(mediaIds).associateBy { it.id }
|
||||
mediaRepository.findByIdIn(mediaIds).associateBy { it.id }
|
||||
|
||||
override suspend fun getReactions(postIds: List<PostId>): Map<PostId, List<Reactions>> =
|
||||
reactionsQueryService.findAllByPostIdIn(postIds).groupBy { PostId(it.postId) }
|
||||
|
|
Loading…
Reference in New Issue