mirror of https://github.com/usbharu/Hideout.git
refactor: 不要なコードを削除、DI用アノテーションを追加
This commit is contained in:
parent
4fa0b07dff
commit
4fcc096a42
|
@ -5,8 +5,10 @@ import dev.usbharu.hideout.repository.Users
|
||||||
import dev.usbharu.hideout.repository.UsersFollowers
|
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 java.time.Instant
|
import java.time.Instant
|
||||||
|
|
||||||
|
@Single
|
||||||
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")
|
||||||
|
|
|
@ -19,8 +19,6 @@ class UserService(
|
||||||
) :
|
) :
|
||||||
IUserService {
|
IUserService {
|
||||||
|
|
||||||
override suspend fun findByUrls(urls: List<String>): List<User> = userRepository.findByUrls(urls)
|
|
||||||
|
|
||||||
override suspend fun usernameAlreadyUse(username: String): Boolean {
|
override suspend fun usernameAlreadyUse(username: String): Boolean {
|
||||||
val findByNameAndDomain = userRepository.findByNameAndDomain(username, Config.configData.domain)
|
val findByNameAndDomain = userRepository.findByNameAndDomain(username, Config.configData.domain)
|
||||||
return findByNameAndDomain != null
|
return findByNameAndDomain != null
|
||||||
|
@ -64,8 +62,6 @@ class UserService(
|
||||||
return userRepository.save(userEntity)
|
return userRepository.save(userEntity)
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun findFollowersById(id: Long): List<User> = userRepository.findFollowersById(id)
|
|
||||||
|
|
||||||
// TODO APのフォロー処理を作る
|
// TODO APのフォロー処理を作る
|
||||||
override suspend fun followRequest(id: Long, followerId: Long): Boolean {
|
override suspend fun followRequest(id: Long, followerId: Long): Boolean {
|
||||||
val user = userRepository.findById(id) ?: throw UserNotFoundException("$id was not found.")
|
val user = userRepository.findById(id) ?: throw UserNotFoundException("$id was not found.")
|
||||||
|
|
Loading…
Reference in New Issue