From 790b3a1c4283c198c4fca29aef899ff8371d78d2 Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 17 May 2024 23:08:20 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20=ED=8E=AB=EC=9D=B4=2030?= =?UTF-8?q?=EB=A7=88=EB=A6=AC=20=EC=9D=BC=EB=95=8C=20visible=EC=9D=B4=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/org/gitanimals/render/domain/User.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/org/gitanimals/render/domain/User.kt b/src/main/kotlin/org/gitanimals/render/domain/User.kt index d5a2ac6..338a1a8 100644 --- a/src/main/kotlin/org/gitanimals/render/domain/User.kt +++ b/src/main/kotlin/org/gitanimals/render/domain/User.kt @@ -88,13 +88,14 @@ class User( val persona = personas.find { it.id == personaId } ?: throw IllegalArgumentException("Cannot find persona by id \"$personaId\"") + persona.visible = visible + val visiblePersonas = personas.filter { it.visible } require(visiblePersonas.size < MAX_PERSONA_COUNT) { "Persona count must be under \"$MAX_PERSONA_COUNT\" but, current persona count is \"${visiblePersonas.size}\"" } - persona.visible = visible return persona } From 3c49ed16780137fbfd85152f6d279e6d82c358bc Mon Sep 17 00:00:00 2001 From: devxb Date: Fri, 17 May 2024 23:08:35 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20IllegalArgumentException=20?= =?UTF-8?q?=EB=B0=9C=EC=83=9D=EC=8B=9C=20400=20=EC=98=88=EC=99=B8=EB=A5=BC?= =?UTF-8?q?=20=EB=8D=98=EC=A7=84=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/org/gitanimals/render/controller/PersonaController.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt index 99dc52b..41a9c30 100644 --- a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt +++ b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt @@ -76,6 +76,7 @@ class PersonaController( } @ExceptionHandler(IllegalArgumentException::class) + @ResponseStatus(HttpStatus.BAD_REQUEST) fun handleIllegalArgumentException(exception: IllegalArgumentException): ErrorResponse = ErrorResponse.from(exception) }