Skip to content

Commit

Permalink
release v1.1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Sep 13, 2024
2 parents 053a4fd + 030add2 commit a8647b9
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ object SwaggerTag {
const val DEV_SWAGGER_TAG = "DEV API"
const val DEV_OAUTH_SWAGGER_TAG = "DEV OAuth API"
const val DEV_BATCH_SWAGGER_TAG = "DEV Batch API"
const val DEV_ENVELOPE_SWAGGER_TAG = "DEV Envelope API"
const val ENVELOPE_CONFIG_SWAGGER_TAG = "Envelope Config API"
const val ENVELOPE_SWAGGER_TAG = "Envelope API"
const val FRIEND_SWAGGER_TAG = "Friend API"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,15 @@ class EnvelopeFacade(
request: SearchEnvelopeRequest,
pageRequest: SusuPageRequest,
): Page<SearchEnvelopeResponse> {
val response = envelopeService.search(resolveSearchSpec(user, request), pageRequest.toDefault())
return search(user.uid, request, pageRequest)
}

suspend fun search(
uid: Long,
request: SearchEnvelopeRequest,
pageRequest: SusuPageRequest,
): Page<SearchEnvelopeResponse> {
val response = envelopeService.search(resolveSearchSpec(uid, request), pageRequest.toDefault())

return response.map { (envelope, friend, friendRelationship, categoryAssignments) ->
val category = categoryAssignments?.let { categoryAssignment ->
Expand All @@ -257,9 +265,9 @@ class EnvelopeFacade(
}
}

private fun resolveSearchSpec(user: AuthUser, request: SearchEnvelopeRequest): SearchEnvelopeSpec {
private fun resolveSearchSpec(uid: Long, request: SearchEnvelopeRequest): SearchEnvelopeSpec {
return SearchEnvelopeSpec(
uid = user.uid,
uid = uid,
friendId = request.friendIds,
friendName = request.friendName,
ledgerId = request.ledgerId,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.oksusu.susu.api.envelope.model.request

import com.oksusu.susu.api.envelope.model.request.SearchEnvelopeRequest.IncludeSpec
import com.oksusu.susu.domain.envelope.domain.vo.EnvelopeType

data class DevSearchEnvelopeRequest(
/** 검색할 uid */
val uid: Long,
/** 지인 id */
val friendIds: Set<Long>?,
/** 지인 이름 */
val friendName: String?,
/** 장부 id */
val ledgerId: Long?,
/** type: SENT, RECEIVED */
val types: Set<EnvelopeType>?,
/** 포함할 데이터 목록 */
val include: Set<IncludeSpec>?,
/** 금액 조건 from */
val fromAmount: Long?,
/** 금액 조건 to */
val toAmount: Long?,
) {
fun convert(): SearchEnvelopeRequest {
return SearchEnvelopeRequest(
friendIds = this.friendIds,
friendName = this.friendName,
ledgerId = this.ledgerId,
types = this.types,
include = this.include,
fromAmount = this.fromAmount,
toAmount = this.toAmount
)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.oksusu.susu.api.envelope.presentation

import com.oksusu.susu.api.auth.model.AdminUser
import com.oksusu.susu.api.common.dto.SusuPageRequest
import com.oksusu.susu.api.config.web.SwaggerTag
import com.oksusu.susu.api.envelope.application.EnvelopeFacade
import com.oksusu.susu.api.envelope.model.request.DevSearchEnvelopeRequest
import com.oksusu.susu.api.extension.wrapPage
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import org.springdoc.core.annotations.ParameterObject
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@Tag(name = SwaggerTag.DEV_ENVELOPE_SWAGGER_TAG, description = "개발용 OAuth API")
@RestController
@RequestMapping(value = ["/api/v1/dev/envelopes"], produces = [MediaType.APPLICATION_JSON_VALUE])
class DevEnvelopeResource(
private val envelopeFacade: EnvelopeFacade,
) {
@Operation(tags = [SwaggerTag.DEV_SWAGGER_TAG], summary = "hour summary 호출")
@GetMapping("/hour-summaries")
suspend fun getHourSummaries(
adminUser: AdminUser,
@ParameterObject request: DevSearchEnvelopeRequest,
@ParameterObject pageRequest: SusuPageRequest,
) = envelopeFacade.search(
uid = request.uid,
request = request.convert(),
pageRequest = pageRequest
).wrapPage()
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ class DiscordClientConfig(

@Bean
fun discordClient(): DiscordClient {
val webClient = WebClientFactory.generate(baseUrl = DISCORD_WEBHOOKS_DOMAIN)
val webClient = WebClientFactory.generate(
baseUrl = DISCORD_WEBHOOKS_DOMAIN,
connectionTimeoutMillis = 2000,
readTimeoutMillis = 2000,
writeTimeoutMillis = 2000
)
logger.info { "initialized discord client" }
return SuspendableDiscordClient(webClient, webhookConfig, cacheService)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ import org.springframework.web.reactive.function.client.awaitBody
internal class DiscordService {
companion object {
private const val DISCORD_WEBHOOKS_DOMAIN = "https://discord.com/api/webhooks"
private val webClient = WebClientFactory.generate(baseUrl = DISCORD_WEBHOOKS_DOMAIN)
private val webClient = WebClientFactory.generate(
baseUrl = DISCORD_WEBHOOKS_DOMAIN,
connectionTimeoutMillis = 2000,
readTimeoutMillis = 2000,
writeTimeoutMillis = 2000
)

fun sendMessage(message: DiscordMessageModel, token: String) {
CoroutineScope(Dispatchers.IO).launch {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=1.1.15
version=1.1.16
kotlin.code.style=official

0 comments on commit a8647b9

Please sign in to comment.