Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/colors/vivid_ios 마이그레이션 #296

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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("static/color_vivid_ios.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/color_vivid_ios.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": ["석류", "감귤", "들국", "완두", "비취", "지중해", "하늘", "라벤더", "자수정"]
}
Loading