Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface ConfigProxy {
suspend fun getUserConfig(token: String): UserWebConfig
suspend fun updateUserConfig(token: String, request: UpdateUserConfigRequest): UserWebConfig
suspend fun getUserFavoritePair(token: String): Set<String>
suspend fun addUserFavoritePair(token: String, pairs: Set<String>): Set<String>
suspend fun removeUserFavoritePair(token: String, pairs: Set<String>): Set<String>
suspend fun addUserFavoritePair(token: String, pair: String): Set<String>
suspend fun removeUserFavoritePair(token: String, pair: String): Set<String>

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ class ConfigController(private val configProxy: ConfigProxy) {
return configProxy.getUserFavoritePair(securityContext.jwtAuthentication().tokenValue())
}

@PostMapping("/user/config/pair")
@PostMapping("/user/config/pair/{pair}")
suspend fun addUserFavoritePair(
@CurrentSecurityContext securityContext: SecurityContext,
@RequestBody pairs: Set<String>
@PathVariable pair: String
): Set<String> {
return configProxy.addUserFavoritePair(securityContext.jwtAuthentication().tokenValue(), pairs)
return configProxy.addUserFavoritePair(securityContext.jwtAuthentication().tokenValue(), pair)
}

@DeleteMapping("/user/config/pair")
@DeleteMapping("/user/config/pair/{pair}")
suspend fun removeUserFavoritePair(
@CurrentSecurityContext securityContext: SecurityContext,
@RequestBody pairs: Set<String>
@PathVariable pair: String
): Set<String> {
return configProxy.removeUserFavoritePair(securityContext.jwtAuthentication().tokenValue(), pairs)
return configProxy.removeUserFavoritePair(securityContext.jwtAuthentication().tokenValue(), pair)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,12 @@ class ConfigProxyImpl(@Qualifier("generalWebClient") private val webClient: WebC

override suspend fun addUserFavoritePair(
token: String,
pairs: Set<String>
pair: String
): Set<String> {
return webClient.post()
.uri("$baseUrl/user/v1/pair")
.uri("$baseUrl/user/v1/pair/${pair}")
.accept(MediaType.APPLICATION_JSON)
.header(HttpHeaders.AUTHORIZATION, "Bearer $token")
.body(Mono.just(pairs))
.retrieve()
.onStatus({ t -> t.isError }, { it.createException() })
.bodyToMono<Set<String>>()
Expand All @@ -155,14 +154,13 @@ class ConfigProxyImpl(@Qualifier("generalWebClient") private val webClient: WebC

override suspend fun removeUserFavoritePair(
token: String,
pairs: Set<String>
pair: String
): Set<String> {
return webClient.method(HttpMethod.DELETE)
.uri("$baseUrl/user/v1/pair")
.uri("$baseUrl/user/v1/pair/${pair}")
.contentType(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.header(HttpHeaders.AUTHORIZATION, "Bearer $token")
.bodyValue(pairs)
.retrieve()
.onStatus({ it.isError }) { it.createException() }
.bodyToMono<Set<String>>()
Expand Down
Loading