Skip to content

Commit

Permalink
/colors/vivid_ios 마이그레이션
Browse files Browse the repository at this point in the history
  • Loading branch information
Hank-Choi committed Nov 6, 2024
1 parent 59122ce commit e672ee3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
18 changes: 18 additions & 0 deletions api/src/main/kotlin/router/MainRouter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ import com.wafflestudio.snu4t.router.docs.ThemeDocs
import com.wafflestudio.snu4t.router.docs.TimetableDocs
import com.wafflestudio.snu4t.router.docs.UserDocs
import com.wafflestudio.snu4t.router.docs.VacancyNotificationDocs
import kotlinx.coroutines.reactor.awaitSingle
import org.springframework.context.annotation.Bean
import org.springframework.core.io.ClassPathResource
import org.springframework.http.MediaType
import org.springframework.stereotype.Component
import org.springframework.web.reactive.function.BodyInserters
import org.springframework.web.reactive.function.server.CoRouterFunctionDsl
import org.springframework.web.reactive.function.server.ServerResponse
import org.springframework.web.reactive.function.server.buildAndAwait
Expand Down Expand Up @@ -313,6 +317,20 @@ class MainRouter(
}
}

// TODO: 웹 api 사용 확인 후 삭제
@Bean
fun legacyRouter() =
v1CoRouter {
GET("/colors/vivid_ios") {
val jsonResource = ClassPathResource("vivid_ios_color.json")
ServerResponse
.ok()
.contentType(MediaType.APPLICATION_JSON) // Content-Type 설정
.body(BodyInserters.fromResource(jsonResource))
.awaitSingle()
}
}

private fun v1CoRouter(r: CoRouterFunctionDsl.() -> Unit) =
coRouter {
path("/v1").or("").nest(r)
Expand Down
14 changes: 14 additions & 0 deletions api/src/main/resources/static/vivid_ios_color.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"colors": [
{ "fg": "#ffffff", "bg": "#e54459" },
{ "fg": "#ffffff", "bg": "#f58d3d" },
{ "fg": "#ffffff", "bg": "#fac52d" },
{ "fg": "#ffffff", "bg": "#a6d930" },
{ "fg": "#ffffff", "bg": "#2bc366" },
{ "fg": "#ffffff", "bg": "#1bd0c9" },
{ "fg": "#ffffff", "bg": "#1d99e9" },
{ "fg": "#ffffff", "bg": "#4f48c4" },
{ "fg": "#ffffff", "bg": "#af56b3" }
],
"names": ["석류", "감귤", "들국", "완두", "비취", "지중해", "하늘", "라벤더", "자수정"]
}

0 comments on commit e672ee3

Please sign in to comment.