generated from pricelees/issue-pr-template
style: import 정리 & 코드 포맷 정렬
This commit is contained in:
parent
cb14e1d6a5
commit
865026aff2
@ -42,7 +42,7 @@ abstract class PersistableBaseEntity(
|
||||
|
||||
@Transient
|
||||
private var isNewEntity: Boolean = true
|
||||
): Persistable<Long> {
|
||||
) : Persistable<Long> {
|
||||
@PostLoad
|
||||
@PostPersist
|
||||
fun markNotNew() {
|
||||
|
||||
@ -18,22 +18,18 @@ abstract class AuditingBaseEntity(
|
||||
@Column(updatable = false)
|
||||
@CreatedDate
|
||||
lateinit var createdAt: LocalDateTime
|
||||
protected set
|
||||
|
||||
@Column(updatable = false)
|
||||
@CreatedBy
|
||||
var createdBy: Long = 0L
|
||||
protected set
|
||||
|
||||
@Column
|
||||
@LastModifiedDate
|
||||
lateinit var updatedAt: LocalDateTime
|
||||
protected set
|
||||
|
||||
@Column
|
||||
@LastModifiedBy
|
||||
var updatedBy: Long = 0L
|
||||
protected set
|
||||
}
|
||||
|
||||
@MappedSuperclass
|
||||
|
||||
@ -57,7 +57,7 @@ class ControllerLoggingAspect(
|
||||
)
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
convertResponseMessageRequest = convertResponseMessageRequest.copy(
|
||||
convertResponseMessageRequest = convertResponseMessageRequest.copy(
|
||||
body = responseEntity.body
|
||||
)
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ class MemberEntity(
|
||||
@Column(name = "role", nullable = false, length = 20)
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
var role: Role
|
||||
): BaseEntity() {
|
||||
) : BaseEntity() {
|
||||
override fun getId(): Long? = _id
|
||||
|
||||
fun isAdmin(): Boolean = role == Role.ADMIN
|
||||
|
||||
@ -10,19 +10,8 @@ import roomescape.payment.exception.PaymentException
|
||||
import roomescape.payment.infrastructure.client.PaymentClientCancelResponse
|
||||
import roomescape.payment.infrastructure.client.PaymentClientConfirmResponse
|
||||
import roomescape.payment.infrastructure.client.TosspayClient
|
||||
import roomescape.payment.infrastructure.persistence.CanceledPaymentEntity
|
||||
import roomescape.payment.infrastructure.persistence.CanceledPaymentRepository
|
||||
import roomescape.payment.infrastructure.persistence.PaymentDetailEntity
|
||||
import roomescape.payment.infrastructure.persistence.PaymentDetailRepository
|
||||
import roomescape.payment.infrastructure.persistence.PaymentEntity
|
||||
import roomescape.payment.infrastructure.persistence.PaymentRepository
|
||||
import roomescape.payment.web.PaymentCancelRequest
|
||||
import roomescape.payment.web.PaymentConfirmRequest
|
||||
import roomescape.payment.web.PaymentCreateResponse
|
||||
import roomescape.payment.web.PaymentRetrieveResponse
|
||||
import roomescape.payment.web.toCancelDetailResponse
|
||||
import roomescape.payment.web.toPaymentDetailResponse
|
||||
import roomescape.payment.web.toRetrieveResponse
|
||||
import roomescape.payment.infrastructure.persistence.*
|
||||
import roomescape.payment.web.*
|
||||
|
||||
private val log: KLogger = KotlinLogging.logger {}
|
||||
|
||||
|
||||
@ -10,12 +10,7 @@ import roomescape.payment.exception.PaymentException
|
||||
import roomescape.payment.infrastructure.client.*
|
||||
import roomescape.payment.infrastructure.common.PaymentMethod
|
||||
import roomescape.payment.infrastructure.common.PaymentType
|
||||
import roomescape.payment.infrastructure.persistence.CanceledPaymentEntity
|
||||
import roomescape.payment.infrastructure.persistence.CanceledPaymentRepository
|
||||
import roomescape.payment.infrastructure.persistence.PaymentDetailEntity
|
||||
import roomescape.payment.infrastructure.persistence.PaymentDetailRepository
|
||||
import roomescape.payment.infrastructure.persistence.PaymentEntity
|
||||
import roomescape.payment.infrastructure.persistence.PaymentRepository
|
||||
import roomescape.payment.infrastructure.persistence.*
|
||||
import java.time.LocalDateTime
|
||||
|
||||
private val log: KLogger = KotlinLogging.logger {}
|
||||
|
||||
@ -61,7 +61,7 @@ private class ConfirmClient(
|
||||
|
||||
private val errorHandler: TosspayErrorHandler = TosspayErrorHandler(objectMapper)
|
||||
|
||||
fun request(paymentKey: String, orderId: String, amount: Int): PaymentClientConfirmResponse {
|
||||
fun request(paymentKey: String, orderId: String, amount: Int): PaymentClientConfirmResponse {
|
||||
val response = client.post()
|
||||
.uri(CONFIRM_URI)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
|
||||
@ -23,9 +23,9 @@ enum class PaymentType(
|
||||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
||||
fun get(name: String): PaymentType {
|
||||
return CACHE[name.uppercase()] ?: run {
|
||||
log.warn { "[PaymentTypes.PaymentType] 결제 타입 조회 실패: type=$name" }
|
||||
throw PaymentException(PaymentErrorCode.TYPE_NOT_FOUND)
|
||||
}
|
||||
log.warn { "[PaymentTypes.PaymentType] 결제 타입 조회 실패: type=$name" }
|
||||
throw PaymentException(PaymentErrorCode.TYPE_NOT_FOUND)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,9 +163,9 @@ enum class BankCode(
|
||||
val parsedCode = if (code.length == 2) "0$code" else code
|
||||
|
||||
return CACHE[parsedCode] ?: run {
|
||||
log.error { "[PaymentCode.BankCode] 은행 코드 조회 실패: code=$code" }
|
||||
throw PaymentException(PaymentErrorCode.ORGANIZATION_CODE_NOT_FOUND)
|
||||
}
|
||||
log.error { "[PaymentCode.BankCode] 은행 코드 조회 실패: code=$code" }
|
||||
throw PaymentException(PaymentErrorCode.ORGANIZATION_CODE_NOT_FOUND)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -207,9 +207,9 @@ enum class CardIssuerCode(
|
||||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
||||
fun get(code: String): CardIssuerCode {
|
||||
return CACHE[code] ?: run {
|
||||
log.error { "[PaymentCode.CardIssuerCode] 카드사 코드 조회 실패: code=$code" }
|
||||
throw PaymentException(PaymentErrorCode.ORGANIZATION_CODE_NOT_FOUND)
|
||||
}
|
||||
log.error { "[PaymentCode.CardIssuerCode] 카드사 코드 조회 실패: code=$code" }
|
||||
throw PaymentException(PaymentErrorCode.ORGANIZATION_CODE_NOT_FOUND)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,6 @@ package roomescape.payment.infrastructure.persistence
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
|
||||
interface PaymentDetailRepository: JpaRepository<PaymentDetailEntity, Long> {
|
||||
fun findByPaymentId(paymentId: Long) : PaymentDetailEntity?
|
||||
interface PaymentDetailRepository : JpaRepository<PaymentDetailEntity, Long> {
|
||||
fun findByPaymentId(paymentId: Long): PaymentDetailEntity?
|
||||
}
|
||||
|
||||
@ -5,9 +5,7 @@ import roomescape.payment.exception.PaymentException
|
||||
import roomescape.payment.infrastructure.common.PaymentStatus
|
||||
import roomescape.payment.infrastructure.common.PaymentType
|
||||
import roomescape.payment.infrastructure.persistence.*
|
||||
import roomescape.payment.web.PaymentDetailResponse.BankTransferDetailResponse
|
||||
import roomescape.payment.web.PaymentDetailResponse.CardDetailResponse
|
||||
import roomescape.payment.web.PaymentDetailResponse.EasyPayPrepaidDetailResponse
|
||||
import roomescape.payment.web.PaymentDetailResponse.*
|
||||
import java.time.LocalDateTime
|
||||
import java.time.OffsetDateTime
|
||||
|
||||
|
||||
@ -11,11 +11,7 @@ import org.springframework.web.bind.annotation.RequestBody
|
||||
import roomescape.auth.web.support.LoginRequired
|
||||
import roomescape.auth.web.support.MemberId
|
||||
import roomescape.common.dto.response.CommonApiResponse
|
||||
import roomescape.reservation.web.PendingReservationCreateRequest
|
||||
import roomescape.reservation.web.PendingReservationCreateResponse
|
||||
import roomescape.reservation.web.ReservationCancelRequest
|
||||
import roomescape.reservation.web.ReservationDetailRetrieveResponse
|
||||
import roomescape.reservation.web.ReservationSummaryRetrieveListResponse
|
||||
import roomescape.reservation.web.*
|
||||
|
||||
interface ReservationAPI {
|
||||
|
||||
@ -56,5 +52,4 @@ interface ReservationAPI {
|
||||
fun findDetailById(
|
||||
@PathVariable("id") id: Long
|
||||
): ResponseEntity<CommonApiResponse<ReservationDetailRetrieveResponse>>
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ class CanceledReservationEntity(
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
val status: CanceledReservationStatus,
|
||||
|
||||
): BaseEntityV2(id)
|
||||
) : BaseEntityV2(id)
|
||||
|
||||
enum class CanceledReservationStatus {
|
||||
PROCESSING, FAILED, COMPLETED
|
||||
|
||||
@ -2,4 +2,4 @@ package roomescape.reservation.infrastructure.persistence
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
|
||||
interface CanceledReservationRepository: JpaRepository<CanceledReservationEntity, Long>
|
||||
interface CanceledReservationRepository : JpaRepository<CanceledReservationEntity, Long>
|
||||
@ -20,8 +20,7 @@ class ReservationEntity(
|
||||
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
var status: ReservationStatus,
|
||||
|
||||
) : AuditingBaseEntity(id) {
|
||||
) : AuditingBaseEntity(id) {
|
||||
fun confirm() {
|
||||
this.status = ReservationStatus.CONFIRMED
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ class ScheduleValidator(
|
||||
fun validateCanDelete(schedule: ScheduleEntity) {
|
||||
val status: ScheduleStatus = schedule.status
|
||||
|
||||
if (status !in listOf(ScheduleStatus.AVAILABLE,ScheduleStatus.BLOCKED)) {
|
||||
if (status !in listOf(ScheduleStatus.AVAILABLE, ScheduleStatus.BLOCKED)) {
|
||||
log.info { "[ScheduleValidator.validateCanDelete] 삭제 실패: id=${schedule.id} / status=${status}" }
|
||||
throw ScheduleException(ScheduleErrorCode.SCHEDULE_IN_USE)
|
||||
}
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
package roomescape.schedule.infrastructure.persistence
|
||||
|
||||
import jakarta.persistence.Entity
|
||||
import jakarta.persistence.EnumType
|
||||
import jakarta.persistence.Enumerated
|
||||
import jakarta.persistence.Table
|
||||
import jakarta.persistence.UniqueConstraint
|
||||
import jakarta.persistence.*
|
||||
import roomescape.common.entity.AuditingBaseEntity
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalTime
|
||||
|
||||
@ -13,10 +13,12 @@ interface ScheduleRepository : JpaRepository<ScheduleEntity, Long> {
|
||||
|
||||
fun existsByDateAndThemeIdAndTime(date: LocalDate, themeId: Long, time: LocalTime): Boolean
|
||||
|
||||
@Query("""
|
||||
@Query(
|
||||
"""
|
||||
SELECT DISTINCT s.themeId
|
||||
FROM ScheduleEntity s
|
||||
WHERE s.date = :date
|
||||
""")
|
||||
"""
|
||||
)
|
||||
fun findAllUniqueThemeIdByDate(date: LocalDate): List<Long>
|
||||
}
|
||||
|
||||
@ -11,13 +11,7 @@ import org.springframework.web.bind.annotation.RequestBody
|
||||
import roomescape.auth.web.support.Admin
|
||||
import roomescape.auth.web.support.LoginRequired
|
||||
import roomescape.common.dto.response.CommonApiResponse
|
||||
import roomescape.theme.web.AdminThemeDetailRetrieveResponse
|
||||
import roomescape.theme.web.AdminThemeSummaryRetrieveListResponse
|
||||
import roomescape.theme.web.ThemeCreateRequest
|
||||
import roomescape.theme.web.ThemeCreateResponseV2
|
||||
import roomescape.theme.web.ThemeListRetrieveRequest
|
||||
import roomescape.theme.web.ThemeUpdateRequest
|
||||
import roomescape.theme.web.ThemeSummaryListResponse
|
||||
import roomescape.theme.web.*
|
||||
|
||||
@Tag(name = "5. 관리자 테마 API", description = "관리자 페이지에서 테마를 조회 / 추가 / 삭제할 때 사용합니다.")
|
||||
interface ThemeAPIV2 {
|
||||
|
||||
@ -1,10 +1,6 @@
|
||||
package roomescape.theme.infrastructure.persistence
|
||||
|
||||
import jakarta.persistence.Column
|
||||
import jakarta.persistence.Entity
|
||||
import jakarta.persistence.EnumType
|
||||
import jakarta.persistence.Enumerated
|
||||
import jakarta.persistence.Table
|
||||
import jakarta.persistence.*
|
||||
import roomescape.common.entity.AuditingBaseEntity
|
||||
|
||||
@Entity
|
||||
|
||||
@ -3,7 +3,7 @@ package roomescape.theme.infrastructure.persistence
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.data.jpa.repository.Query
|
||||
|
||||
interface ThemeRepository: JpaRepository<ThemeEntity, Long> {
|
||||
interface ThemeRepository : JpaRepository<ThemeEntity, Long> {
|
||||
|
||||
@Query("SELECT t FROM ThemeEntity t WHERE t.isOpen = true")
|
||||
fun findOpenedThemes(): List<ThemeEntity>
|
||||
|
||||
@ -6,11 +6,7 @@ import io.kotest.assertions.throwables.shouldThrow
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.string.shouldContain
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
import java.time.LocalTime
|
||||
import java.time.OffsetDateTime
|
||||
import java.time.ZoneOffset
|
||||
import java.time.*
|
||||
|
||||
class JacksonConfigTest(
|
||||
private val objectMapper: ObjectMapper = JacksonConfig().objectMapper()
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package roomescape.common.log
|
||||
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||
import io.kotest.core.spec.style.FunSpec
|
||||
import io.kotest.core.spec.style.StringSpec
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.mockk.every
|
||||
@ -45,7 +44,11 @@ class ApiLogMessageConverterTest : StringSpec({
|
||||
val requestURI = "/test/sangdol".also { every { request.requestURI } returns it }
|
||||
|
||||
converter.convertToControllerInvokedMessage(request, controllerPayload) shouldBe """
|
||||
{"type":"CONTROLLER_INVOKED","method":"$method","uri":"$requestURI","member_id":1,"controller_method":"${controllerPayload.get("controller_method")}","request_body":{"key1":"value1"}}
|
||||
{"type":"CONTROLLER_INVOKED","method":"$method","uri":"$requestURI","member_id":1,"controller_method":"${
|
||||
controllerPayload.get(
|
||||
"controller_method"
|
||||
)
|
||||
}","request_body":{"key1":"value1"}}
|
||||
""".trimIndent()
|
||||
}
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ class TosspayClientTest(
|
||||
|
||||
assertSoftly(cancelResponse) {
|
||||
this.status shouldBe PaymentStatus.CANCELED
|
||||
with (this.cancels) {
|
||||
with(this.cancels) {
|
||||
this.cancelAmount shouldBe SampleTosspayConstant.AMOUNT
|
||||
this.cancelReason shouldBe SampleTosspayConstant.CANCEL_REASON
|
||||
}
|
||||
@ -135,7 +135,6 @@ class TosspayClientTest(
|
||||
.createResponse(it)
|
||||
}
|
||||
|
||||
|
||||
val exception = shouldThrow<PaymentException> {
|
||||
client.cancel(
|
||||
SampleTosspayConstant.PAYMENT_KEY,
|
||||
|
||||
@ -26,7 +26,7 @@ object KotestConfig : AbstractProjectConfig() {
|
||||
|
||||
@Import(TestConfig::class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
abstract class FunSpecSpringbootTest: FunSpec({
|
||||
abstract class FunSpecSpringbootTest : FunSpec({
|
||||
extension(DatabaseCleanerExtension(mode = AFTER_EACH_TEST))
|
||||
}) {
|
||||
@Autowired
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user