From e5b744eef00548a9286536530abea1d737bd1a19 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Fri, 18 Aug 2023 12:24:26 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20service=E3=81=A8repository=E3=81=AB?= =?UTF-8?q?=E3=82=A2=E3=83=8E=E3=83=86=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/dev/usbharu/hideout/query/FollowerQueryService.kt | 2 ++ .../dev/usbharu/hideout/query/FollowerQueryServiceImpl.kt | 2 ++ .../dev/usbharu/hideout/query/JwtRefreshTokenQueryService.kt | 2 ++ .../usbharu/hideout/query/JwtRefreshTokenQueryServiceImpl.kt | 2 ++ src/main/kotlin/dev/usbharu/hideout/query/PostQueryService.kt | 2 ++ .../kotlin/dev/usbharu/hideout/query/PostQueryServiceImpl.kt | 2 ++ .../dev/usbharu/hideout/query/PostResponseQueryService.kt | 2 ++ .../dev/usbharu/hideout/query/PostResponseQueryServiceImpl.kt | 2 ++ .../kotlin/dev/usbharu/hideout/query/ReactionQueryService.kt | 2 ++ .../dev/usbharu/hideout/query/ReactionQueryServiceImpl.kt | 2 ++ src/main/kotlin/dev/usbharu/hideout/query/UserQueryService.kt | 2 ++ .../kotlin/dev/usbharu/hideout/query/UserQueryServiceImpl.kt | 2 ++ .../usbharu/hideout/repository/JwtRefreshTokenRepository.kt | 2 ++ .../hideout/repository/JwtRefreshTokenRepositoryImpl.kt | 2 ++ .../kotlin/dev/usbharu/hideout/repository/MetaRepository.kt | 2 ++ .../dev/usbharu/hideout/repository/MetaRepositoryImpl.kt | 2 ++ .../kotlin/dev/usbharu/hideout/repository/PostRepository.kt | 2 ++ .../dev/usbharu/hideout/repository/PostRepositoryImpl.kt | 2 ++ .../dev/usbharu/hideout/repository/ReactionRepository.kt | 2 ++ .../dev/usbharu/hideout/repository/ReactionRepositoryImpl.kt | 2 ++ .../kotlin/dev/usbharu/hideout/repository/UserRepository.kt | 2 ++ .../dev/usbharu/hideout/repository/UserRepositoryImpl.kt | 2 ++ .../kotlin/dev/usbharu/hideout/service/ap/APAcceptService.kt | 3 +++ .../kotlin/dev/usbharu/hideout/service/ap/APCreateService.kt | 4 ++++ .../kotlin/dev/usbharu/hideout/service/ap/APLikeService.kt | 3 +++ .../kotlin/dev/usbharu/hideout/service/ap/APNoteService.kt | 3 +++ .../dev/usbharu/hideout/service/ap/APReactionService.kt | 3 +++ .../dev/usbharu/hideout/service/ap/APReceiveFollowService.kt | 3 +++ .../dev/usbharu/hideout/service/ap/APSendFollowService.kt | 3 +++ src/main/kotlin/dev/usbharu/hideout/service/ap/APService.kt | 3 +++ .../kotlin/dev/usbharu/hideout/service/ap/APUndoService.kt | 4 ++++ .../kotlin/dev/usbharu/hideout/service/ap/APUserService.kt | 3 +++ .../kotlin/dev/usbharu/hideout/service/api/PostApiService.kt | 3 +++ .../kotlin/dev/usbharu/hideout/service/api/UserApiService.kt | 3 +++ .../dev/usbharu/hideout/service/api/UserAuthApiService.kt | 3 +++ .../dev/usbharu/hideout/service/api/WebFingerApiService.kt | 3 +++ .../hideout/service/auth/HttpSignatureVerifyService.kt | 3 +++ .../kotlin/dev/usbharu/hideout/service/auth/JwtService.kt | 3 +++ .../dev/usbharu/hideout/service/core/ExposedTransaction.kt | 2 ++ .../dev/usbharu/hideout/service/core/IdGenerateService.kt | 3 +++ .../kotlin/dev/usbharu/hideout/service/core/MetaService.kt | 2 ++ .../dev/usbharu/hideout/service/core/MetaServiceImpl.kt | 2 ++ .../usbharu/hideout/service/core/ServerInitialiseService.kt | 3 +++ .../hideout/service/core/ServerInitialiseServiceImpl.kt | 2 ++ .../hideout/service/core/SnowflakeIdGenerateService.kt | 2 ++ .../kotlin/dev/usbharu/hideout/service/core/Transaction.kt | 3 +++ .../hideout/service/core/TwitterSnowflakeIdGenerateService.kt | 3 +++ .../dev/usbharu/hideout/service/job/JobQueueParentService.kt | 2 ++ .../dev/usbharu/hideout/service/job/JobQueueWorkerService.kt | 2 ++ .../usbharu/hideout/service/job/KJobJobQueueParentService.kt | 2 ++ .../usbharu/hideout/service/job/KJobJobQueueWorkerService.kt | 2 ++ .../kotlin/dev/usbharu/hideout/service/post/PostService.kt | 2 ++ .../dev/usbharu/hideout/service/post/PostServiceImpl.kt | 2 ++ .../dev/usbharu/hideout/service/reaction/ReactionService.kt | 3 +++ .../usbharu/hideout/service/reaction/ReactionServiceImpl.kt | 2 ++ .../dev/usbharu/hideout/service/user/UserAuthService.kt | 2 ++ .../dev/usbharu/hideout/service/user/UserAuthServiceImpl.kt | 2 ++ .../kotlin/dev/usbharu/hideout/service/user/UserService.kt | 2 ++ .../dev/usbharu/hideout/service/user/UserServiceImpl.kt | 2 ++ 59 files changed, 141 insertions(+) diff --git a/src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryService.kt index 4922b268..4cc73ef1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryService.kt @@ -1,7 +1,9 @@ package dev.usbharu.hideout.query import dev.usbharu.hideout.domain.model.hideout.entity.User +import org.springframework.stereotype.Repository +@Repository interface FollowerQueryService { suspend fun findFollowersById(id: Long): List suspend fun findFollowersByNameAndDomain(name: String, domain: String): List diff --git a/src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryServiceImpl.kt index 3a938620..831c715c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/FollowerQueryServiceImpl.kt @@ -6,9 +6,11 @@ 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 { val followers = Users.alias("FOLLOWERS") diff --git a/src/main/kotlin/dev/usbharu/hideout/query/JwtRefreshTokenQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/query/JwtRefreshTokenQueryService.kt index 9ce1ad57..44c5675c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/JwtRefreshTokenQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/JwtRefreshTokenQueryService.kt @@ -1,7 +1,9 @@ package dev.usbharu.hideout.query import dev.usbharu.hideout.domain.model.hideout.entity.JwtRefreshToken +import org.springframework.stereotype.Repository +@Repository interface JwtRefreshTokenQueryService { suspend fun findById(id: Long): JwtRefreshToken suspend fun findByToken(token: String): JwtRefreshToken diff --git a/src/main/kotlin/dev/usbharu/hideout/query/JwtRefreshTokenQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/query/JwtRefreshTokenQueryServiceImpl.kt index 7b6affff..ce217c42 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/JwtRefreshTokenQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/JwtRefreshTokenQueryServiceImpl.kt @@ -10,8 +10,10 @@ 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 = JwtRefreshTokens.select { JwtRefreshTokens.id.eq(id) } diff --git a/src/main/kotlin/dev/usbharu/hideout/query/PostQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/query/PostQueryService.kt index 8ad102ab..2a67b1fe 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/PostQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/PostQueryService.kt @@ -1,7 +1,9 @@ package dev.usbharu.hideout.query import dev.usbharu.hideout.domain.model.hideout.entity.Post +import org.springframework.stereotype.Repository +@Repository interface PostQueryService { suspend fun findById(id: Long): Post suspend fun findByUrl(url: String): Post diff --git a/src/main/kotlin/dev/usbharu/hideout/query/PostQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/query/PostQueryServiceImpl.kt index 4f98710b..a3293b06 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/PostQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/PostQueryServiceImpl.kt @@ -7,8 +7,10 @@ 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 = Posts.select { Posts.id eq id } diff --git a/src/main/kotlin/dev/usbharu/hideout/query/PostResponseQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/query/PostResponseQueryService.kt index 65441189..9c5263b8 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/PostResponseQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/PostResponseQueryService.kt @@ -1,8 +1,10 @@ package dev.usbharu.hideout.query import dev.usbharu.hideout.domain.model.hideout.dto.PostResponse +import org.springframework.stereotype.Repository @Suppress("LongParameterList") +@Repository interface PostResponseQueryService { suspend fun findById(id: Long, userId: Long?): PostResponse suspend fun findAll( diff --git a/src/main/kotlin/dev/usbharu/hideout/query/PostResponseQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/query/PostResponseQueryServiceImpl.kt index a8ef3930..ce350fc1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/PostResponseQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/PostResponseQueryServiceImpl.kt @@ -12,8 +12,10 @@ 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 { return Posts diff --git a/src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryService.kt index 72e0c316..fa81a62c 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryService.kt @@ -2,7 +2,9 @@ package dev.usbharu.hideout.query import dev.usbharu.hideout.domain.model.hideout.dto.ReactionResponse import dev.usbharu.hideout.domain.model.hideout.entity.Reaction +import org.springframework.stereotype.Repository +@Repository interface ReactionQueryService { suspend fun findByPostId(postId: Long, userId: Long? = null): List diff --git a/src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryServiceImpl.kt index de41d1cb..9536ca61 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/ReactionQueryServiceImpl.kt @@ -11,8 +11,10 @@ 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 { return Reactions.select { diff --git a/src/main/kotlin/dev/usbharu/hideout/query/UserQueryService.kt b/src/main/kotlin/dev/usbharu/hideout/query/UserQueryService.kt index 6b7f7db6..09e5972a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/UserQueryService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/UserQueryService.kt @@ -1,7 +1,9 @@ package dev.usbharu.hideout.query import dev.usbharu.hideout.domain.model.hideout.entity.User +import org.springframework.stereotype.Repository +@Repository interface UserQueryService { suspend fun findAll(limit: Int, offset: Long): List suspend fun findById(id: Long): User diff --git a/src/main/kotlin/dev/usbharu/hideout/query/UserQueryServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/query/UserQueryServiceImpl.kt index 647b8d5f..fc2bc9b3 100644 --- a/src/main/kotlin/dev/usbharu/hideout/query/UserQueryServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/query/UserQueryServiceImpl.kt @@ -10,8 +10,10 @@ 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 { private val logger = LoggerFactory.getLogger(UserQueryServiceImpl::class.java) diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/JwtRefreshTokenRepository.kt b/src/main/kotlin/dev/usbharu/hideout/repository/JwtRefreshTokenRepository.kt index d6bc5638..81c6aa35 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/JwtRefreshTokenRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/repository/JwtRefreshTokenRepository.kt @@ -1,7 +1,9 @@ package dev.usbharu.hideout.repository import dev.usbharu.hideout.domain.model.hideout.entity.JwtRefreshToken +import org.springframework.stereotype.Repository +@Repository interface JwtRefreshTokenRepository { suspend fun generateId(): Long diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/JwtRefreshTokenRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/repository/JwtRefreshTokenRepositoryImpl.kt index 0fdc79dd..c1bf8ad3 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/JwtRefreshTokenRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/repository/JwtRefreshTokenRepositoryImpl.kt @@ -6,9 +6,11 @@ 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, private val idGenerateService: IdGenerateService diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/MetaRepository.kt b/src/main/kotlin/dev/usbharu/hideout/repository/MetaRepository.kt index 5fda5200..af4eb65f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/MetaRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/repository/MetaRepository.kt @@ -1,7 +1,9 @@ package dev.usbharu.hideout.repository import dev.usbharu.hideout.domain.model.hideout.entity.Meta +import org.springframework.stereotype.Repository +@Repository interface MetaRepository { suspend fun save(meta: Meta) diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/MetaRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/repository/MetaRepositoryImpl.kt index d0de63a1..543bb1fb 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/MetaRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/repository/MetaRepositoryImpl.kt @@ -4,9 +4,11 @@ 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 { init { diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/PostRepository.kt b/src/main/kotlin/dev/usbharu/hideout/repository/PostRepository.kt index 21a9bec8..8011f282 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/PostRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/repository/PostRepository.kt @@ -1,8 +1,10 @@ package dev.usbharu.hideout.repository import dev.usbharu.hideout.domain.model.hideout.entity.Post +import org.springframework.stereotype.Repository @Suppress("LongParameterList") +@Repository interface PostRepository { suspend fun generateId(): Long suspend fun save(post: Post): Post diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/PostRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/repository/PostRepositoryImpl.kt index 79698826..08998c15 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/PostRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/repository/PostRepositoryImpl.kt @@ -8,8 +8,10 @@ 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 { init { diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepository.kt b/src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepository.kt index f2aad560..d98a0c84 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepository.kt @@ -1,7 +1,9 @@ package dev.usbharu.hideout.repository import dev.usbharu.hideout.domain.model.hideout.entity.Reaction +import org.springframework.stereotype.Repository +@Repository interface ReactionRepository { suspend fun generateId(): Long suspend fun save(reaction: Reaction): Reaction diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepositoryImpl.kt index 628a995e..00f74d01 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/repository/ReactionRepositoryImpl.kt @@ -7,8 +7,10 @@ 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, private val idGenerateService: IdGenerateService diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/UserRepository.kt b/src/main/kotlin/dev/usbharu/hideout/repository/UserRepository.kt index 17344d24..b00d66c4 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/UserRepository.kt +++ b/src/main/kotlin/dev/usbharu/hideout/repository/UserRepository.kt @@ -1,8 +1,10 @@ package dev.usbharu.hideout.repository import dev.usbharu.hideout.domain.model.hideout.entity.User +import org.springframework.stereotype.Repository @Suppress("TooManyFunctions") +@Repository interface UserRepository { suspend fun save(user: User): User diff --git a/src/main/kotlin/dev/usbharu/hideout/repository/UserRepositoryImpl.kt b/src/main/kotlin/dev/usbharu/hideout/repository/UserRepositoryImpl.kt index 961a089c..c57a7ab7 100644 --- a/src/main/kotlin/dev/usbharu/hideout/repository/UserRepositoryImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/repository/UserRepositoryImpl.kt @@ -8,9 +8,11 @@ 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 { init { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APAcceptService.kt b/src/main/kotlin/dev/usbharu/hideout/service/ap/APAcceptService.kt index 3af3fbcb..9c3f10ed 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APAcceptService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/ap/APAcceptService.kt @@ -11,12 +11,15 @@ 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 interface APAcceptService { suspend fun receiveAccept(accept: Accept): ActivityPubResponse } @Single +@Service class APAcceptServiceImpl( private val userService: UserService, private val userQueryService: UserQueryService, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APCreateService.kt b/src/main/kotlin/dev/usbharu/hideout/service/ap/APCreateService.kt index b3e84557..bc684bb4 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APCreateService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/ap/APCreateService.kt @@ -8,12 +8,16 @@ 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 interface APCreateService { suspend fun receiveCreate(create: Create): ActivityPubResponse } @Single +@Service class APCreateServiceImpl( private val apNoteService: APNoteService, private val transaction: Transaction diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APLikeService.kt b/src/main/kotlin/dev/usbharu/hideout/service/ap/APLikeService.kt index 6bf2132e..c98b8cfc 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APLikeService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/ap/APLikeService.kt @@ -9,12 +9,15 @@ 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 interface APLikeService { suspend fun receiveLike(like: Like): ActivityPubResponse } @Single +@Service class APLikeServiceImpl( private val reactionService: ReactionService, private val apUserService: APUserService, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APNoteService.kt b/src/main/kotlin/dev/usbharu/hideout/service/ap/APNoteService.kt index 9e1875b6..b706c4fa 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APNoteService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/ap/APNoteService.kt @@ -21,8 +21,10 @@ 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 +@Service interface APNoteService { suspend fun createNote(post: Post) @@ -33,6 +35,7 @@ interface APNoteService { } @Single +@Service class APNoteServiceImpl( private val httpClient: HttpClient, private val jobQueueParentService: JobQueueParentService, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APReactionService.kt b/src/main/kotlin/dev/usbharu/hideout/service/ap/APReactionService.kt index ba7ff79c..78698512 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APReactionService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/ap/APReactionService.kt @@ -15,8 +15,10 @@ 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 +@Service interface APReactionService { suspend fun reaction(like: Reaction) suspend fun removeReaction(like: Reaction) @@ -25,6 +27,7 @@ interface APReactionService { } @Single +@Service class APReactionServiceImpl( private val jobQueueParentService: JobQueueParentService, private val httpClient: HttpClient, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APReceiveFollowService.kt b/src/main/kotlin/dev/usbharu/hideout/service/ap/APReceiveFollowService.kt index 9156abfd..602a8740 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APReceiveFollowService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/ap/APReceiveFollowService.kt @@ -16,13 +16,16 @@ 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 interface APReceiveFollowService { suspend fun receiveFollow(follow: Follow): ActivityPubResponse suspend fun receiveFollowJob(props: JobProps) } @Single +@Service class APReceiveFollowServiceImpl( private val jobQueueParentService: JobQueueParentService, private val apUserService: APUserService, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APSendFollowService.kt b/src/main/kotlin/dev/usbharu/hideout/service/ap/APSendFollowService.kt index 58ae74f5..ad67b955 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APSendFollowService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/ap/APSendFollowService.kt @@ -5,12 +5,15 @@ 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 interface APSendFollowService { suspend fun sendFollow(sendFollowDto: SendFollowDto) } @Single +@Service class APSendFollowServiceImpl(private val httpClient: HttpClient) : APSendFollowService { override suspend fun sendFollow(sendFollowDto: SendFollowDto) { val follow = Follow( diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APService.kt b/src/main/kotlin/dev/usbharu/hideout/service/ap/APService.kt index baf1b023..4c93439d 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/ap/APService.kt @@ -12,7 +12,9 @@ import kjob.core.job.JobProps import org.koin.core.annotation.Single import org.slf4j.Logger import org.slf4j.LoggerFactory +import org.springframework.stereotype.Service +@Service interface APService { fun parseActivity(json: String): ActivityType @@ -173,6 +175,7 @@ enum class ExtendedVocabulary { } @Single +@Service class APServiceImpl( private val apReceiveFollowService: APReceiveFollowService, private val apNoteService: APNoteService, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APUndoService.kt b/src/main/kotlin/dev/usbharu/hideout/service/ap/APUndoService.kt index 8ae5ab13..6ad4f67e 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APUndoService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/ap/APUndoService.kt @@ -9,12 +9,16 @@ 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 interface APUndoService { suspend fun receiveUndo(undo: Undo): ActivityPubResponse } @Single +@Service @Suppress("UnsafeCallOnNullableType") class APUndoServiceImpl( private val userService: UserService, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/ap/APUserService.kt b/src/main/kotlin/dev/usbharu/hideout/service/ap/APUserService.kt index 2f095a6a..6e6e11bc 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/ap/APUserService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/ap/APUserService.kt @@ -19,7 +19,9 @@ 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 interface APUserService { suspend fun getPersonByName(name: String): Person @@ -36,6 +38,7 @@ interface APUserService { } @Single +@Service class APUserServiceImpl( private val userService: UserService, private val httpClient: HttpClient, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/PostApiService.kt b/src/main/kotlin/dev/usbharu/hideout/service/api/PostApiService.kt index 8edee9a7..71a904f0 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/PostApiService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/api/PostApiService.kt @@ -13,9 +13,11 @@ 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 @Suppress("LongParameterList") +@Service interface PostApiService { suspend fun createPost(postForm: dev.usbharu.hideout.domain.model.hideout.form.Post, userId: Long): PostResponse suspend fun getById(id: Long, userId: Long?): PostResponse @@ -44,6 +46,7 @@ interface PostApiService { } @Single +@Service class PostApiServiceImpl( private val postService: PostService, private val userRepository: UserRepository, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/UserApiService.kt b/src/main/kotlin/dev/usbharu/hideout/service/api/UserApiService.kt index 8fed3222..935cad11 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/UserApiService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/api/UserApiService.kt @@ -10,9 +10,11 @@ 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 @Suppress("TooManyFunctions") +@Service interface UserApiService { suspend fun findAll(limit: Int? = 100, offset: Long = 0): List @@ -37,6 +39,7 @@ interface UserApiService { } @Single +@Service class UserApiServiceImpl( private val userQueryService: UserQueryService, private val followerQueryService: FollowerQueryService, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/UserAuthApiService.kt b/src/main/kotlin/dev/usbharu/hideout/service/api/UserAuthApiService.kt index e576f8ef..fd8e64b3 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/UserAuthApiService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/api/UserAuthApiService.kt @@ -9,13 +9,16 @@ 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 interface UserAuthApiService { suspend fun login(username: String, password: String): JwtToken suspend fun refreshToken(refreshToken: RefreshToken): JwtToken } @Single +@Service class UserAuthApiServiceImpl( private val userAuthService: UserAuthServiceImpl, private val userQueryService: UserQueryService, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/api/WebFingerApiService.kt b/src/main/kotlin/dev/usbharu/hideout/service/api/WebFingerApiService.kt index 5311723c..f2ff9f81 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/api/WebFingerApiService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/api/WebFingerApiService.kt @@ -4,12 +4,15 @@ 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 interface WebFingerApiService { suspend fun findByNameAndDomain(name: String, domain: String): User } @Single +@Service class WebFingerApiServiceImpl(private val transaction: Transaction, private val userQueryService: UserQueryService) : WebFingerApiService { override suspend fun findByNameAndDomain(name: String, domain: String): User { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/auth/HttpSignatureVerifyService.kt b/src/main/kotlin/dev/usbharu/hideout/service/auth/HttpSignatureVerifyService.kt index eb30c903..e7697992 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/auth/HttpSignatureVerifyService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/auth/HttpSignatureVerifyService.kt @@ -5,13 +5,16 @@ 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 +@Service interface HttpSignatureVerifyService { fun verify(headers: Headers): Boolean } @Single +@Service class HttpSignatureVerifyServiceImpl( private val userQueryService: UserQueryService, private val transaction: Transaction diff --git a/src/main/kotlin/dev/usbharu/hideout/service/auth/JwtService.kt b/src/main/kotlin/dev/usbharu/hideout/service/auth/JwtService.kt index 462430ac..53dc2ae4 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/auth/JwtService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/auth/JwtService.kt @@ -15,10 +15,12 @@ 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 import java.util.* +@Service interface JwtService { suspend fun createToken(user: User): JwtToken suspend fun refreshToken(refreshToken: RefreshToken): JwtToken @@ -30,6 +32,7 @@ interface JwtService { @Suppress("InjectDispatcher") @Single +@Service class JwtServiceImpl( private val metaService: MetaService, private val refreshTokenRepository: JwtRefreshTokenRepository, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/ExposedTransaction.kt b/src/main/kotlin/dev/usbharu/hideout/service/core/ExposedTransaction.kt index c15327a4..283fa7c8 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/ExposedTransaction.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/core/ExposedTransaction.kt @@ -2,8 +2,10 @@ 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 transaction(block: suspend () -> T): T { return newSuspendedTransaction(transactionIsolation = java.sql.Connection.TRANSACTION_SERIALIZABLE) { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/IdGenerateService.kt b/src/main/kotlin/dev/usbharu/hideout/service/core/IdGenerateService.kt index 2962f4e3..fae8a683 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/IdGenerateService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/core/IdGenerateService.kt @@ -1,5 +1,8 @@ package dev.usbharu.hideout.service.core +import org.springframework.stereotype.Service + +@Service interface IdGenerateService { suspend fun generateId(): Long } diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/MetaService.kt b/src/main/kotlin/dev/usbharu/hideout/service/core/MetaService.kt index 91da1a90..a455d1b1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/MetaService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/core/MetaService.kt @@ -2,7 +2,9 @@ package dev.usbharu.hideout.service.core import dev.usbharu.hideout.domain.model.hideout.entity.Jwt import dev.usbharu.hideout.domain.model.hideout.entity.Meta +import org.springframework.stereotype.Service +@Service interface MetaService { suspend fun getMeta(): Meta suspend fun updateMeta(meta: Meta) diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/MetaServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/core/MetaServiceImpl.kt index e35ff3f7..1492c7a8 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/MetaServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/core/MetaServiceImpl.kt @@ -5,8 +5,10 @@ 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 { override suspend fun getMeta(): Meta = diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseService.kt b/src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseService.kt index d65f8fa6..edd234cd 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseService.kt @@ -1,5 +1,8 @@ package dev.usbharu.hideout.service.core +import org.springframework.stereotype.Service + +@Service interface ServerInitialiseService { suspend fun init() } diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseServiceImpl.kt index 4fc950c1..2917b15b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/core/ServerInitialiseServiceImpl.kt @@ -7,10 +7,12 @@ 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, private val transaction: Transaction diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/SnowflakeIdGenerateService.kt b/src/main/kotlin/dev/usbharu/hideout/service/core/SnowflakeIdGenerateService.kt index e90ea2d6..a4fbbf15 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/SnowflakeIdGenerateService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/core/SnowflakeIdGenerateService.kt @@ -3,9 +3,11 @@ package dev.usbharu.hideout.service.core import kotlinx.coroutines.delay import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock +import org.springframework.stereotype.Service import java.time.Instant @Suppress("MagicNumber") +@Service open class SnowflakeIdGenerateService(private val baseTime: Long) : IdGenerateService { var lastTimeStamp: Long = -1 var sequenceId: Int = 0 diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/Transaction.kt b/src/main/kotlin/dev/usbharu/hideout/service/core/Transaction.kt index 105420ed..a5c787a2 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/Transaction.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/core/Transaction.kt @@ -1,5 +1,8 @@ package dev.usbharu.hideout.service.core +import org.springframework.stereotype.Service + +@Service interface Transaction { suspend fun transaction(block: suspend () -> T): T suspend fun transaction(transactionLevel: Int, block: suspend () -> T): T diff --git a/src/main/kotlin/dev/usbharu/hideout/service/core/TwitterSnowflakeIdGenerateService.kt b/src/main/kotlin/dev/usbharu/hideout/service/core/TwitterSnowflakeIdGenerateService.kt index 35a9cd14..17459f2b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/core/TwitterSnowflakeIdGenerateService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/core/TwitterSnowflakeIdGenerateService.kt @@ -1,5 +1,8 @@ package dev.usbharu.hideout.service.core +import org.springframework.stereotype.Service + // 2010-11-04T01:42:54.657 @Suppress("MagicNumber") +@Service object TwitterSnowflakeIdGenerateService : SnowflakeIdGenerateService(1288834974657L) diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueParentService.kt b/src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueParentService.kt index f553c227..dfecf8a4 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueParentService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueParentService.kt @@ -2,7 +2,9 @@ package dev.usbharu.hideout.service.job import kjob.core.Job import kjob.core.dsl.ScheduleContext +import org.springframework.stereotype.Service +@Service interface JobQueueParentService { fun init(jobDefines: List) diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueWorkerService.kt b/src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueWorkerService.kt index 567f9e21..80413c79 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueWorkerService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/job/JobQueueWorkerService.kt @@ -2,9 +2,11 @@ package dev.usbharu.hideout.service.job import kjob.core.Job import kjob.core.dsl.KJobFunctions +import org.springframework.stereotype.Service import kjob.core.dsl.JobContextWithProps as JCWP import kjob.core.dsl.JobRegisterContext as JRC +@Service interface JobQueueWorkerService { fun init(defines: List>.(Job) -> KJobFunctions>>>) } diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueParentService.kt b/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueParentService.kt index d5367d80..e7d9fc30 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueParentService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueParentService.kt @@ -7,7 +7,9 @@ import kjob.core.dsl.ScheduleContext import kjob.core.kjob import org.jetbrains.exposed.sql.Database import org.slf4j.LoggerFactory +import org.springframework.stereotype.Service +@Service class KJobJobQueueParentService(private val database: Database) : JobQueueParentService { private val logger = LoggerFactory.getLogger(this::class.java) diff --git a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueWorkerService.kt b/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueWorkerService.kt index 67d84821..368aae99 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueWorkerService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/job/KJobJobQueueWorkerService.kt @@ -5,9 +5,11 @@ import kjob.core.Job import kjob.core.dsl.KJobFunctions import kjob.core.kjob import org.jetbrains.exposed.sql.Database +import org.springframework.stereotype.Service import kjob.core.dsl.JobContextWithProps as JCWP import kjob.core.dsl.JobRegisterContext as JRC +@Service class KJobJobQueueWorkerService(private val database: Database) : JobQueueWorkerService { val kjob by lazy { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/post/PostService.kt b/src/main/kotlin/dev/usbharu/hideout/service/post/PostService.kt index 28c90710..0eed9d72 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/post/PostService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/post/PostService.kt @@ -2,7 +2,9 @@ package dev.usbharu.hideout.service.post import dev.usbharu.hideout.domain.model.hideout.dto.PostCreateDto import dev.usbharu.hideout.domain.model.hideout.entity.Post +import org.springframework.stereotype.Service +@Service interface PostService { suspend fun createLocal(post: PostCreateDto): Post } diff --git a/src/main/kotlin/dev/usbharu/hideout/service/post/PostServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/post/PostServiceImpl.kt index c1b58d1b..2e81aeef 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/post/PostServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/post/PostServiceImpl.kt @@ -7,8 +7,10 @@ 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, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionService.kt b/src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionService.kt index a7b9ed0d..d39dc483 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionService.kt @@ -1,5 +1,8 @@ package dev.usbharu.hideout.service.reaction +import org.springframework.stereotype.Service + +@Service interface ReactionService { suspend fun receiveReaction(name: String, domain: String, userId: Long, postId: Long) suspend fun sendReaction(name: String, userId: Long, postId: Long) diff --git a/src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionServiceImpl.kt index f8c24df9..cc822a18 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/reaction/ReactionServiceImpl.kt @@ -5,8 +5,10 @@ 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, private val apReactionService: APReactionService, diff --git a/src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthService.kt b/src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthService.kt index 61853b73..9630f8fa 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthService.kt @@ -1,7 +1,9 @@ package dev.usbharu.hideout.service.user +import org.springframework.stereotype.Service import java.security.KeyPair +@Service interface UserAuthService { fun hash(password: String): String diff --git a/src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthServiceImpl.kt index 0c234430..a4e0bba6 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/user/UserAuthServiceImpl.kt @@ -4,10 +4,12 @@ import dev.usbharu.hideout.config.Config import dev.usbharu.hideout.query.UserQueryService import io.ktor.util.* import org.koin.core.annotation.Single +import org.springframework.stereotype.Service import java.security.* import java.util.* @Single +@Service class UserAuthServiceImpl( val userQueryService: UserQueryService ) : UserAuthService { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/user/UserService.kt b/src/main/kotlin/dev/usbharu/hideout/service/user/UserService.kt index a141fa24..665d14f5 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/user/UserService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/user/UserService.kt @@ -3,8 +3,10 @@ package dev.usbharu.hideout.service.user import dev.usbharu.hideout.domain.model.hideout.dto.RemoteUserCreateDto import dev.usbharu.hideout.domain.model.hideout.dto.UserCreateDto import dev.usbharu.hideout.domain.model.hideout.entity.User +import org.springframework.stereotype.Service @Suppress("TooManyFunctions") +@Service interface UserService { suspend fun usernameAlreadyUse(username: String): Boolean diff --git a/src/main/kotlin/dev/usbharu/hideout/service/user/UserServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/user/UserServiceImpl.kt index 3d2a93dd..22cc6001 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/user/UserServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/user/UserServiceImpl.kt @@ -11,9 +11,11 @@ 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, private val userAuthService: UserAuthService,