diff --git a/src/main/kotlin/org/gitanimals/guild/controller/GuildController.kt b/src/main/kotlin/org/gitanimals/guild/controller/GuildController.kt index f3357c5c..fc4cb8a1 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 00000000..4eef035c --- /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 b58f1db6..53284eae 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 3d7b2cde..8e3876f9 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 00000000..ffc50fb7 --- /dev/null +++ b/src/main/resources/persona/field/logo-showing.svg @@ -0,0 +1,1313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/kotlin/org/gitanimals/guild/app/CreateGuildFacadeTest.kt b/src/test/kotlin/org/gitanimals/guild/app/CreateGuildFacadeTest.kt index 9f81c5ab..d8374ef5 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 bc10d85b..412b2d94 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 845f5546..1a1fbf11 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",