refactor: Koinのコードを削除

This commit is contained in:
usbharu 2023-09-23 00:14:40 +09:00
parent 332ad1bb41
commit ad11b072a8
36 changed files with 0 additions and 82 deletions

View File

@ -1,8 +0,0 @@
package dev.usbharu.hideout
import org.koin.core.annotation.ComponentScan
import org.koin.core.annotation.Module
@Module
@ComponentScan
class HideoutModule

View File

@ -5,11 +5,9 @@ import dev.usbharu.hideout.repository.Users
import dev.usbharu.hideout.repository.UsersFollowers
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.koin.core.annotation.Single
import org.springframework.stereotype.Repository
import java.time.Instant
@Single
@Repository
class FollowerQueryServiceImpl : FollowerQueryService {
override suspend fun findFollowersById(id: Long): List<User> {

View File

@ -9,10 +9,8 @@ import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.sql.deleteAll
import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.sql.select
import org.koin.core.annotation.Single
import org.springframework.stereotype.Repository
@Single
@Repository
class JwtRefreshTokenQueryServiceImpl : JwtRefreshTokenQueryService {
override suspend fun findById(id: Long): JwtRefreshToken =

View File

@ -6,10 +6,8 @@ import dev.usbharu.hideout.repository.Posts
import dev.usbharu.hideout.repository.toPost
import dev.usbharu.hideout.util.singleOr
import org.jetbrains.exposed.sql.select
import org.koin.core.annotation.Single
import org.springframework.stereotype.Repository
@Single
@Repository
class PostQueryServiceImpl : PostQueryService {
override suspend fun findById(id: Long): Post =

View File

@ -11,10 +11,8 @@ import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.innerJoin
import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.selectAll
import org.koin.core.annotation.Single
import org.springframework.stereotype.Repository
@Single
@Repository
class PostResponseQueryServiceImpl : PostResponseQueryService {
override suspend fun findById(id: Long, userId: Long?): PostResponse {

View File

@ -10,10 +10,8 @@ import dev.usbharu.hideout.repository.toReaction
import dev.usbharu.hideout.util.singleOr
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.koin.core.annotation.Single
import org.springframework.stereotype.Repository
@Single
@Repository
class ReactionQueryServiceImpl : ReactionQueryService {
override suspend fun findByPostId(postId: Long, userId: Long?): List<Reaction> {

View File

@ -8,11 +8,9 @@ import dev.usbharu.hideout.util.singleOr
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.selectAll
import org.koin.core.annotation.Single
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Repository
@Single
@Repository
class UserQueryServiceImpl : UserQueryService {

View File

@ -5,11 +5,9 @@ import dev.usbharu.hideout.service.core.IdGenerateService
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.sql.transactions.transaction
import org.koin.core.annotation.Single
import org.springframework.stereotype.Repository
import java.time.Instant
@Single
@Repository
class JwtRefreshTokenRepositoryImpl(
private val database: Database,

View File

@ -3,11 +3,9 @@ package dev.usbharu.hideout.repository
import dev.usbharu.hideout.domain.model.hideout.entity.Jwt
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.transactions.transaction
import org.koin.core.annotation.Single
import org.springframework.stereotype.Repository
import java.util.*
@Single
@Repository
class MetaRepositoryImpl(private val database: Database) : MetaRepository {

View File

@ -7,10 +7,8 @@ import dev.usbharu.hideout.service.core.IdGenerateService
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.sql.transactions.transaction
import org.koin.core.annotation.Single
import org.springframework.stereotype.Repository
@Single
@Repository
class PostRepositoryImpl(database: Database, private val idGenerateService: IdGenerateService) : PostRepository {

View File

@ -6,10 +6,8 @@ import org.jetbrains.exposed.dao.id.LongIdTable
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.sql.transactions.transaction
import org.koin.core.annotation.Single
import org.springframework.stereotype.Repository
@Single
@Repository
class ReactionRepositoryImpl(
private val database: Database,

View File

@ -7,11 +7,9 @@ import org.jetbrains.exposed.dao.id.LongIdTable
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.sql.transactions.transaction
import org.koin.core.annotation.Single
import org.springframework.stereotype.Repository
import java.time.Instant
@Single
@Repository
class UserRepositoryImpl(private val database: Database, private val idGenerateService: IdGenerateService) :
UserRepository {

View File

@ -10,7 +10,6 @@ import dev.usbharu.hideout.query.UserQueryService
import dev.usbharu.hideout.service.core.Transaction
import dev.usbharu.hideout.service.user.UserService
import io.ktor.http.*
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
@Service
@ -18,7 +17,6 @@ interface APAcceptService {
suspend fun receiveAccept(accept: Accept): ActivityPubResponse
}
@Single
@Service
class APAcceptServiceImpl(
private val userService: UserService,

View File

@ -7,7 +7,6 @@ import dev.usbharu.hideout.domain.model.ap.Note
import dev.usbharu.hideout.exception.ap.IllegalActivityPubObjectException
import dev.usbharu.hideout.service.core.Transaction
import io.ktor.http.*
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
@Service
@ -15,7 +14,6 @@ interface APCreateService {
suspend fun receiveCreate(create: Create): ActivityPubResponse
}
@Single
@Service
class APCreateServiceImpl(
private val apNoteService: APNoteService,

View File

@ -8,7 +8,6 @@ import dev.usbharu.hideout.query.PostQueryService
import dev.usbharu.hideout.service.core.Transaction
import dev.usbharu.hideout.service.reaction.ReactionService
import io.ktor.http.*
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
@Service
@ -16,7 +15,6 @@ interface APLikeService {
suspend fun receiveLike(like: Like): ActivityPubResponse
}
@Single
@Service
class APLikeServiceImpl(
private val reactionService: ReactionService,

View File

@ -19,7 +19,6 @@ import dev.usbharu.hideout.service.job.JobQueueParentService
import io.ktor.client.*
import io.ktor.client.statement.*
import kjob.core.job.JobProps
import org.koin.core.annotation.Single
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.time.Instant
@ -34,7 +33,6 @@ interface APNoteService {
suspend fun fetchNote(note: Note, targetActor: String? = null): Note
}
@Single
@Service
class APNoteServiceImpl(
private val httpClient: HttpClient,

View File

@ -14,7 +14,6 @@ import dev.usbharu.hideout.query.UserQueryService
import dev.usbharu.hideout.service.job.JobQueueParentService
import io.ktor.client.*
import kjob.core.job.JobProps
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
import java.time.Instant
@ -26,7 +25,6 @@ interface APReactionService {
suspend fun removeReactionJob(props: JobProps<DeliverRemoveReactionJob>)
}
@Single
@Service
class APReactionServiceImpl(
private val jobQueueParentService: JobQueueParentService,

View File

@ -15,7 +15,6 @@ import dev.usbharu.hideout.service.user.UserService
import io.ktor.client.*
import io.ktor.http.*
import kjob.core.job.JobProps
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
@Service
@ -24,7 +23,6 @@ interface APReceiveFollowService {
suspend fun receiveFollowJob(props: JobProps<ReceiveFollowJob>)
}
@Single
@Service
class APReceiveFollowServiceImpl(
private val jobQueueParentService: JobQueueParentService,

View File

@ -4,7 +4,6 @@ import dev.usbharu.hideout.domain.model.ap.Follow
import dev.usbharu.hideout.domain.model.hideout.dto.SendFollowDto
import dev.usbharu.hideout.plugins.postAp
import io.ktor.client.*
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
@Service
@ -12,7 +11,6 @@ interface APSendFollowService {
suspend fun sendFollow(sendFollowDto: SendFollowDto)
}
@Single
@Service
class APSendFollowServiceImpl(private val httpClient: HttpClient) : APSendFollowService {
override suspend fun sendFollow(sendFollowDto: SendFollowDto) {

View File

@ -9,7 +9,6 @@ import dev.usbharu.hideout.domain.model.job.*
import dev.usbharu.hideout.exception.JsonParseException
import kjob.core.dsl.JobContextWithProps
import kjob.core.job.JobProps
import org.koin.core.annotation.Single
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
@ -174,7 +173,6 @@ enum class ExtendedVocabulary {
Emoji
}
@Single
@Service
class APServiceImpl(
private val apReceiveFollowService: APReceiveFollowService,

View File

@ -8,7 +8,6 @@ import dev.usbharu.hideout.query.UserQueryService
import dev.usbharu.hideout.service.core.Transaction
import dev.usbharu.hideout.service.user.UserService
import io.ktor.http.*
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
@Service
@ -16,7 +15,6 @@ interface APUndoService {
suspend fun receiveUndo(undo: Undo): ActivityPubResponse
}
@Single
@Service
@Suppress("UnsafeCallOnNullableType")
class APUndoServiceImpl(

View File

@ -18,7 +18,6 @@ import io.ktor.client.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.http.*
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
@Service
@ -37,7 +36,6 @@ interface APUserService {
suspend fun fetchPersonWithEntity(url: String, targetActor: String? = null): Pair<Person, User>
}
@Single
@Service
class APUserServiceImpl(
private val userService: UserService,

View File

@ -12,7 +12,6 @@ import dev.usbharu.hideout.service.core.Transaction
import dev.usbharu.hideout.service.post.PostService
import dev.usbharu.hideout.service.reaction.ReactionService
import dev.usbharu.hideout.util.AcctUtil
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
import java.time.Instant
@ -45,7 +44,6 @@ interface PostApiService {
suspend fun removeReaction(userId: Long, postId: Long)
}
@Single
@Service
class PostApiServiceImpl(
private val postService: PostService,

View File

@ -9,7 +9,6 @@ import dev.usbharu.hideout.query.FollowerQueryService
import dev.usbharu.hideout.query.UserQueryService
import dev.usbharu.hideout.service.core.Transaction
import dev.usbharu.hideout.service.user.UserService
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
import kotlin.math.min
@ -38,7 +37,6 @@ interface UserApiService {
suspend fun follow(targetAcct: Acct, sourceId: Long): Boolean
}
@Single
@Service
class UserApiServiceImpl(
private val userQueryService: UserQueryService,

View File

@ -8,7 +8,6 @@ import dev.usbharu.hideout.query.UserQueryService
import dev.usbharu.hideout.service.auth.JwtService
import dev.usbharu.hideout.service.core.Transaction
import dev.usbharu.hideout.service.user.UserAuthServiceImpl
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
@Service
@ -17,7 +16,6 @@ interface UserAuthApiService {
suspend fun refreshToken(refreshToken: RefreshToken): JwtToken
}
@Single
@Service
class UserAuthApiServiceImpl(
private val userAuthService: UserAuthServiceImpl,

View File

@ -3,7 +3,6 @@ package dev.usbharu.hideout.service.api
import dev.usbharu.hideout.domain.model.hideout.entity.User
import dev.usbharu.hideout.query.UserQueryService
import dev.usbharu.hideout.service.core.Transaction
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
@Service
@ -11,7 +10,6 @@ interface WebFingerApiService {
suspend fun findByNameAndDomain(name: String, domain: String): User
}
@Single
@Service
class WebFingerApiServiceImpl(private val transaction: Transaction, private val userQueryService: UserQueryService) :
WebFingerApiService {

View File

@ -4,7 +4,6 @@ import dev.usbharu.hideout.plugins.KtorKeyMap
import dev.usbharu.hideout.query.UserQueryService
import dev.usbharu.hideout.service.core.Transaction
import io.ktor.http.*
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
import tech.barbero.http.message.signing.SignatureHeaderVerifier
@ -13,7 +12,6 @@ interface HttpSignatureVerifyService {
fun verify(headers: Headers): Boolean
}
@Single
@Service
class HttpSignatureVerifyServiceImpl(
private val userQueryService: UserQueryService,

View File

@ -14,7 +14,6 @@ import dev.usbharu.hideout.repository.JwtRefreshTokenRepository
import dev.usbharu.hideout.service.core.MetaService
import dev.usbharu.hideout.util.RsaUtil
import kotlinx.coroutines.runBlocking
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
import java.time.Instant
import java.time.temporal.ChronoUnit
@ -31,7 +30,6 @@ interface JwtService {
}
@Suppress("InjectDispatcher")
@Single
@Service
class JwtServiceImpl(
private val metaService: MetaService,

View File

@ -1,10 +1,8 @@
package dev.usbharu.hideout.service.core
import org.jetbrains.exposed.sql.transactions.experimental.newSuspendedTransaction
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
@Single
@Service
class ExposedTransaction : Transaction {
override suspend fun <T> transaction(block: suspend () -> T): T {

View File

@ -4,10 +4,8 @@ import dev.usbharu.hideout.domain.model.hideout.entity.Jwt
import dev.usbharu.hideout.domain.model.hideout.entity.Meta
import dev.usbharu.hideout.exception.NotInitException
import dev.usbharu.hideout.repository.MetaRepository
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
@Single
@Service
class MetaServiceImpl(private val metaRepository: MetaRepository, private val transaction: Transaction) :
MetaService {

View File

@ -4,14 +4,12 @@ import dev.usbharu.hideout.domain.model.hideout.entity.Jwt
import dev.usbharu.hideout.domain.model.hideout.entity.Meta
import dev.usbharu.hideout.repository.MetaRepository
import dev.usbharu.hideout.util.ServerUtil
import org.koin.core.annotation.Single
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
import java.security.KeyPairGenerator
import java.util.*
@Single
@Service
class ServerInitialiseServiceImpl(
private val metaRepository: MetaRepository,

View File

@ -6,12 +6,10 @@ import dev.usbharu.hideout.exception.UserNotFoundException
import dev.usbharu.hideout.repository.PostRepository
import dev.usbharu.hideout.repository.UserRepository
import dev.usbharu.hideout.service.ap.APNoteService
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
import java.time.Instant
@Service
@Single
class PostServiceImpl(
private val postRepository: PostRepository,
private val userRepository: UserRepository,

View File

@ -4,10 +4,8 @@ import dev.usbharu.hideout.domain.model.hideout.entity.Reaction
import dev.usbharu.hideout.query.ReactionQueryService
import dev.usbharu.hideout.repository.ReactionRepository
import dev.usbharu.hideout.service.ap.APReactionService
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
@Single
@Service
class ReactionServiceImpl(
private val reactionRepository: ReactionRepository,

View File

@ -2,13 +2,11 @@ package dev.usbharu.hideout.service.user
import dev.usbharu.hideout.config.Config
import dev.usbharu.hideout.query.UserQueryService
import org.koin.core.annotation.Single
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
import org.springframework.stereotype.Service
import java.security.*
import java.util.*
@Single
@Service
class UserAuthServiceImpl(
val userQueryService: UserQueryService

View File

@ -10,11 +10,9 @@ import dev.usbharu.hideout.query.FollowerQueryService
import dev.usbharu.hideout.query.UserQueryService
import dev.usbharu.hideout.repository.UserRepository
import dev.usbharu.hideout.service.ap.APSendFollowService
import org.koin.core.annotation.Single
import org.springframework.stereotype.Service
import java.time.Instant
@Single
@Service
class UserServiceImpl(
private val userRepository: UserRepository,

View File

@ -1,6 +0,0 @@
package dev.usbharu.hideout
import io.ktor.server.application.*
fun Application.empty() {
}