mirror of https://github.com/usbharu/Hideout.git
feat: serviceとrepositoryにアノテーションを追加
This commit is contained in:
parent
60706ee413
commit
e5b744eef0
|
@ -1,7 +1,9 @@
|
||||||
package dev.usbharu.hideout.query
|
package dev.usbharu.hideout.query
|
||||||
|
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.User
|
import dev.usbharu.hideout.domain.model.hideout.entity.User
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
|
@Repository
|
||||||
interface FollowerQueryService {
|
interface FollowerQueryService {
|
||||||
suspend fun findFollowersById(id: Long): List<User>
|
suspend fun findFollowersById(id: Long): List<User>
|
||||||
suspend fun findFollowersByNameAndDomain(name: String, domain: String): List<User>
|
suspend fun findFollowersByNameAndDomain(name: String, domain: String): List<User>
|
||||||
|
|
|
@ -6,9 +6,11 @@ import dev.usbharu.hideout.repository.UsersFollowers
|
||||||
import org.jetbrains.exposed.sql.*
|
import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Repository
|
||||||
class FollowerQueryServiceImpl : FollowerQueryService {
|
class FollowerQueryServiceImpl : FollowerQueryService {
|
||||||
override suspend fun findFollowersById(id: Long): List<User> {
|
override suspend fun findFollowersById(id: Long): List<User> {
|
||||||
val followers = Users.alias("FOLLOWERS")
|
val followers = Users.alias("FOLLOWERS")
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package dev.usbharu.hideout.query
|
package dev.usbharu.hideout.query
|
||||||
|
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.JwtRefreshToken
|
import dev.usbharu.hideout.domain.model.hideout.entity.JwtRefreshToken
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
|
@Repository
|
||||||
interface JwtRefreshTokenQueryService {
|
interface JwtRefreshTokenQueryService {
|
||||||
suspend fun findById(id: Long): JwtRefreshToken
|
suspend fun findById(id: Long): JwtRefreshToken
|
||||||
suspend fun findByToken(token: String): JwtRefreshToken
|
suspend fun findByToken(token: String): JwtRefreshToken
|
||||||
|
|
|
@ -10,8 +10,10 @@ import org.jetbrains.exposed.sql.deleteAll
|
||||||
import org.jetbrains.exposed.sql.deleteWhere
|
import org.jetbrains.exposed.sql.deleteWhere
|
||||||
import org.jetbrains.exposed.sql.select
|
import org.jetbrains.exposed.sql.select
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Repository
|
||||||
class JwtRefreshTokenQueryServiceImpl : JwtRefreshTokenQueryService {
|
class JwtRefreshTokenQueryServiceImpl : JwtRefreshTokenQueryService {
|
||||||
override suspend fun findById(id: Long): JwtRefreshToken =
|
override suspend fun findById(id: Long): JwtRefreshToken =
|
||||||
JwtRefreshTokens.select { JwtRefreshTokens.id.eq(id) }
|
JwtRefreshTokens.select { JwtRefreshTokens.id.eq(id) }
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package dev.usbharu.hideout.query
|
package dev.usbharu.hideout.query
|
||||||
|
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.Post
|
import dev.usbharu.hideout.domain.model.hideout.entity.Post
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
|
@Repository
|
||||||
interface PostQueryService {
|
interface PostQueryService {
|
||||||
suspend fun findById(id: Long): Post
|
suspend fun findById(id: Long): Post
|
||||||
suspend fun findByUrl(url: String): Post
|
suspend fun findByUrl(url: String): Post
|
||||||
|
|
|
@ -7,8 +7,10 @@ import dev.usbharu.hideout.repository.toPost
|
||||||
import dev.usbharu.hideout.util.singleOr
|
import dev.usbharu.hideout.util.singleOr
|
||||||
import org.jetbrains.exposed.sql.select
|
import org.jetbrains.exposed.sql.select
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Repository
|
||||||
class PostQueryServiceImpl : PostQueryService {
|
class PostQueryServiceImpl : PostQueryService {
|
||||||
override suspend fun findById(id: Long): Post =
|
override suspend fun findById(id: Long): Post =
|
||||||
Posts.select { Posts.id eq id }
|
Posts.select { Posts.id eq id }
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package dev.usbharu.hideout.query
|
package dev.usbharu.hideout.query
|
||||||
|
|
||||||
import dev.usbharu.hideout.domain.model.hideout.dto.PostResponse
|
import dev.usbharu.hideout.domain.model.hideout.dto.PostResponse
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
@Suppress("LongParameterList")
|
@Suppress("LongParameterList")
|
||||||
|
@Repository
|
||||||
interface PostResponseQueryService {
|
interface PostResponseQueryService {
|
||||||
suspend fun findById(id: Long, userId: Long?): PostResponse
|
suspend fun findById(id: Long, userId: Long?): PostResponse
|
||||||
suspend fun findAll(
|
suspend fun findAll(
|
||||||
|
|
|
@ -12,8 +12,10 @@ import org.jetbrains.exposed.sql.innerJoin
|
||||||
import org.jetbrains.exposed.sql.select
|
import org.jetbrains.exposed.sql.select
|
||||||
import org.jetbrains.exposed.sql.selectAll
|
import org.jetbrains.exposed.sql.selectAll
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Repository
|
||||||
class PostResponseQueryServiceImpl : PostResponseQueryService {
|
class PostResponseQueryServiceImpl : PostResponseQueryService {
|
||||||
override suspend fun findById(id: Long, userId: Long?): PostResponse {
|
override suspend fun findById(id: Long, userId: Long?): PostResponse {
|
||||||
return Posts
|
return Posts
|
||||||
|
|
|
@ -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.dto.ReactionResponse
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.Reaction
|
import dev.usbharu.hideout.domain.model.hideout.entity.Reaction
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
|
@Repository
|
||||||
interface ReactionQueryService {
|
interface ReactionQueryService {
|
||||||
suspend fun findByPostId(postId: Long, userId: Long? = null): List<Reaction>
|
suspend fun findByPostId(postId: Long, userId: Long? = null): List<Reaction>
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,10 @@ import dev.usbharu.hideout.util.singleOr
|
||||||
import org.jetbrains.exposed.sql.*
|
import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Repository
|
||||||
class ReactionQueryServiceImpl : ReactionQueryService {
|
class ReactionQueryServiceImpl : ReactionQueryService {
|
||||||
override suspend fun findByPostId(postId: Long, userId: Long?): List<Reaction> {
|
override suspend fun findByPostId(postId: Long, userId: Long?): List<Reaction> {
|
||||||
return Reactions.select {
|
return Reactions.select {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package dev.usbharu.hideout.query
|
package dev.usbharu.hideout.query
|
||||||
|
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.User
|
import dev.usbharu.hideout.domain.model.hideout.entity.User
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
|
@Repository
|
||||||
interface UserQueryService {
|
interface UserQueryService {
|
||||||
suspend fun findAll(limit: Int, offset: Long): List<User>
|
suspend fun findAll(limit: Int, offset: Long): List<User>
|
||||||
suspend fun findById(id: Long): User
|
suspend fun findById(id: Long): User
|
||||||
|
|
|
@ -10,8 +10,10 @@ import org.jetbrains.exposed.sql.select
|
||||||
import org.jetbrains.exposed.sql.selectAll
|
import org.jetbrains.exposed.sql.selectAll
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Repository
|
||||||
class UserQueryServiceImpl : UserQueryService {
|
class UserQueryServiceImpl : UserQueryService {
|
||||||
|
|
||||||
private val logger = LoggerFactory.getLogger(UserQueryServiceImpl::class.java)
|
private val logger = LoggerFactory.getLogger(UserQueryServiceImpl::class.java)
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package dev.usbharu.hideout.repository
|
package dev.usbharu.hideout.repository
|
||||||
|
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.JwtRefreshToken
|
import dev.usbharu.hideout.domain.model.hideout.entity.JwtRefreshToken
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
|
@Repository
|
||||||
interface JwtRefreshTokenRepository {
|
interface JwtRefreshTokenRepository {
|
||||||
suspend fun generateId(): Long
|
suspend fun generateId(): Long
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,11 @@ import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Repository
|
||||||
class JwtRefreshTokenRepositoryImpl(
|
class JwtRefreshTokenRepositoryImpl(
|
||||||
private val database: Database,
|
private val database: Database,
|
||||||
private val idGenerateService: IdGenerateService
|
private val idGenerateService: IdGenerateService
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package dev.usbharu.hideout.repository
|
package dev.usbharu.hideout.repository
|
||||||
|
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.Meta
|
import dev.usbharu.hideout.domain.model.hideout.entity.Meta
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
|
@Repository
|
||||||
interface MetaRepository {
|
interface MetaRepository {
|
||||||
|
|
||||||
suspend fun save(meta: Meta)
|
suspend fun save(meta: Meta)
|
||||||
|
|
|
@ -4,9 +4,11 @@ import dev.usbharu.hideout.domain.model.hideout.entity.Jwt
|
||||||
import org.jetbrains.exposed.sql.*
|
import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Repository
|
||||||
class MetaRepositoryImpl(private val database: Database) : MetaRepository {
|
class MetaRepositoryImpl(private val database: Database) : MetaRepository {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package dev.usbharu.hideout.repository
|
package dev.usbharu.hideout.repository
|
||||||
|
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.Post
|
import dev.usbharu.hideout.domain.model.hideout.entity.Post
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
@Suppress("LongParameterList")
|
@Suppress("LongParameterList")
|
||||||
|
@Repository
|
||||||
interface PostRepository {
|
interface PostRepository {
|
||||||
suspend fun generateId(): Long
|
suspend fun generateId(): Long
|
||||||
suspend fun save(post: Post): Post
|
suspend fun save(post: Post): Post
|
||||||
|
|
|
@ -8,8 +8,10 @@ import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Repository
|
||||||
class PostRepositoryImpl(database: Database, private val idGenerateService: IdGenerateService) : PostRepository {
|
class PostRepositoryImpl(database: Database, private val idGenerateService: IdGenerateService) : PostRepository {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package dev.usbharu.hideout.repository
|
package dev.usbharu.hideout.repository
|
||||||
|
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.Reaction
|
import dev.usbharu.hideout.domain.model.hideout.entity.Reaction
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
|
@Repository
|
||||||
interface ReactionRepository {
|
interface ReactionRepository {
|
||||||
suspend fun generateId(): Long
|
suspend fun generateId(): Long
|
||||||
suspend fun save(reaction: Reaction): Reaction
|
suspend fun save(reaction: Reaction): Reaction
|
||||||
|
|
|
@ -7,8 +7,10 @@ import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Repository
|
||||||
class ReactionRepositoryImpl(
|
class ReactionRepositoryImpl(
|
||||||
private val database: Database,
|
private val database: Database,
|
||||||
private val idGenerateService: IdGenerateService
|
private val idGenerateService: IdGenerateService
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package dev.usbharu.hideout.repository
|
package dev.usbharu.hideout.repository
|
||||||
|
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.User
|
import dev.usbharu.hideout.domain.model.hideout.entity.User
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
@Suppress("TooManyFunctions")
|
@Suppress("TooManyFunctions")
|
||||||
|
@Repository
|
||||||
interface UserRepository {
|
interface UserRepository {
|
||||||
suspend fun save(user: User): User
|
suspend fun save(user: User): User
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,11 @@ import org.jetbrains.exposed.sql.*
|
||||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Repository
|
||||||
class UserRepositoryImpl(private val database: Database, private val idGenerateService: IdGenerateService) :
|
class UserRepositoryImpl(private val database: Database, private val idGenerateService: IdGenerateService) :
|
||||||
UserRepository {
|
UserRepository {
|
||||||
init {
|
init {
|
||||||
|
|
|
@ -11,12 +11,15 @@ import dev.usbharu.hideout.service.core.Transaction
|
||||||
import dev.usbharu.hideout.service.user.UserService
|
import dev.usbharu.hideout.service.user.UserService
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface APAcceptService {
|
interface APAcceptService {
|
||||||
suspend fun receiveAccept(accept: Accept): ActivityPubResponse
|
suspend fun receiveAccept(accept: Accept): ActivityPubResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class APAcceptServiceImpl(
|
class APAcceptServiceImpl(
|
||||||
private val userService: UserService,
|
private val userService: UserService,
|
||||||
private val userQueryService: UserQueryService,
|
private val userQueryService: UserQueryService,
|
||||||
|
|
|
@ -8,12 +8,16 @@ import dev.usbharu.hideout.exception.ap.IllegalActivityPubObjectException
|
||||||
import dev.usbharu.hideout.service.core.Transaction
|
import dev.usbharu.hideout.service.core.Transaction
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
interface APCreateService {
|
interface APCreateService {
|
||||||
suspend fun receiveCreate(create: Create): ActivityPubResponse
|
suspend fun receiveCreate(create: Create): ActivityPubResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class APCreateServiceImpl(
|
class APCreateServiceImpl(
|
||||||
private val apNoteService: APNoteService,
|
private val apNoteService: APNoteService,
|
||||||
private val transaction: Transaction
|
private val transaction: Transaction
|
||||||
|
|
|
@ -9,12 +9,15 @@ import dev.usbharu.hideout.service.core.Transaction
|
||||||
import dev.usbharu.hideout.service.reaction.ReactionService
|
import dev.usbharu.hideout.service.reaction.ReactionService
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface APLikeService {
|
interface APLikeService {
|
||||||
suspend fun receiveLike(like: Like): ActivityPubResponse
|
suspend fun receiveLike(like: Like): ActivityPubResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class APLikeServiceImpl(
|
class APLikeServiceImpl(
|
||||||
private val reactionService: ReactionService,
|
private val reactionService: ReactionService,
|
||||||
private val apUserService: APUserService,
|
private val apUserService: APUserService,
|
||||||
|
|
|
@ -21,8 +21,10 @@ import io.ktor.client.statement.*
|
||||||
import kjob.core.job.JobProps
|
import kjob.core.job.JobProps
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
|
@Service
|
||||||
interface APNoteService {
|
interface APNoteService {
|
||||||
|
|
||||||
suspend fun createNote(post: Post)
|
suspend fun createNote(post: Post)
|
||||||
|
@ -33,6 +35,7 @@ interface APNoteService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class APNoteServiceImpl(
|
class APNoteServiceImpl(
|
||||||
private val httpClient: HttpClient,
|
private val httpClient: HttpClient,
|
||||||
private val jobQueueParentService: JobQueueParentService,
|
private val jobQueueParentService: JobQueueParentService,
|
||||||
|
|
|
@ -15,8 +15,10 @@ import dev.usbharu.hideout.service.job.JobQueueParentService
|
||||||
import io.ktor.client.*
|
import io.ktor.client.*
|
||||||
import kjob.core.job.JobProps
|
import kjob.core.job.JobProps
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
|
@Service
|
||||||
interface APReactionService {
|
interface APReactionService {
|
||||||
suspend fun reaction(like: Reaction)
|
suspend fun reaction(like: Reaction)
|
||||||
suspend fun removeReaction(like: Reaction)
|
suspend fun removeReaction(like: Reaction)
|
||||||
|
@ -25,6 +27,7 @@ interface APReactionService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class APReactionServiceImpl(
|
class APReactionServiceImpl(
|
||||||
private val jobQueueParentService: JobQueueParentService,
|
private val jobQueueParentService: JobQueueParentService,
|
||||||
private val httpClient: HttpClient,
|
private val httpClient: HttpClient,
|
||||||
|
|
|
@ -16,13 +16,16 @@ import io.ktor.client.*
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import kjob.core.job.JobProps
|
import kjob.core.job.JobProps
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface APReceiveFollowService {
|
interface APReceiveFollowService {
|
||||||
suspend fun receiveFollow(follow: Follow): ActivityPubResponse
|
suspend fun receiveFollow(follow: Follow): ActivityPubResponse
|
||||||
suspend fun receiveFollowJob(props: JobProps<ReceiveFollowJob>)
|
suspend fun receiveFollowJob(props: JobProps<ReceiveFollowJob>)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class APReceiveFollowServiceImpl(
|
class APReceiveFollowServiceImpl(
|
||||||
private val jobQueueParentService: JobQueueParentService,
|
private val jobQueueParentService: JobQueueParentService,
|
||||||
private val apUserService: APUserService,
|
private val apUserService: APUserService,
|
||||||
|
|
|
@ -5,12 +5,15 @@ import dev.usbharu.hideout.domain.model.hideout.dto.SendFollowDto
|
||||||
import dev.usbharu.hideout.plugins.postAp
|
import dev.usbharu.hideout.plugins.postAp
|
||||||
import io.ktor.client.*
|
import io.ktor.client.*
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface APSendFollowService {
|
interface APSendFollowService {
|
||||||
suspend fun sendFollow(sendFollowDto: SendFollowDto)
|
suspend fun sendFollow(sendFollowDto: SendFollowDto)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class APSendFollowServiceImpl(private val httpClient: HttpClient) : APSendFollowService {
|
class APSendFollowServiceImpl(private val httpClient: HttpClient) : APSendFollowService {
|
||||||
override suspend fun sendFollow(sendFollowDto: SendFollowDto) {
|
override suspend fun sendFollow(sendFollowDto: SendFollowDto) {
|
||||||
val follow = Follow(
|
val follow = Follow(
|
||||||
|
|
|
@ -12,7 +12,9 @@ import kjob.core.job.JobProps
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface APService {
|
interface APService {
|
||||||
fun parseActivity(json: String): ActivityType
|
fun parseActivity(json: String): ActivityType
|
||||||
|
|
||||||
|
@ -173,6 +175,7 @@ enum class ExtendedVocabulary {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class APServiceImpl(
|
class APServiceImpl(
|
||||||
private val apReceiveFollowService: APReceiveFollowService,
|
private val apReceiveFollowService: APReceiveFollowService,
|
||||||
private val apNoteService: APNoteService,
|
private val apNoteService: APNoteService,
|
||||||
|
|
|
@ -9,12 +9,16 @@ import dev.usbharu.hideout.service.core.Transaction
|
||||||
import dev.usbharu.hideout.service.user.UserService
|
import dev.usbharu.hideout.service.user.UserService
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
interface APUndoService {
|
interface APUndoService {
|
||||||
suspend fun receiveUndo(undo: Undo): ActivityPubResponse
|
suspend fun receiveUndo(undo: Undo): ActivityPubResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
@Suppress("UnsafeCallOnNullableType")
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
class APUndoServiceImpl(
|
class APUndoServiceImpl(
|
||||||
private val userService: UserService,
|
private val userService: UserService,
|
||||||
|
|
|
@ -19,7 +19,9 @@ import io.ktor.client.request.*
|
||||||
import io.ktor.client.statement.*
|
import io.ktor.client.statement.*
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface APUserService {
|
interface APUserService {
|
||||||
suspend fun getPersonByName(name: String): Person
|
suspend fun getPersonByName(name: String): Person
|
||||||
|
|
||||||
|
@ -36,6 +38,7 @@ interface APUserService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class APUserServiceImpl(
|
class APUserServiceImpl(
|
||||||
private val userService: UserService,
|
private val userService: UserService,
|
||||||
private val httpClient: HttpClient,
|
private val httpClient: HttpClient,
|
||||||
|
|
|
@ -13,9 +13,11 @@ import dev.usbharu.hideout.service.post.PostService
|
||||||
import dev.usbharu.hideout.service.reaction.ReactionService
|
import dev.usbharu.hideout.service.reaction.ReactionService
|
||||||
import dev.usbharu.hideout.util.AcctUtil
|
import dev.usbharu.hideout.util.AcctUtil
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
@Suppress("LongParameterList")
|
@Suppress("LongParameterList")
|
||||||
|
@Service
|
||||||
interface PostApiService {
|
interface PostApiService {
|
||||||
suspend fun createPost(postForm: dev.usbharu.hideout.domain.model.hideout.form.Post, userId: Long): PostResponse
|
suspend fun createPost(postForm: dev.usbharu.hideout.domain.model.hideout.form.Post, userId: Long): PostResponse
|
||||||
suspend fun getById(id: Long, userId: Long?): PostResponse
|
suspend fun getById(id: Long, userId: Long?): PostResponse
|
||||||
|
@ -44,6 +46,7 @@ interface PostApiService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class PostApiServiceImpl(
|
class PostApiServiceImpl(
|
||||||
private val postService: PostService,
|
private val postService: PostService,
|
||||||
private val userRepository: UserRepository,
|
private val userRepository: UserRepository,
|
||||||
|
|
|
@ -10,9 +10,11 @@ import dev.usbharu.hideout.query.UserQueryService
|
||||||
import dev.usbharu.hideout.service.core.Transaction
|
import dev.usbharu.hideout.service.core.Transaction
|
||||||
import dev.usbharu.hideout.service.user.UserService
|
import dev.usbharu.hideout.service.user.UserService
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
@Suppress("TooManyFunctions")
|
@Suppress("TooManyFunctions")
|
||||||
|
@Service
|
||||||
interface UserApiService {
|
interface UserApiService {
|
||||||
suspend fun findAll(limit: Int? = 100, offset: Long = 0): List<UserResponse>
|
suspend fun findAll(limit: Int? = 100, offset: Long = 0): List<UserResponse>
|
||||||
|
|
||||||
|
@ -37,6 +39,7 @@ interface UserApiService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class UserApiServiceImpl(
|
class UserApiServiceImpl(
|
||||||
private val userQueryService: UserQueryService,
|
private val userQueryService: UserQueryService,
|
||||||
private val followerQueryService: FollowerQueryService,
|
private val followerQueryService: FollowerQueryService,
|
||||||
|
|
|
@ -9,13 +9,16 @@ import dev.usbharu.hideout.service.auth.JwtService
|
||||||
import dev.usbharu.hideout.service.core.Transaction
|
import dev.usbharu.hideout.service.core.Transaction
|
||||||
import dev.usbharu.hideout.service.user.UserAuthServiceImpl
|
import dev.usbharu.hideout.service.user.UserAuthServiceImpl
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface UserAuthApiService {
|
interface UserAuthApiService {
|
||||||
suspend fun login(username: String, password: String): JwtToken
|
suspend fun login(username: String, password: String): JwtToken
|
||||||
suspend fun refreshToken(refreshToken: RefreshToken): JwtToken
|
suspend fun refreshToken(refreshToken: RefreshToken): JwtToken
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class UserAuthApiServiceImpl(
|
class UserAuthApiServiceImpl(
|
||||||
private val userAuthService: UserAuthServiceImpl,
|
private val userAuthService: UserAuthServiceImpl,
|
||||||
private val userQueryService: UserQueryService,
|
private val userQueryService: UserQueryService,
|
||||||
|
|
|
@ -4,12 +4,15 @@ import dev.usbharu.hideout.domain.model.hideout.entity.User
|
||||||
import dev.usbharu.hideout.query.UserQueryService
|
import dev.usbharu.hideout.query.UserQueryService
|
||||||
import dev.usbharu.hideout.service.core.Transaction
|
import dev.usbharu.hideout.service.core.Transaction
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface WebFingerApiService {
|
interface WebFingerApiService {
|
||||||
suspend fun findByNameAndDomain(name: String, domain: String): User
|
suspend fun findByNameAndDomain(name: String, domain: String): User
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class WebFingerApiServiceImpl(private val transaction: Transaction, private val userQueryService: UserQueryService) :
|
class WebFingerApiServiceImpl(private val transaction: Transaction, private val userQueryService: UserQueryService) :
|
||||||
WebFingerApiService {
|
WebFingerApiService {
|
||||||
override suspend fun findByNameAndDomain(name: String, domain: String): User {
|
override suspend fun findByNameAndDomain(name: String, domain: String): User {
|
||||||
|
|
|
@ -5,13 +5,16 @@ import dev.usbharu.hideout.query.UserQueryService
|
||||||
import dev.usbharu.hideout.service.core.Transaction
|
import dev.usbharu.hideout.service.core.Transaction
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import tech.barbero.http.message.signing.SignatureHeaderVerifier
|
import tech.barbero.http.message.signing.SignatureHeaderVerifier
|
||||||
|
|
||||||
|
@Service
|
||||||
interface HttpSignatureVerifyService {
|
interface HttpSignatureVerifyService {
|
||||||
fun verify(headers: Headers): Boolean
|
fun verify(headers: Headers): Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class HttpSignatureVerifyServiceImpl(
|
class HttpSignatureVerifyServiceImpl(
|
||||||
private val userQueryService: UserQueryService,
|
private val userQueryService: UserQueryService,
|
||||||
private val transaction: Transaction
|
private val transaction: Transaction
|
||||||
|
|
|
@ -15,10 +15,12 @@ import dev.usbharu.hideout.service.core.MetaService
|
||||||
import dev.usbharu.hideout.util.RsaUtil
|
import dev.usbharu.hideout.util.RsaUtil
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.temporal.ChronoUnit
|
import java.time.temporal.ChronoUnit
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@Service
|
||||||
interface JwtService {
|
interface JwtService {
|
||||||
suspend fun createToken(user: User): JwtToken
|
suspend fun createToken(user: User): JwtToken
|
||||||
suspend fun refreshToken(refreshToken: RefreshToken): JwtToken
|
suspend fun refreshToken(refreshToken: RefreshToken): JwtToken
|
||||||
|
@ -30,6 +32,7 @@ interface JwtService {
|
||||||
|
|
||||||
@Suppress("InjectDispatcher")
|
@Suppress("InjectDispatcher")
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class JwtServiceImpl(
|
class JwtServiceImpl(
|
||||||
private val metaService: MetaService,
|
private val metaService: MetaService,
|
||||||
private val refreshTokenRepository: JwtRefreshTokenRepository,
|
private val refreshTokenRepository: JwtRefreshTokenRepository,
|
||||||
|
|
|
@ -2,8 +2,10 @@ package dev.usbharu.hideout.service.core
|
||||||
|
|
||||||
import org.jetbrains.exposed.sql.transactions.experimental.newSuspendedTransaction
|
import org.jetbrains.exposed.sql.transactions.experimental.newSuspendedTransaction
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class ExposedTransaction : Transaction {
|
class ExposedTransaction : Transaction {
|
||||||
override suspend fun <T> transaction(block: suspend () -> T): T {
|
override suspend fun <T> transaction(block: suspend () -> T): T {
|
||||||
return newSuspendedTransaction(transactionIsolation = java.sql.Connection.TRANSACTION_SERIALIZABLE) {
|
return newSuspendedTransaction(transactionIsolation = java.sql.Connection.TRANSACTION_SERIALIZABLE) {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package dev.usbharu.hideout.service.core
|
package dev.usbharu.hideout.service.core
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface IdGenerateService {
|
interface IdGenerateService {
|
||||||
suspend fun generateId(): Long
|
suspend fun generateId(): Long
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.Jwt
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.Meta
|
import dev.usbharu.hideout.domain.model.hideout.entity.Meta
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface MetaService {
|
interface MetaService {
|
||||||
suspend fun getMeta(): Meta
|
suspend fun getMeta(): Meta
|
||||||
suspend fun updateMeta(meta: Meta)
|
suspend fun updateMeta(meta: Meta)
|
||||||
|
|
|
@ -5,8 +5,10 @@ import dev.usbharu.hideout.domain.model.hideout.entity.Meta
|
||||||
import dev.usbharu.hideout.exception.NotInitException
|
import dev.usbharu.hideout.exception.NotInitException
|
||||||
import dev.usbharu.hideout.repository.MetaRepository
|
import dev.usbharu.hideout.repository.MetaRepository
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class MetaServiceImpl(private val metaRepository: MetaRepository, private val transaction: Transaction) :
|
class MetaServiceImpl(private val metaRepository: MetaRepository, private val transaction: Transaction) :
|
||||||
MetaService {
|
MetaService {
|
||||||
override suspend fun getMeta(): Meta =
|
override suspend fun getMeta(): Meta =
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package dev.usbharu.hideout.service.core
|
package dev.usbharu.hideout.service.core
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface ServerInitialiseService {
|
interface ServerInitialiseService {
|
||||||
suspend fun init()
|
suspend fun init()
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,12 @@ import dev.usbharu.hideout.util.ServerUtil
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
import org.slf4j.Logger
|
import org.slf4j.Logger
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import java.security.KeyPairGenerator
|
import java.security.KeyPairGenerator
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class ServerInitialiseServiceImpl(
|
class ServerInitialiseServiceImpl(
|
||||||
private val metaRepository: MetaRepository,
|
private val metaRepository: MetaRepository,
|
||||||
private val transaction: Transaction
|
private val transaction: Transaction
|
||||||
|
|
|
@ -3,9 +3,11 @@ package dev.usbharu.hideout.service.core
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.sync.Mutex
|
import kotlinx.coroutines.sync.Mutex
|
||||||
import kotlinx.coroutines.sync.withLock
|
import kotlinx.coroutines.sync.withLock
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
@Suppress("MagicNumber")
|
@Suppress("MagicNumber")
|
||||||
|
@Service
|
||||||
open class SnowflakeIdGenerateService(private val baseTime: Long) : IdGenerateService {
|
open class SnowflakeIdGenerateService(private val baseTime: Long) : IdGenerateService {
|
||||||
var lastTimeStamp: Long = -1
|
var lastTimeStamp: Long = -1
|
||||||
var sequenceId: Int = 0
|
var sequenceId: Int = 0
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package dev.usbharu.hideout.service.core
|
package dev.usbharu.hideout.service.core
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface Transaction {
|
interface Transaction {
|
||||||
suspend fun <T> transaction(block: suspend () -> T): T
|
suspend fun <T> transaction(block: suspend () -> T): T
|
||||||
suspend fun <T> transaction(transactionLevel: Int, block: suspend () -> T): T
|
suspend fun <T> transaction(transactionLevel: Int, block: suspend () -> T): T
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package dev.usbharu.hideout.service.core
|
package dev.usbharu.hideout.service.core
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
// 2010-11-04T01:42:54.657
|
// 2010-11-04T01:42:54.657
|
||||||
@Suppress("MagicNumber")
|
@Suppress("MagicNumber")
|
||||||
|
@Service
|
||||||
object TwitterSnowflakeIdGenerateService : SnowflakeIdGenerateService(1288834974657L)
|
object TwitterSnowflakeIdGenerateService : SnowflakeIdGenerateService(1288834974657L)
|
||||||
|
|
|
@ -2,7 +2,9 @@ package dev.usbharu.hideout.service.job
|
||||||
|
|
||||||
import kjob.core.Job
|
import kjob.core.Job
|
||||||
import kjob.core.dsl.ScheduleContext
|
import kjob.core.dsl.ScheduleContext
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface JobQueueParentService {
|
interface JobQueueParentService {
|
||||||
|
|
||||||
fun init(jobDefines: List<Job>)
|
fun init(jobDefines: List<Job>)
|
||||||
|
|
|
@ -2,9 +2,11 @@ package dev.usbharu.hideout.service.job
|
||||||
|
|
||||||
import kjob.core.Job
|
import kjob.core.Job
|
||||||
import kjob.core.dsl.KJobFunctions
|
import kjob.core.dsl.KJobFunctions
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import kjob.core.dsl.JobContextWithProps as JCWP
|
import kjob.core.dsl.JobContextWithProps as JCWP
|
||||||
import kjob.core.dsl.JobRegisterContext as JRC
|
import kjob.core.dsl.JobRegisterContext as JRC
|
||||||
|
|
||||||
|
@Service
|
||||||
interface JobQueueWorkerService {
|
interface JobQueueWorkerService {
|
||||||
fun init(defines: List<Pair<Job, JRC<Job, JCWP<Job>>.(Job) -> KJobFunctions<Job, JCWP<Job>>>>)
|
fun init(defines: List<Pair<Job, JRC<Job, JCWP<Job>>.(Job) -> KJobFunctions<Job, JCWP<Job>>>>)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,9 @@ import kjob.core.dsl.ScheduleContext
|
||||||
import kjob.core.kjob
|
import kjob.core.kjob
|
||||||
import org.jetbrains.exposed.sql.Database
|
import org.jetbrains.exposed.sql.Database
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
class KJobJobQueueParentService(private val database: Database) : JobQueueParentService {
|
class KJobJobQueueParentService(private val database: Database) : JobQueueParentService {
|
||||||
|
|
||||||
private val logger = LoggerFactory.getLogger(this::class.java)
|
private val logger = LoggerFactory.getLogger(this::class.java)
|
||||||
|
|
|
@ -5,9 +5,11 @@ import kjob.core.Job
|
||||||
import kjob.core.dsl.KJobFunctions
|
import kjob.core.dsl.KJobFunctions
|
||||||
import kjob.core.kjob
|
import kjob.core.kjob
|
||||||
import org.jetbrains.exposed.sql.Database
|
import org.jetbrains.exposed.sql.Database
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import kjob.core.dsl.JobContextWithProps as JCWP
|
import kjob.core.dsl.JobContextWithProps as JCWP
|
||||||
import kjob.core.dsl.JobRegisterContext as JRC
|
import kjob.core.dsl.JobRegisterContext as JRC
|
||||||
|
|
||||||
|
@Service
|
||||||
class KJobJobQueueWorkerService(private val database: Database) : JobQueueWorkerService {
|
class KJobJobQueueWorkerService(private val database: Database) : JobQueueWorkerService {
|
||||||
|
|
||||||
val kjob by lazy {
|
val kjob by lazy {
|
||||||
|
|
|
@ -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.dto.PostCreateDto
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.Post
|
import dev.usbharu.hideout.domain.model.hideout.entity.Post
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface PostService {
|
interface PostService {
|
||||||
suspend fun createLocal(post: PostCreateDto): Post
|
suspend fun createLocal(post: PostCreateDto): Post
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,10 @@ import dev.usbharu.hideout.repository.PostRepository
|
||||||
import dev.usbharu.hideout.repository.UserRepository
|
import dev.usbharu.hideout.repository.UserRepository
|
||||||
import dev.usbharu.hideout.service.ap.APNoteService
|
import dev.usbharu.hideout.service.ap.APNoteService
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
|
@Service
|
||||||
@Single
|
@Single
|
||||||
class PostServiceImpl(
|
class PostServiceImpl(
|
||||||
private val postRepository: PostRepository,
|
private val postRepository: PostRepository,
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package dev.usbharu.hideout.service.reaction
|
package dev.usbharu.hideout.service.reaction
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
interface ReactionService {
|
interface ReactionService {
|
||||||
suspend fun receiveReaction(name: String, domain: String, userId: Long, postId: Long)
|
suspend fun receiveReaction(name: String, domain: String, userId: Long, postId: Long)
|
||||||
suspend fun sendReaction(name: String, userId: Long, postId: Long)
|
suspend fun sendReaction(name: String, userId: Long, postId: Long)
|
||||||
|
|
|
@ -5,8 +5,10 @@ import dev.usbharu.hideout.query.ReactionQueryService
|
||||||
import dev.usbharu.hideout.repository.ReactionRepository
|
import dev.usbharu.hideout.repository.ReactionRepository
|
||||||
import dev.usbharu.hideout.service.ap.APReactionService
|
import dev.usbharu.hideout.service.ap.APReactionService
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class ReactionServiceImpl(
|
class ReactionServiceImpl(
|
||||||
private val reactionRepository: ReactionRepository,
|
private val reactionRepository: ReactionRepository,
|
||||||
private val apReactionService: APReactionService,
|
private val apReactionService: APReactionService,
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package dev.usbharu.hideout.service.user
|
package dev.usbharu.hideout.service.user
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import java.security.KeyPair
|
import java.security.KeyPair
|
||||||
|
|
||||||
|
@Service
|
||||||
interface UserAuthService {
|
interface UserAuthService {
|
||||||
fun hash(password: String): String
|
fun hash(password: String): String
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,12 @@ import dev.usbharu.hideout.config.Config
|
||||||
import dev.usbharu.hideout.query.UserQueryService
|
import dev.usbharu.hideout.query.UserQueryService
|
||||||
import io.ktor.util.*
|
import io.ktor.util.*
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import java.security.*
|
import java.security.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class UserAuthServiceImpl(
|
class UserAuthServiceImpl(
|
||||||
val userQueryService: UserQueryService
|
val userQueryService: UserQueryService
|
||||||
) : UserAuthService {
|
) : UserAuthService {
|
||||||
|
|
|
@ -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.RemoteUserCreateDto
|
||||||
import dev.usbharu.hideout.domain.model.hideout.dto.UserCreateDto
|
import dev.usbharu.hideout.domain.model.hideout.dto.UserCreateDto
|
||||||
import dev.usbharu.hideout.domain.model.hideout.entity.User
|
import dev.usbharu.hideout.domain.model.hideout.entity.User
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
@Suppress("TooManyFunctions")
|
@Suppress("TooManyFunctions")
|
||||||
|
@Service
|
||||||
interface UserService {
|
interface UserService {
|
||||||
|
|
||||||
suspend fun usernameAlreadyUse(username: String): Boolean
|
suspend fun usernameAlreadyUse(username: String): Boolean
|
||||||
|
|
|
@ -11,9 +11,11 @@ import dev.usbharu.hideout.query.UserQueryService
|
||||||
import dev.usbharu.hideout.repository.UserRepository
|
import dev.usbharu.hideout.repository.UserRepository
|
||||||
import dev.usbharu.hideout.service.ap.APSendFollowService
|
import dev.usbharu.hideout.service.ap.APSendFollowService
|
||||||
import org.koin.core.annotation.Single
|
import org.koin.core.annotation.Single
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
@Single
|
@Single
|
||||||
|
@Service
|
||||||
class UserServiceImpl(
|
class UserServiceImpl(
|
||||||
private val userRepository: UserRepository,
|
private val userRepository: UserRepository,
|
||||||
private val userAuthService: UserAuthService,
|
private val userAuthService: UserAuthService,
|
||||||
|
|
Loading…
Reference in New Issue