From 3db79de979d1135fdb6793c0a990134bb45850f0 Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 26 Dec 2024 18:09:44 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20LOGO=20SHOWING=20=EA=B8=B8=EB=93=9C?= =?UTF-8?q?=20=EB=B0=B0=EA=B2=BD=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/guild/domain/GuildFarmType.kt | 15 + .../org/gitanimals/guild/domain/Svgs.kt | 3 + .../resources/persona/field/logo-showing.svg | 1313 +++++++++++++++++ 3 files changed, 1331 insertions(+) create mode 100644 src/main/resources/persona/field/logo-showing.svg diff --git a/src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt b/src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt index b58f1db..53284ea 100644 --- a/src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt +++ b/src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt @@ -14,6 +14,21 @@ enum class GuildFarmType { override fun drawBorder(): String = "" }, + LOGO_SHOWING { + override fun loadComponent(name: String, commit: Long): String { + return dummyGuildFieldSvg.replace(NAME_FIX, name.toSvg(0.0, 3.0)) + .replace(COMMIT_FIX, commit.toSvg("commit", 260.0, 4.0)) + } + + override fun fillBackground(): String = + """ + + $logoShowingFieldSvg + """ + + override fun drawBorder(): String = + "" + } ; abstract fun loadComponent(name: String, commit: Long): String diff --git a/src/main/kotlin/org/gitanimals/guild/domain/Svgs.kt b/src/main/kotlin/org/gitanimals/guild/domain/Svgs.kt index 3d7b2cd..8e3876f 100644 --- a/src/main/kotlin/org/gitanimals/guild/domain/Svgs.kt +++ b/src/main/kotlin/org/gitanimals/guild/domain/Svgs.kt @@ -6,6 +6,9 @@ import java.nio.charset.Charset val dummyGuildFieldSvg: String = ClassPathResource("persona/field/white-field.svg") .getContentAsString(Charset.defaultCharset()) +val logoShowingFieldSvg: String = ClassPathResource("persona/field/logo-showing.svg") + .getContentAsString(Charset.defaultCharset()) + val largeTextSvgs = lazy { val map = mutableMapOf() for (i in 'A'..'Z') { diff --git a/src/main/resources/persona/field/logo-showing.svg b/src/main/resources/persona/field/logo-showing.svg new file mode 100644 index 0000000..ffc50fb --- /dev/null +++ b/src/main/resources/persona/field/logo-showing.svg @@ -0,0 +1,1313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 3c5d95d9956019567c67e648f2314e2873e41e2e Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 26 Dec 2024 18:10:43 +0900 Subject: [PATCH 2/3] =?UTF-8?q?refactor:=20DUMMY=20=EA=B8=B8=EB=93=9C=20?= =?UTF-8?q?=EB=B0=B0=EA=B2=BD=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/gitanimals/guild/domain/GuildFarmType.kt | 12 ------------ .../gitanimals/guild/app/CreateGuildFacadeTest.kt | 2 +- .../kotlin/org/gitanimals/guild/domain/Fixture.kt | 2 +- .../org/gitanimals/guild/domain/GuildServiceTest.kt | 2 +- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt b/src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt index 53284ea..6219fbe 100644 --- a/src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt +++ b/src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt @@ -2,18 +2,6 @@ package org.gitanimals.guild.domain enum class GuildFarmType { - DUMMY { - override fun loadComponent(name: String, commit: Long): String { - return dummyGuildFieldSvg.replace(NAME_FIX, name.toSvg(0.0, 3.0)) - .replace(COMMIT_FIX, commit.toSvg("commit", 260.0, 4.0)) - } - - override fun fillBackground(): String = - "" - - override fun drawBorder(): String = - "" - }, LOGO_SHOWING { override fun loadComponent(name: String, commit: Long): String { return dummyGuildFieldSvg.replace(NAME_FIX, name.toSvg(0.0, 3.0)) diff --git a/src/test/kotlin/org/gitanimals/guild/app/CreateGuildFacadeTest.kt b/src/test/kotlin/org/gitanimals/guild/app/CreateGuildFacadeTest.kt index 9f81c5a..d8374ef 100644 --- a/src/test/kotlin/org/gitanimals/guild/app/CreateGuildFacadeTest.kt +++ b/src/test/kotlin/org/gitanimals/guild/app/CreateGuildFacadeTest.kt @@ -111,7 +111,7 @@ internal class CreateGuildFacadeTest( body = "We are gitanimals", guildIcon = GuildIcons.CAT.getImagePath(), autoJoin = true, - farmType = GuildFarmType.DUMMY, + farmType = GuildFarmType.LOGO_SHOWING, personaId = "3", ) diff --git a/src/test/kotlin/org/gitanimals/guild/domain/Fixture.kt b/src/test/kotlin/org/gitanimals/guild/domain/Fixture.kt index bc10d85..412b2d9 100644 --- a/src/test/kotlin/org/gitanimals/guild/domain/Fixture.kt +++ b/src/test/kotlin/org/gitanimals/guild/domain/Fixture.kt @@ -8,7 +8,7 @@ fun guild( leader: Leader = leader(), members: MutableSet = mutableSetOf(), waitMembers: MutableSet = mutableSetOf(), - farmType: GuildFarmType = GuildFarmType.DUMMY, + farmType: GuildFarmType = GuildFarmType.LOGO_SHOWING, autoJoin: Boolean = true, ): Guild { return Guild( diff --git a/src/test/kotlin/org/gitanimals/guild/domain/GuildServiceTest.kt b/src/test/kotlin/org/gitanimals/guild/domain/GuildServiceTest.kt index 845f554..1a1fbf1 100644 --- a/src/test/kotlin/org/gitanimals/guild/domain/GuildServiceTest.kt +++ b/src/test/kotlin/org/gitanimals/guild/domain/GuildServiceTest.kt @@ -32,7 +32,7 @@ internal class GuildServiceTest( val guildIcon = GuildIcons.CAT.getImagePath() val title = "guildTitle" val body = "guildBody" - val farmType = GuildFarmType.DUMMY + val farmType = GuildFarmType.LOGO_SHOWING val leaderRequest = CreateLeaderRequest( userId = 1L, name = "devxb", From bee1bdfbc404996c05764640a5a8d360a7bb9d7d Mon Sep 17 00:00:00 2001 From: devxb Date: Thu, 26 Dec 2024 18:14:03 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=EB=AA=A8=EB=93=A0=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=20=EA=B0=80=EB=8A=A5=ED=95=9C=20=EA=B8=B8=EB=93=9C=20?= =?UTF-8?q?=EB=B0=B0=EA=B2=BD=20=EC=A1=B0=ED=9A=8C=20API=EB=A5=BC=20?= =?UTF-8?q?=EA=B0=9C=EB=B0=9C=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitanimals/guild/controller/GuildController.kt | 12 ++++++++---- .../controller/response/GuildBackgroundResponse.kt | 7 +++++++ .../org/gitanimals/guild/domain/GuildFarmType.kt | 12 ++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 src/main/kotlin/org/gitanimals/guild/controller/response/GuildBackgroundResponse.kt diff --git a/src/main/kotlin/org/gitanimals/guild/controller/GuildController.kt b/src/main/kotlin/org/gitanimals/guild/controller/GuildController.kt index f3357c5..fc4cb8a 100644 --- a/src/main/kotlin/org/gitanimals/guild/controller/GuildController.kt +++ b/src/main/kotlin/org/gitanimals/guild/controller/GuildController.kt @@ -3,10 +3,8 @@ package org.gitanimals.guild.controller import org.gitanimals.guild.app.* import org.gitanimals.guild.app.request.CreateGuildRequest import org.gitanimals.guild.controller.request.JoinGuildRequest -import org.gitanimals.guild.controller.response.GuildIconsResponse -import org.gitanimals.guild.controller.response.GuildPagingResponse -import org.gitanimals.guild.controller.response.GuildResponse -import org.gitanimals.guild.controller.response.GuildsResponse +import org.gitanimals.guild.controller.response.* +import org.gitanimals.guild.domain.GuildFarmType import org.gitanimals.guild.domain.GuildIcons import org.gitanimals.guild.domain.GuildService import org.gitanimals.guild.domain.SearchFilter @@ -120,6 +118,12 @@ class GuildController( ) } + @GetMapping("/guilds/backgrounds") + @ResponseStatus(HttpStatus.OK) + fun findAllGuildBackgrounds(): GuildBackgroundResponse { + return GuildBackgroundResponse(GuildFarmType.entries) + } + @PostMapping("/guilds/{guildId}/personas") fun changeMainPersona( @RequestHeader(HttpHeaders.AUTHORIZATION) token: String, diff --git a/src/main/kotlin/org/gitanimals/guild/controller/response/GuildBackgroundResponse.kt b/src/main/kotlin/org/gitanimals/guild/controller/response/GuildBackgroundResponse.kt new file mode 100644 index 0000000..4eef035 --- /dev/null +++ b/src/main/kotlin/org/gitanimals/guild/controller/response/GuildBackgroundResponse.kt @@ -0,0 +1,7 @@ +package org.gitanimals.guild.controller.response + +import org.gitanimals.guild.domain.GuildFarmType + +data class GuildBackgroundResponse( + val backgrounds: List +) diff --git a/src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt b/src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt index 6219fbe..53284ea 100644 --- a/src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt +++ b/src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt @@ -2,6 +2,18 @@ package org.gitanimals.guild.domain enum class GuildFarmType { + DUMMY { + override fun loadComponent(name: String, commit: Long): String { + return dummyGuildFieldSvg.replace(NAME_FIX, name.toSvg(0.0, 3.0)) + .replace(COMMIT_FIX, commit.toSvg("commit", 260.0, 4.0)) + } + + override fun fillBackground(): String = + "" + + override fun drawBorder(): String = + "" + }, LOGO_SHOWING { override fun loadComponent(name: String, commit: Long): String { return dummyGuildFieldSvg.replace(NAME_FIX, name.toSvg(0.0, 3.0))