[#28] 쿠버네티스 환경 배포 #29

Merged
pricelees merged 25 commits from infra/#28 into main 2025-08-04 05:59:38 +00:00
8 changed files with 37 additions and 14 deletions
Showing only changes of commit c0c2ef21c6 - Show all commits

View File

@ -1,9 +1,11 @@
package roomescape.member.business
import com.github.f4b6a3.tsid.TsidFactory
import io.github.oshai.kotlinlogging.KotlinLogging
import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import roomescape.common.config.next
import roomescape.member.exception.MemberErrorCode
import roomescape.member.exception.MemberException
import roomescape.member.infrastructure.persistence.MemberEntity
@ -16,6 +18,7 @@ private val log = KotlinLogging.logger {}
@Service
@Transactional(readOnly = true)
class MemberService(
private val tsidFactory: TsidFactory,
private val memberRepository: MemberRepository,
) {
fun findMembers(): MemberRetrieveListResponse {
@ -46,6 +49,7 @@ class MemberService(
}
val member = MemberEntity(
_id = tsidFactory.next(),
name = request.name,
email = request.email,
password = request.password,

View File

@ -1,8 +1,10 @@
package roomescape.payment.business
import com.github.f4b6a3.tsid.TsidFactory
import io.github.oshai.kotlinlogging.KotlinLogging
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import roomescape.common.config.next
import roomescape.payment.exception.PaymentErrorCode
import roomescape.payment.exception.PaymentException
import roomescape.payment.infrastructure.client.PaymentApproveResponse
@ -21,6 +23,7 @@ private val log = KotlinLogging.logger {}
@Service
class PaymentService(
private val tsidFactory: TsidFactory,
private val paymentRepository: PaymentRepository,
private val canceledPaymentRepository: CanceledPaymentRepository,
) {
@ -31,6 +34,7 @@ class PaymentService(
): PaymentCreateResponse {
log.debug { "[PaymentService.createPayment] 결제 정보 저장 시작: request=$approveResponse, reservationId=${reservation.id}" }
val payment = PaymentEntity(
_id = tsidFactory.next(),
orderId = approveResponse.orderId,
paymentKey = approveResponse.paymentKey,
totalAmount = approveResponse.totalAmount,
@ -62,6 +66,7 @@ class PaymentService(
", cancelInfo=$cancelInfo"
}
val canceledPayment = CanceledPaymentEntity(
_id = tsidFactory.next(),
paymentKey = paymentKey,
cancelReason = cancelInfo.cancelReason,
cancelAmount = cancelInfo.cancelAmount,
@ -110,6 +115,7 @@ class PaymentService(
}
val canceledPayment = CanceledPaymentEntity(
_id = tsidFactory.next(),
paymentKey = paymentKey,
cancelReason = cancelReason,
cancelAmount = payment.totalAmount,

View File

@ -1,10 +1,12 @@
package roomescape.reservation.business
import com.github.f4b6a3.tsid.TsidFactory
import io.github.oshai.kotlinlogging.KotlinLogging
import org.springframework.data.jpa.domain.Specification
import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import roomescape.common.config.next
import roomescape.member.business.MemberService
import roomescape.member.infrastructure.persistence.MemberEntity
import roomescape.reservation.exception.ReservationErrorCode
@ -26,6 +28,7 @@ private val log = KotlinLogging.logger {}
@Service
@Transactional
class ReservationService(
private val tsidFactory: TsidFactory,
private val reservationRepository: ReservationRepository,
private val timeService: TimeService,
private val memberService: MemberService,
@ -188,6 +191,7 @@ class ReservationService(
validateDateAndTime(date, time)
return ReservationEntity(
_id = tsidFactory.next(),
date = date,
time = time,
theme = theme,

View File

@ -36,11 +36,11 @@ class ReservationSearchSpecification(
fun confirmed(): ReservationSearchSpecification = andIfNotNull { root, _, cb ->
cb.or(
cb.equal(
root.get<ReservationStatus>("reservationStatus"),
root.get<ReservationStatus>("status"),
ReservationStatus.CONFIRMED
),
cb.equal(
root.get<ReservationStatus>("reservationStatus"),
root.get<ReservationStatus>("status"),
ReservationStatus.CONFIRMED_PAYMENT_REQUIRED
)
)
@ -48,7 +48,7 @@ class ReservationSearchSpecification(
fun waiting(): ReservationSearchSpecification = andIfNotNull { root, _, cb ->
cb.equal(
root.get<ReservationStatus>("reservationStatus"),
root.get<ReservationStatus>("status"),
ReservationStatus.WAITING
)
}

View File

@ -1,20 +1,26 @@
package roomescape.theme.business
import com.github.f4b6a3.tsid.TsidFactory
import io.github.oshai.kotlinlogging.KotlinLogging
import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import roomescape.common.config.next
import roomescape.theme.exception.ThemeErrorCode
import roomescape.theme.exception.ThemeException
import roomescape.theme.infrastructure.persistence.ThemeEntity
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
private val log = KotlinLogging.logger {}
@Service
class ThemeService(
private val tsidFactory: TsidFactory,
private val themeRepository: ThemeRepository,
) {
@Transactional(readOnly = true)
@ -60,7 +66,12 @@ class ThemeService(
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)
.also { log.info { "[ThemeService.createTheme] 테마 생성 완료: themeId=${it.id}" } }
.toResponse()

View File

@ -21,12 +21,6 @@ data class ThemeCreateRequest(
val thumbnail: String
)
fun ThemeCreateRequest.toEntity(): ThemeEntity = ThemeEntity(
name = this.name,
description = this.description,
thumbnail = this.thumbnail
)
data class ThemeRetrieveResponse(
val id: Long,
val name: String,

View File

@ -1,9 +1,11 @@
package roomescape.time.business
import com.github.f4b6a3.tsid.TsidFactory
import io.github.oshai.kotlinlogging.KotlinLogging
import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import roomescape.common.config.next
import roomescape.reservation.infrastructure.persistence.ReservationEntity
import roomescape.reservation.infrastructure.persistence.ReservationRepository
import roomescape.time.exception.TimeErrorCode
@ -18,6 +20,7 @@ private val log = KotlinLogging.logger {}
@Service
class TimeService(
private val tsidFactory: TsidFactory,
private val timeRepository: TimeRepository,
private val reservationRepository: ReservationRepository,
) {
@ -50,7 +53,10 @@ class TimeService(
throw TimeException(TimeErrorCode.TIME_DUPLICATED)
}
val time: TimeEntity = request.toEntity()
val time = TimeEntity(
_id = tsidFactory.next(),
startAt = request.startAt
)
return timeRepository.save(time)
.also { log.info { "[TimeService.createTime] 시간 생성 완료: timeId=${it.id}" } }
.toCreateResponse()

View File

@ -10,8 +10,6 @@ data class TimeCreateRequest(
val startAt: LocalTime
)
fun TimeCreateRequest.toEntity(): TimeEntity = TimeEntity(startAt = this.startAt)
@Schema(name = "예약 시간 정보", description = "예약 시간 추가 및 조회 응답시 사용됩니다.")
data class TimeCreateResponse(
@Schema(description = "시간 식별자")