Compare commits
2 Commits
eadbf56dae
...
c29988acf4
Author | SHA1 | Date |
---|---|---|
|
c29988acf4 | |
|
64a63fa8fa |
|
@ -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