From 5cf4d376523af08c0a64cd0fb4e19086fc64d566 Mon Sep 17 00:00:00 2001
From: xb205 <62425964+devxb@users.noreply.github.com>
Date: Fri, 1 Nov 2024 19:12:47 +0900
Subject: [PATCH 1/3] =?UTF-8?q?docs:=20=F0=9F=9A=A8=EA=B3=B5=EC=A7=80?=
=?UTF-8?q?=F0=9F=9A=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index 2a2afba..65f05fd 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+# 현재 동물들이 잘 보이지 않는 버그가 발생하고 있습니다 깃허브 이미지 캐싱 서버를 거치면서 이미지에 문제가 생기는것으로 파악되었으며, 주말동안 해결 할 예정입니다. 죄송합니다.
+
##
From 4646fc02ce950dc3389d98caf812c7ca75fe9ec3 Mon Sep 17 00:00:00 2001
From: xb205 <62425964+devxb@users.noreply.github.com>
Date: Fri, 1 Nov 2024 21:34:49 +0900
Subject: [PATCH 2/3] docs: rollback
---
README.md | 2 --
1 file changed, 2 deletions(-)
diff --git a/README.md b/README.md
index 65f05fd..2a2afba 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,3 @@
-# 현재 동물들이 잘 보이지 않는 버그가 발생하고 있습니다 깃허브 이미지 캐싱 서버를 거치면서 이미지에 문제가 생기는것으로 파악되었으며, 주말동안 해결 할 예정입니다. 죄송합니다.
-
##
From 3fa4dd82267574bb87a96e05d8d4eee857153a65 Mon Sep 17 00:00:00 2001
From: devxb
Date: Sun, 10 Nov 2024 15:50:21 +0900
Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=ED=8E=AB=20=ED=95=A9=EC=84=B1?=
=?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EB=B2=84=EA=B7=B8=EC=99=80=20api=EC=8A=A4?=
=?UTF-8?q?=ED=8E=99=EC=9D=84=20=EC=88=98=EC=A0=95=ED=95=9C=EB=8B=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../kotlin/org/gitanimals/render/app/UserFacade.kt | 4 ++--
src/main/kotlin/org/gitanimals/render/domain/User.kt | 4 +++-
.../org/gitanimals/render/domain/UserService.kt | 12 ++++++++----
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt
index e049c06..e567b2c 100644
--- a/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt
+++ b/src/main/kotlin/org/gitanimals/render/app/UserFacade.kt
@@ -43,11 +43,11 @@ class UserFacade(
return userService.getPersona(user.username, personaId)
}
- fun mergePersona(token: String, request: MergePersonaRequest) {
+ fun mergePersona(token: String, request: MergePersonaRequest): PersonaResponse {
val user = identityApi.getUserByToken(token)
return userService.mergePersona(
- user.id.toLong(),
+ user.username,
request.increasePersonaId.toLong(),
request.deletePersonaId.toLong(),
)
diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt
index f95caab..286908a 100644
--- a/src/main/kotlin/org/gitanimals/render/domain/User.kt
+++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt
@@ -247,7 +247,7 @@ class User(
.append("")
.toString()
- fun mergePersona(increasePersonaId: Long, deletePersonaId: Long) {
+ fun mergePersona(increasePersonaId: Long, deletePersonaId: Long): Persona {
require(increasePersonaId != deletePersonaId) {
"increasePersonaId \"$increasePersonaId\", deletePersonaId \"$deletePersonaId\" must be different"
}
@@ -258,6 +258,8 @@ class User(
increasePersona.level.value += deletePersona.level.value
personas.remove(deletePersona)
+
+ return increasePersona
}
companion object {
diff --git a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt
index b8bc412..cebf7f7 100644
--- a/src/main/kotlin/org/gitanimals/render/domain/UserService.kt
+++ b/src/main/kotlin/org/gitanimals/render/domain/UserService.kt
@@ -109,11 +109,15 @@ class UserService(
@Transactional
@Retryable(retryFor = [ObjectOptimisticLockingFailureException::class], maxAttempts = 10)
- fun mergePersona(id: Long, increasePersonaId: Long, deletePersonaId: Long) {
- val user = userRepository.findByIdOrNull(id)
- ?: throw IllegalArgumentException("Cannot find user by id \"$id\"")
+ fun mergePersona(
+ name: String,
+ increasePersonaId: Long,
+ deletePersonaId: Long,
+ ): PersonaResponse {
+ val user = userRepository.findByName(name)
+ ?: throw IllegalArgumentException("Cannot find user by name \"$name\"")
- user.mergePersona(increasePersonaId, deletePersonaId)
+ return PersonaResponse.from(user.mergePersona(increasePersonaId, deletePersonaId))
}
@Transactional