-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from ClothingStoreService/feature/order-create
Feature/order create
- Loading branch information
Showing
65 changed files
with
660 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/org/store/clothstar/common/error/exception/NotFoundAddressException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.store.clothstar.common.error.exception | ||
|
||
import org.store.clothstar.common.error.ErrorCode | ||
|
||
class NotFoundAddressException( | ||
val errorCode: ErrorCode | ||
) : RuntimeException(errorCode.message) |
7 changes: 7 additions & 0 deletions
7
...ain/kotlin/org/store/clothstar/common/error/exception/order/InsufficientStockException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.store.clothstar.common.error.exception.order | ||
|
||
import org.store.clothstar.common.error.ErrorCode | ||
|
||
class InsufficientStockException( | ||
val errorCode: ErrorCode | ||
) : RuntimeException(errorCode.message) |
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/org/store/clothstar/common/error/exception/order/OutOfStockException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.store.clothstar.common.error.exception.order | ||
|
||
import org.store.clothstar.common.error.ErrorCode | ||
|
||
class OutOfStockException( | ||
val errorCode: ErrorCode | ||
) : RuntimeException(errorCode.message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/kotlin/org/store/clothstar/order/controller/OrderUserController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package org.store.clothstar.order.controller | ||
|
||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.media.Content | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses | ||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import org.springframework.http.HttpStatus | ||
import org.springframework.http.ResponseEntity | ||
import org.springframework.validation.annotation.Validated | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
import org.store.clothstar.common.dto.ErrorResponseDTO | ||
import org.store.clothstar.common.dto.MessageDTO | ||
import org.store.clothstar.order.dto.request.OrderRequestWrapper | ||
import org.store.clothstar.order.dto.response.SaveOrderResponse | ||
import org.store.clothstar.order.service.OrderService | ||
|
||
@Tag(name = "Order", description = "주문(Order) 정보 관리에 대한 API 입니다.") | ||
@RestController | ||
@RequestMapping("/v1/orders") | ||
class OrderUserController( | ||
private val orderService: OrderService | ||
) { | ||
@Operation(summary = "주문 생성", description = "단일 주문을 생성한다.") | ||
@ApiResponses( | ||
value = [ | ||
ApiResponse( | ||
responseCode = "200", description = "주문이 정상적으로 생성되었습니다.", | ||
content = [Content(schema = Schema(implementation = SaveOrderResponse::class))] | ||
), | ||
ApiResponse( | ||
responseCode = "400", description = "품절된 상품입니다.", | ||
content = [Content(schema = Schema(implementation = ErrorResponseDTO::class))] | ||
), | ||
ApiResponse( | ||
responseCode = "400", description = "주문 개수가 상품 재고보다 더 많아 요청을 처리할 수 없습니다.", | ||
content = [Content(schema = Schema(implementation = ErrorResponseDTO::class))] | ||
), | ||
] | ||
) | ||
@PostMapping | ||
fun saveOrder(@RequestBody @Validated orderRequestWrapper: OrderRequestWrapper): ResponseEntity<SaveOrderResponse> { | ||
val orderId: String = orderService.saveOrder(orderRequestWrapper) | ||
val saveOrderResponse = SaveOrderResponse(orderId, HttpStatus.OK.value(), "주문이 정상적으로 생성되었습니다.") | ||
return ResponseEntity.ok(saveOrderResponse) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.