Skip to content

Commit

Permalink
release: 1.0.4 (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
devxb authored Dec 26, 2024
2 parents e5bbe7f + bee1bdf commit 051de19
Show file tree
Hide file tree
Showing 8 changed files with 1,349 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.gitanimals.guild.controller.response

import org.gitanimals.guild.domain.GuildFarmType

data class GuildBackgroundResponse(
val backgrounds: List<GuildFarmType>
)
15 changes: 15 additions & 0 deletions src/main/kotlin/org/gitanimals/guild/domain/GuildFarmType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ enum class GuildFarmType {
override fun drawBorder(): String =
"<rect x=\"0.5\" y=\"0.5\" width=\"599\" height=\"299\" rx=\"4.5\" stroke=\"#D9D9D9\" fill=\"none\"/>"
},
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 =
"""
<rect x="0.5" y="0.5" width="599" height="299" rx="4.5" fill="#1E1E1E"/>
$logoShowingFieldSvg
"""

override fun drawBorder(): String =
"<rect x=\"0.5\" y=\"0.5\" width=\"599\" height=\"299\" rx=\"4.5\" stroke=\"#D9D9D9\" fill=\"none\"/>"
}
;

abstract fun loadComponent(name: String, commit: Long): String
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/org/gitanimals/guild/domain/Svgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String>()
for (i in 'A'..'Z') {
Expand Down
1,313 changes: 1,313 additions & 0 deletions src/main/resources/persona/field/logo-showing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)

Expand Down
2 changes: 1 addition & 1 deletion src/test/kotlin/org/gitanimals/guild/domain/Fixture.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fun guild(
leader: Leader = leader(),
members: MutableSet<Member> = mutableSetOf(),
waitMembers: MutableSet<WaitMember> = mutableSetOf(),
farmType: GuildFarmType = GuildFarmType.DUMMY,
farmType: GuildFarmType = GuildFarmType.LOGO_SHOWING,
autoJoin: Boolean = true,
): Guild {
return Guild(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 051de19

Please sign in to comment.