generated from pricelees/issue-pr-template
[#28] 쿠버네티스 환경 배포 #29
@ -1,9 +1,11 @@
|
|||||||
package roomescape.member.business
|
package roomescape.member.business
|
||||||
|
|
||||||
|
import com.github.f4b6a3.tsid.TsidFactory
|
||||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||||
import org.springframework.data.repository.findByIdOrNull
|
import org.springframework.data.repository.findByIdOrNull
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import org.springframework.transaction.annotation.Transactional
|
import org.springframework.transaction.annotation.Transactional
|
||||||
|
import roomescape.common.config.next
|
||||||
import roomescape.member.exception.MemberErrorCode
|
import roomescape.member.exception.MemberErrorCode
|
||||||
import roomescape.member.exception.MemberException
|
import roomescape.member.exception.MemberException
|
||||||
import roomescape.member.infrastructure.persistence.MemberEntity
|
import roomescape.member.infrastructure.persistence.MemberEntity
|
||||||
@ -16,6 +18,7 @@ private val log = KotlinLogging.logger {}
|
|||||||
@Service
|
@Service
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
class MemberService(
|
class MemberService(
|
||||||
|
private val tsidFactory: TsidFactory,
|
||||||
private val memberRepository: MemberRepository,
|
private val memberRepository: MemberRepository,
|
||||||
) {
|
) {
|
||||||
fun findMembers(): MemberRetrieveListResponse {
|
fun findMembers(): MemberRetrieveListResponse {
|
||||||
@ -46,6 +49,7 @@ class MemberService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val member = MemberEntity(
|
val member = MemberEntity(
|
||||||
|
_id = tsidFactory.next(),
|
||||||
name = request.name,
|
name = request.name,
|
||||||
email = request.email,
|
email = request.email,
|
||||||
password = request.password,
|
password = request.password,
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
package roomescape.payment.business
|
package roomescape.payment.business
|
||||||
|
|
||||||
|
import com.github.f4b6a3.tsid.TsidFactory
|
||||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import org.springframework.transaction.annotation.Transactional
|
import org.springframework.transaction.annotation.Transactional
|
||||||
|
import roomescape.common.config.next
|
||||||
import roomescape.payment.exception.PaymentErrorCode
|
import roomescape.payment.exception.PaymentErrorCode
|
||||||
import roomescape.payment.exception.PaymentException
|
import roomescape.payment.exception.PaymentException
|
||||||
import roomescape.payment.infrastructure.client.PaymentApproveResponse
|
import roomescape.payment.infrastructure.client.PaymentApproveResponse
|
||||||
@ -21,6 +23,7 @@ private val log = KotlinLogging.logger {}
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
class PaymentService(
|
class PaymentService(
|
||||||
|
private val tsidFactory: TsidFactory,
|
||||||
private val paymentRepository: PaymentRepository,
|
private val paymentRepository: PaymentRepository,
|
||||||
private val canceledPaymentRepository: CanceledPaymentRepository,
|
private val canceledPaymentRepository: CanceledPaymentRepository,
|
||||||
) {
|
) {
|
||||||
@ -31,6 +34,7 @@ class PaymentService(
|
|||||||
): PaymentCreateResponse {
|
): PaymentCreateResponse {
|
||||||
log.debug { "[PaymentService.createPayment] 결제 정보 저장 시작: request=$approveResponse, reservationId=${reservation.id}" }
|
log.debug { "[PaymentService.createPayment] 결제 정보 저장 시작: request=$approveResponse, reservationId=${reservation.id}" }
|
||||||
val payment = PaymentEntity(
|
val payment = PaymentEntity(
|
||||||
|
_id = tsidFactory.next(),
|
||||||
orderId = approveResponse.orderId,
|
orderId = approveResponse.orderId,
|
||||||
paymentKey = approveResponse.paymentKey,
|
paymentKey = approveResponse.paymentKey,
|
||||||
totalAmount = approveResponse.totalAmount,
|
totalAmount = approveResponse.totalAmount,
|
||||||
@ -62,6 +66,7 @@ class PaymentService(
|
|||||||
", cancelInfo=$cancelInfo"
|
", cancelInfo=$cancelInfo"
|
||||||
}
|
}
|
||||||
val canceledPayment = CanceledPaymentEntity(
|
val canceledPayment = CanceledPaymentEntity(
|
||||||
|
_id = tsidFactory.next(),
|
||||||
paymentKey = paymentKey,
|
paymentKey = paymentKey,
|
||||||
cancelReason = cancelInfo.cancelReason,
|
cancelReason = cancelInfo.cancelReason,
|
||||||
cancelAmount = cancelInfo.cancelAmount,
|
cancelAmount = cancelInfo.cancelAmount,
|
||||||
@ -110,6 +115,7 @@ class PaymentService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val canceledPayment = CanceledPaymentEntity(
|
val canceledPayment = CanceledPaymentEntity(
|
||||||
|
_id = tsidFactory.next(),
|
||||||
paymentKey = paymentKey,
|
paymentKey = paymentKey,
|
||||||
cancelReason = cancelReason,
|
cancelReason = cancelReason,
|
||||||
cancelAmount = payment.totalAmount,
|
cancelAmount = payment.totalAmount,
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
package roomescape.reservation.business
|
package roomescape.reservation.business
|
||||||
|
|
||||||
|
import com.github.f4b6a3.tsid.TsidFactory
|
||||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||||
import org.springframework.data.jpa.domain.Specification
|
import org.springframework.data.jpa.domain.Specification
|
||||||
import org.springframework.data.repository.findByIdOrNull
|
import org.springframework.data.repository.findByIdOrNull
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import org.springframework.transaction.annotation.Transactional
|
import org.springframework.transaction.annotation.Transactional
|
||||||
|
import roomescape.common.config.next
|
||||||
import roomescape.member.business.MemberService
|
import roomescape.member.business.MemberService
|
||||||
import roomescape.member.infrastructure.persistence.MemberEntity
|
import roomescape.member.infrastructure.persistence.MemberEntity
|
||||||
import roomescape.reservation.exception.ReservationErrorCode
|
import roomescape.reservation.exception.ReservationErrorCode
|
||||||
@ -26,6 +28,7 @@ private val log = KotlinLogging.logger {}
|
|||||||
@Service
|
@Service
|
||||||
@Transactional
|
@Transactional
|
||||||
class ReservationService(
|
class ReservationService(
|
||||||
|
private val tsidFactory: TsidFactory,
|
||||||
private val reservationRepository: ReservationRepository,
|
private val reservationRepository: ReservationRepository,
|
||||||
private val timeService: TimeService,
|
private val timeService: TimeService,
|
||||||
private val memberService: MemberService,
|
private val memberService: MemberService,
|
||||||
@ -188,6 +191,7 @@ class ReservationService(
|
|||||||
validateDateAndTime(date, time)
|
validateDateAndTime(date, time)
|
||||||
|
|
||||||
return ReservationEntity(
|
return ReservationEntity(
|
||||||
|
_id = tsidFactory.next(),
|
||||||
date = date,
|
date = date,
|
||||||
time = time,
|
time = time,
|
||||||
theme = theme,
|
theme = theme,
|
||||||
|
|||||||
@ -36,11 +36,11 @@ class ReservationSearchSpecification(
|
|||||||
fun confirmed(): ReservationSearchSpecification = andIfNotNull { root, _, cb ->
|
fun confirmed(): ReservationSearchSpecification = andIfNotNull { root, _, cb ->
|
||||||
cb.or(
|
cb.or(
|
||||||
cb.equal(
|
cb.equal(
|
||||||
root.get<ReservationStatus>("reservationStatus"),
|
root.get<ReservationStatus>("status"),
|
||||||
ReservationStatus.CONFIRMED
|
ReservationStatus.CONFIRMED
|
||||||
),
|
),
|
||||||
cb.equal(
|
cb.equal(
|
||||||
root.get<ReservationStatus>("reservationStatus"),
|
root.get<ReservationStatus>("status"),
|
||||||
ReservationStatus.CONFIRMED_PAYMENT_REQUIRED
|
ReservationStatus.CONFIRMED_PAYMENT_REQUIRED
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -48,7 +48,7 @@ class ReservationSearchSpecification(
|
|||||||
|
|
||||||
fun waiting(): ReservationSearchSpecification = andIfNotNull { root, _, cb ->
|
fun waiting(): ReservationSearchSpecification = andIfNotNull { root, _, cb ->
|
||||||
cb.equal(
|
cb.equal(
|
||||||
root.get<ReservationStatus>("reservationStatus"),
|
root.get<ReservationStatus>("status"),
|
||||||
ReservationStatus.WAITING
|
ReservationStatus.WAITING
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,20 +1,26 @@
|
|||||||
package roomescape.theme.business
|
package roomescape.theme.business
|
||||||
|
|
||||||
|
import com.github.f4b6a3.tsid.TsidFactory
|
||||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||||
import org.springframework.data.repository.findByIdOrNull
|
import org.springframework.data.repository.findByIdOrNull
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import org.springframework.transaction.annotation.Transactional
|
import org.springframework.transaction.annotation.Transactional
|
||||||
|
import roomescape.common.config.next
|
||||||
import roomescape.theme.exception.ThemeErrorCode
|
import roomescape.theme.exception.ThemeErrorCode
|
||||||
import roomescape.theme.exception.ThemeException
|
import roomescape.theme.exception.ThemeException
|
||||||
import roomescape.theme.infrastructure.persistence.ThemeEntity
|
import roomescape.theme.infrastructure.persistence.ThemeEntity
|
||||||
import roomescape.theme.infrastructure.persistence.ThemeRepository
|
import roomescape.theme.infrastructure.persistence.ThemeRepository
|
||||||
import roomescape.theme.web.*
|
import roomescape.theme.web.ThemeCreateRequest
|
||||||
|
import roomescape.theme.web.ThemeRetrieveListResponse
|
||||||
|
import roomescape.theme.web.ThemeRetrieveResponse
|
||||||
|
import roomescape.theme.web.toResponse
|
||||||
import java.time.LocalDate
|
import java.time.LocalDate
|
||||||
|
|
||||||
private val log = KotlinLogging.logger {}
|
private val log = KotlinLogging.logger {}
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
class ThemeService(
|
class ThemeService(
|
||||||
|
private val tsidFactory: TsidFactory,
|
||||||
private val themeRepository: ThemeRepository,
|
private val themeRepository: ThemeRepository,
|
||||||
) {
|
) {
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
@ -60,7 +66,12 @@ class ThemeService(
|
|||||||
throw ThemeException(ThemeErrorCode.THEME_NAME_DUPLICATED)
|
throw ThemeException(ThemeErrorCode.THEME_NAME_DUPLICATED)
|
||||||
}
|
}
|
||||||
|
|
||||||
val theme: ThemeEntity = request.toEntity()
|
val theme = ThemeEntity(
|
||||||
|
_id = tsidFactory.next(),
|
||||||
|
name = request.name,
|
||||||
|
description = request.description,
|
||||||
|
thumbnail = request.thumbnail
|
||||||
|
)
|
||||||
return themeRepository.save(theme)
|
return themeRepository.save(theme)
|
||||||
.also { log.info { "[ThemeService.createTheme] 테마 생성 완료: themeId=${it.id}" } }
|
.also { log.info { "[ThemeService.createTheme] 테마 생성 완료: themeId=${it.id}" } }
|
||||||
.toResponse()
|
.toResponse()
|
||||||
|
|||||||
@ -21,12 +21,6 @@ data class ThemeCreateRequest(
|
|||||||
val thumbnail: String
|
val thumbnail: String
|
||||||
)
|
)
|
||||||
|
|
||||||
fun ThemeCreateRequest.toEntity(): ThemeEntity = ThemeEntity(
|
|
||||||
name = this.name,
|
|
||||||
description = this.description,
|
|
||||||
thumbnail = this.thumbnail
|
|
||||||
)
|
|
||||||
|
|
||||||
data class ThemeRetrieveResponse(
|
data class ThemeRetrieveResponse(
|
||||||
val id: Long,
|
val id: Long,
|
||||||
val name: String,
|
val name: String,
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
package roomescape.time.business
|
package roomescape.time.business
|
||||||
|
|
||||||
|
import com.github.f4b6a3.tsid.TsidFactory
|
||||||
import io.github.oshai.kotlinlogging.KotlinLogging
|
import io.github.oshai.kotlinlogging.KotlinLogging
|
||||||
import org.springframework.data.repository.findByIdOrNull
|
import org.springframework.data.repository.findByIdOrNull
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import org.springframework.transaction.annotation.Transactional
|
import org.springframework.transaction.annotation.Transactional
|
||||||
|
import roomescape.common.config.next
|
||||||
import roomescape.reservation.infrastructure.persistence.ReservationEntity
|
import roomescape.reservation.infrastructure.persistence.ReservationEntity
|
||||||
import roomescape.reservation.infrastructure.persistence.ReservationRepository
|
import roomescape.reservation.infrastructure.persistence.ReservationRepository
|
||||||
import roomescape.time.exception.TimeErrorCode
|
import roomescape.time.exception.TimeErrorCode
|
||||||
@ -18,6 +20,7 @@ private val log = KotlinLogging.logger {}
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
class TimeService(
|
class TimeService(
|
||||||
|
private val tsidFactory: TsidFactory,
|
||||||
private val timeRepository: TimeRepository,
|
private val timeRepository: TimeRepository,
|
||||||
private val reservationRepository: ReservationRepository,
|
private val reservationRepository: ReservationRepository,
|
||||||
) {
|
) {
|
||||||
@ -50,7 +53,10 @@ class TimeService(
|
|||||||
throw TimeException(TimeErrorCode.TIME_DUPLICATED)
|
throw TimeException(TimeErrorCode.TIME_DUPLICATED)
|
||||||
}
|
}
|
||||||
|
|
||||||
val time: TimeEntity = request.toEntity()
|
val time = TimeEntity(
|
||||||
|
_id = tsidFactory.next(),
|
||||||
|
startAt = request.startAt
|
||||||
|
)
|
||||||
return timeRepository.save(time)
|
return timeRepository.save(time)
|
||||||
.also { log.info { "[TimeService.createTime] 시간 생성 완료: timeId=${it.id}" } }
|
.also { log.info { "[TimeService.createTime] 시간 생성 완료: timeId=${it.id}" } }
|
||||||
.toCreateResponse()
|
.toCreateResponse()
|
||||||
|
|||||||
@ -10,8 +10,6 @@ data class TimeCreateRequest(
|
|||||||
val startAt: LocalTime
|
val startAt: LocalTime
|
||||||
)
|
)
|
||||||
|
|
||||||
fun TimeCreateRequest.toEntity(): TimeEntity = TimeEntity(startAt = this.startAt)
|
|
||||||
|
|
||||||
@Schema(name = "예약 시간 정보", description = "예약 시간 추가 및 조회 응답시 사용됩니다.")
|
@Schema(name = "예약 시간 정보", description = "예약 시간 추가 및 조회 응답시 사용됩니다.")
|
||||||
data class TimeCreateResponse(
|
data class TimeCreateResponse(
|
||||||
@Schema(description = "시간 식별자")
|
@Schema(description = "시간 식별자")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user