refactor: 命名規則に従って名前を変更

This commit is contained in:
usbharu 2024-09-11 07:36:53 +09:00
parent 2501990dac
commit 95c901790f
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
4 changed files with 8 additions and 7 deletions

View File

@ -40,7 +40,7 @@ class GetPostDetailApplicationService(
val iconMedia = actor.icon?.let { mediaRepository.findById(it) } 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) val reactions = reactionsQueryService.findAllByPostId(post.id)
@ -82,7 +82,7 @@ class GetPostDetailApplicationService(
actor to iconMedia actor to iconMedia
} }
val mediaList = mediaRepository.findByIds(post.mediaIds) val mediaList = mediaRepository.findByIdIn(post.mediaIds)
return PostDetail.of( return PostDetail.of(
post = post, post = post,
actor = first, actor = first,

View File

@ -19,6 +19,6 @@ package dev.usbharu.hideout.core.domain.model.media
interface MediaRepository { interface MediaRepository {
suspend fun save(media: Media): Media suspend fun save(media: Media): Media
suspend fun findById(id: MediaId): 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) suspend fun delete(media: Media)
} }

View File

@ -27,7 +27,7 @@ import java.net.URI
import dev.usbharu.hideout.core.domain.model.media.Media as EntityMedia import dev.usbharu.hideout.core.domain.model.media.Media as EntityMedia
@Repository @Repository
class MediaRepositoryImpl : MediaRepository, AbstractRepository() { class ExposedMediaRepository : MediaRepository, AbstractRepository() {
override val logger: Logger override val logger: Logger
get() = Companion.logger get() = Companion.logger
@ -51,12 +51,13 @@ class MediaRepositoryImpl : MediaRepository, AbstractRepository() {
return query { return query {
return@query Media return@query Media
.selectAll().where { Media.id eq id.id } .selectAll().where { Media.id eq id.id }
.limit(1)
.singleOrNull() .singleOrNull()
?.toMedia() ?.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 {
return@query Media return@query Media
.selectAll() .selectAll()
@ -72,7 +73,7 @@ class MediaRepositoryImpl : MediaRepository, AbstractRepository() {
} }
companion object { companion object {
private val logger = LoggerFactory.getLogger(MediaRepositoryImpl::class.java) private val logger = LoggerFactory.getLogger(ExposedMediaRepository::class.java)
} }
} }

View File

@ -158,7 +158,7 @@ open class DefaultTimelineStore(
actorRepository.findAllById(actorIds).associateBy { it.id } actorRepository.findAllById(actorIds).associateBy { it.id }
override suspend fun getMedias(mediaIds: List<MediaId>): Map<MediaId, Media> = 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>> = override suspend fun getReactions(postIds: List<PostId>): Map<PostId, List<Reactions>> =
reactionsQueryService.findAllByPostIdIn(postIds).groupBy { PostId(it.postId) } reactionsQueryService.findAllByPostIdIn(postIds).groupBy { PostId(it.postId) }