Skip to content

Commit b89c2cc

Browse files
committed
feat: 루트 구매 API 응답 형식 변경�
https://routeboxhq.slack.com/archives/C076T7LUT6C/p1743412855345879
1 parent 89414e1 commit b89c2cc

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

src/main/kotlin/com/routebox/routebox/controller/route/RouteController.kt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.routebox.routebox.application.route.dto.GetLatestRoutesCommand
88
import com.routebox.routebox.application.route.dto.PurchaseRouteCommand
99
import com.routebox.routebox.controller.route.dto.GetLatestRoutesResponse
1010
import com.routebox.routebox.controller.route.dto.PurchaseRouteRequest
11+
import com.routebox.routebox.controller.route.dto.PurchaseRouteResponse
1112
import com.routebox.routebox.controller.route.dto.RouteDetailResponse
1213
import com.routebox.routebox.controller.route.dto.RouteResponse
1314
import com.routebox.routebox.security.UserPrincipal
@@ -17,7 +18,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse
1718
import io.swagger.v3.oas.annotations.responses.ApiResponses
1819
import io.swagger.v3.oas.annotations.security.SecurityRequirement
1920
import io.swagger.v3.oas.annotations.tags.Tag
20-
import org.springframework.http.ResponseEntity
2121
import org.springframework.security.core.annotation.AuthenticationPrincipal
2222
import org.springframework.validation.annotation.Validated
2323
import org.springframework.web.bind.annotation.GetMapping
@@ -52,7 +52,13 @@ class RouteController(
5252
@RequestParam(defaultValue = "0") page: Int,
5353
@RequestParam(defaultValue = "10") size: Int,
5454
): GetLatestRoutesResponse {
55-
val routeResponses = getLatestRoutesUseCase(GetLatestRoutesCommand(userPrincipal.userId, page, size)).map { RouteResponse.from(it) }
55+
val routeResponses = getLatestRoutesUseCase(
56+
GetLatestRoutesCommand(
57+
userPrincipal.userId,
58+
page,
59+
size,
60+
),
61+
).map { RouteResponse.from(it) }
5662
return GetLatestRoutesResponse.from(routeResponses)
5763
}
5864

@@ -98,22 +104,22 @@ class RouteController(
98104
security = [SecurityRequirement(name = "access-token")],
99105
)
100106
@ApiResponses(
101-
ApiResponse(responseCode = "204"),
107+
ApiResponse(responseCode = "200"),
102108
ApiResponse(responseCode = "400", description = "[3003] (쿠폰으로 구매 시) 이용 가능한 쿠폰이 없는 경우", content = [Content()]),
103109
)
104110
@PostMapping("/v1/routes/{routeId}/purchase")
105111
fun purchaseRoute(
106112
@AuthenticationPrincipal userPrincipal: UserPrincipal,
107113
@PathVariable routeId: Long,
108114
@RequestBody request: PurchaseRouteRequest,
109-
): ResponseEntity<Unit> {
115+
): PurchaseRouteResponse {
110116
purchaseRouteUseCase(
111117
PurchaseRouteCommand(
112118
buyerId = userPrincipal.userId,
113119
routeId = routeId,
114120
paymentMethod = request.paymentMethod,
115121
),
116122
)
117-
return ResponseEntity.noContent().build()
123+
return PurchaseRouteResponse(true)
118124
}
119125
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.routebox.routebox.controller.route.dto
2+
3+
data class PurchaseRouteResponse(
4+
val isSuccess: Boolean,
5+
)

0 commit comments

Comments
 (0)