fix: 削除されていなかった実装を削除

This commit is contained in:
usbharu 2023-12-21 11:15:16 +09:00
parent bf4d694aa2
commit fddc29bdfd
9 changed files with 19 additions and 68 deletions

View File

@ -1,18 +0,0 @@
package dev.usbharu.hideout.core.infrastructure.exposedquery
import dev.usbharu.hideout.core.domain.model.deletedActor.DeletedActor
import dev.usbharu.hideout.core.infrastructure.exposedrepository.DeletedActors
import dev.usbharu.hideout.core.infrastructure.exposedrepository.toDeletedActor
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.select
import org.springframework.stereotype.Repository
@Repository
class DeletedActorQueryServiceImpl : DeletedActorQueryService {
override suspend fun findByNameAndDomain(name: String, domain: String): DeletedActor? {
return DeletedActors
.select { DeletedActors.name eq name and (DeletedActors.domain eq domain) }
.singleOrNull()
?.toDeletedActor()
}
}

View File

@ -1,13 +0,0 @@
package dev.usbharu.hideout.core.infrastructure.exposedquery
import dev.usbharu.hideout.core.infrastructure.exposedrepository.Instance
import dev.usbharu.hideout.core.infrastructure.exposedrepository.toInstance
import org.jetbrains.exposed.sql.select
import org.springframework.stereotype.Repository
import dev.usbharu.hideout.core.domain.model.instance.Instance as InstanceEntity
@Repository
class InstanceQueryServiceImpl : InstanceQueryService {
override suspend fun findByUrl(url: String): InstanceEntity? = Instance.select { Instance.url eq url }
.singleOrNull()?.toInstance()
}

View File

@ -1,17 +0,0 @@
package dev.usbharu.hideout.core.infrastructure.exposedquery
import dev.usbharu.hideout.core.infrastructure.exposedrepository.Media
import dev.usbharu.hideout.core.infrastructure.exposedrepository.toMedia
import org.jetbrains.exposed.sql.select
import org.springframework.stereotype.Repository
import dev.usbharu.hideout.core.domain.model.media.Media as MediaEntity
@Repository
class MediaQueryServiceImpl : MediaQueryService {
override suspend fun findByRemoteUrl(remoteUrl: String): MediaEntity? {
return Media.select { Media.remoteUrl eq remoteUrl }.forUpdate()
.singleOrNull()
?.toMedia()
}
}

View File

@ -1,8 +0,0 @@
package dev.usbharu.hideout.core.infrastructure.exposedquery
import org.springframework.stereotype.Repository
@Repository
class ReactionQueryServiceImpl : ReactionQueryService {
}

View File

@ -1,8 +0,0 @@
package dev.usbharu.hideout.core.infrastructure.exposedquery
import org.springframework.stereotype.Service
@Service
class RelationshipQueryServiceImpl : RelationshipQueryService {
}

View File

@ -38,9 +38,17 @@ class DeletedActorRepositoryImpl : DeletedActorRepository, AbstractRepository()
}
override suspend fun findById(id: Long): DeletedActor? = query {
return@query DeletedActors.select { DeletedActors.id eq id }
return@query DeletedActors
.select { DeletedActors.id eq id }
.singleOrNull()
?.let { it.toDeletedActor() }
?.toDeletedActor()
}
override suspend fun findByNameAndDomain(name: String, domain: String): DeletedActor? = query {
return@query DeletedActors
.select { DeletedActors.name eq name and (DeletedActors.domain eq domain) }
.singleOrNull()
?.toDeletedActor()
}
override val logger: Logger

View File

@ -54,6 +54,10 @@ class InstanceRepositoryImpl(private val idGenerateService: IdGenerateService) :
override suspend fun delete(instance: InstanceEntity) {
Instance.deleteWhere { id eq instance.id }
}
override suspend fun findByUrl(url: String): dev.usbharu.hideout.core.domain.model.instance.Instance? {
return Instance.select { Instance.url eq url }.singleOrNull()?.toInstance()
}
}
fun ResultRow.toInstance(): InstanceEntity {

View File

@ -59,6 +59,10 @@ class MediaRepositoryImpl(private val idGenerateService: IdGenerateService) : Me
Media.id eq id
}
}
override suspend fun findByRemoteUrl(remoteUrl: String): dev.usbharu.hideout.core.domain.model.media.Media? {
return Media.select { Media.remoteUrl eq remoteUrl }.singleOrNull()?.toMedia()
}
}
fun ResultRow.toMedia(): EntityMedia {

View File

@ -70,8 +70,7 @@ class AccountApiServiceImpl(
private val statusQueryService: StatusQueryService,
private val relationshipService: RelationshipService,
private val relationshipRepository: RelationshipRepository,
private val mediaService: MediaService,
private val relationshipQueryService: RelationshipQueryService
private val mediaService: MediaService
) :
AccountApiService {
override suspend fun accountsStatuses(