mirror of https://github.com/usbharu/Hideout.git
fix: トランザクションの修正
This commit is contained in:
parent
0d5fecbd4d
commit
51aeff6015
|
@ -14,6 +14,7 @@ import dev.usbharu.hideout.core.query.UserQueryService
|
|||
import dev.usbharu.hideout.core.service.user.RemoteUserCreateDto
|
||||
import dev.usbharu.hideout.core.service.user.UserService
|
||||
import org.springframework.stereotype.Service
|
||||
import org.springframework.transaction.annotation.Transactional
|
||||
|
||||
interface APUserService {
|
||||
suspend fun getPersonByName(name: String): Person
|
||||
|
@ -74,6 +75,7 @@ class APUserServiceImpl(
|
|||
override suspend fun fetchPerson(url: String, targetActor: String?): Person =
|
||||
fetchPersonWithEntity(url, targetActor).first
|
||||
|
||||
@Transactional
|
||||
override suspend fun fetchPersonWithEntity(url: String, targetActor: String?): Pair<Person, User> {
|
||||
return try {
|
||||
val userEntity = userQueryService.findByUrl(url)
|
||||
|
|
|
@ -12,6 +12,7 @@ import dev.usbharu.hideout.core.service.instance.InstanceService
|
|||
import org.jetbrains.exposed.exceptions.ExposedSQLException
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Service
|
||||
import org.springframework.transaction.annotation.Transactional
|
||||
import java.time.Instant
|
||||
|
||||
@Service
|
||||
|
@ -57,6 +58,7 @@ class UserServiceImpl(
|
|||
return userRepository.save(userEntity)
|
||||
}
|
||||
|
||||
@Transactional
|
||||
override suspend fun createRemoteUser(user: RemoteUserCreateDto): User {
|
||||
@Suppress("TooGenericExceptionCaught")
|
||||
val instance = try {
|
||||
|
|
|
@ -55,8 +55,7 @@ class UserAPControllerImplTest {
|
|||
publicKey = Key(
|
||||
id = "https://example.com/users/hoge#pubkey",
|
||||
owner = "https://example.com/users/hoge",
|
||||
publicKeyPem = "-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----",
|
||||
type = emptyList()
|
||||
publicKeyPem = "-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----"
|
||||
),
|
||||
endpoints = mapOf("sharedInbox" to "https://example.com/inbox"),
|
||||
followers = "https://example.com/users/hoge/followers",
|
||||
|
|
Loading…
Reference in New Issue