Merge pull request '콘텐츠 주문 - 대여만 가능한 콘텐츠의 경우 소장으로 주문이 들어오더라도 대여로 처리되도록 로직 수정' (#62) from test into main
Reviewed-on: #62
This commit is contained in:
commit
c29988acf4
|
@ -27,10 +27,15 @@ class OrderService(
|
||||||
) {
|
) {
|
||||||
@Transactional
|
@Transactional
|
||||||
fun order(contentId: Long, orderType: OrderType, container: String, member: Member) {
|
fun order(contentId: Long, orderType: OrderType, container: String, member: Member) {
|
||||||
val order = Order(type = orderType)
|
|
||||||
val content = audioContentRepository.findByIdAndActive(contentId)
|
val content = audioContentRepository.findByIdAndActive(contentId)
|
||||||
?: throw SodaException("잘못된 콘텐츠 입니다\n다시 시도해 주세요.")
|
?: throw SodaException("잘못된 콘텐츠 입니다\n다시 시도해 주세요.")
|
||||||
|
|
||||||
|
val order = if (content.isOnlyRental) {
|
||||||
|
Order(type = OrderType.RENTAL)
|
||||||
|
} else {
|
||||||
|
Order(type = orderType)
|
||||||
|
}
|
||||||
|
|
||||||
if (member.id!! == content.member!!.id!!) throw SodaException("자신이 올린 콘텐츠는 구매할 수 없습니다.")
|
if (member.id!! == content.member!!.id!!) throw SodaException("자신이 올린 콘텐츠는 구매할 수 없습니다.")
|
||||||
if (repository.isExistOrdered(memberId = member.id!!, contentId = contentId)) {
|
if (repository.isExistOrdered(memberId = member.id!!, contentId = contentId)) {
|
||||||
throw SodaException("이미 구매한 콘텐츠 입니다.")
|
throw SodaException("이미 구매한 콘텐츠 입니다.")
|
||||||
|
|
Loading…
Reference in New Issue