generated from pricelees/issue-pr-template
refactor: Fixture에서 발생하는 Unique 제약 조건 해결 및 일부 엔티티 생성 메서드 추가
This commit is contained in:
parent
75f628c991
commit
efb7148215
@ -10,10 +10,13 @@ import roomescape.payment.infrastructure.common.*
|
|||||||
import roomescape.payment.web.PaymentCancelRequest
|
import roomescape.payment.web.PaymentCancelRequest
|
||||||
import roomescape.payment.web.PaymentConfirmRequest
|
import roomescape.payment.web.PaymentConfirmRequest
|
||||||
import roomescape.reservation.web.PendingReservationCreateRequest
|
import roomescape.reservation.web.PendingReservationCreateRequest
|
||||||
|
import roomescape.schedule.infrastructure.persistence.ScheduleEntity
|
||||||
|
import roomescape.schedule.infrastructure.persistence.ScheduleEntityFactory
|
||||||
import roomescape.schedule.web.ScheduleCreateRequest
|
import roomescape.schedule.web.ScheduleCreateRequest
|
||||||
import roomescape.store.infrastructure.persistence.StoreEntity
|
import roomescape.store.infrastructure.persistence.StoreEntity
|
||||||
import roomescape.store.infrastructure.persistence.StoreStatus
|
import roomescape.store.infrastructure.persistence.StoreStatus
|
||||||
import roomescape.theme.infrastructure.persistence.Difficulty
|
import roomescape.theme.infrastructure.persistence.Difficulty
|
||||||
|
import roomescape.theme.infrastructure.persistence.ThemeEntity
|
||||||
import roomescape.theme.web.ThemeCreateRequest
|
import roomescape.theme.web.ThemeCreateRequest
|
||||||
import roomescape.user.infrastructure.persistence.UserEntity
|
import roomescape.user.infrastructure.persistence.UserEntity
|
||||||
import roomescape.user.infrastructure.persistence.UserStatus
|
import roomescape.user.infrastructure.persistence.UserStatus
|
||||||
@ -26,11 +29,10 @@ import java.time.OffsetDateTime
|
|||||||
const val INVALID_PK: Long = 9999L
|
const val INVALID_PK: Long = 9999L
|
||||||
val tsidFactory = TsidFactory(0)
|
val tsidFactory = TsidFactory(0)
|
||||||
|
|
||||||
|
|
||||||
object StoreFixture {
|
object StoreFixture {
|
||||||
fun create(
|
fun create(
|
||||||
id: Long = tsidFactory.next(),
|
id: Long = tsidFactory.next(),
|
||||||
name: String = "테스트-${randomString()}점",
|
name: String = "행복${randomPhoneNumber()}호점",
|
||||||
address: String = "서울특별시 강북구 행복길 123",
|
address: String = "서울특별시 강북구 행복길 123",
|
||||||
contact: String = randomPhoneNumber(),
|
contact: String = randomPhoneNumber(),
|
||||||
businessRegNum: String = randomBusinessRegNum(),
|
businessRegNum: String = randomBusinessRegNum(),
|
||||||
@ -110,7 +112,10 @@ object AdminFixture {
|
|||||||
type: AdminType = AdminType.STORE,
|
type: AdminType = AdminType.STORE,
|
||||||
storeId: Long? = tsidFactory.next(),
|
storeId: Long? = tsidFactory.next(),
|
||||||
permissionLevel: AdminPermissionLevel = AdminPermissionLevel.FULL_ACCESS
|
permissionLevel: AdminPermissionLevel = AdminPermissionLevel.FULL_ACCESS
|
||||||
): AdminEntity = AdminEntity(
|
): AdminEntity {
|
||||||
|
val storeId = if (type == AdminType.HQ) null else storeId
|
||||||
|
|
||||||
|
return AdminEntity(
|
||||||
id = id,
|
id = id,
|
||||||
account = account,
|
account = account,
|
||||||
password = password,
|
password = password,
|
||||||
@ -120,6 +125,7 @@ object AdminFixture {
|
|||||||
storeId = storeId,
|
storeId = storeId,
|
||||||
permissionLevel = permissionLevel,
|
permissionLevel = permissionLevel,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object UserFixture {
|
object UserFixture {
|
||||||
@ -169,6 +175,34 @@ object ThemeFixture {
|
|||||||
expectedMinutesTo = 70,
|
expectedMinutesTo = 70,
|
||||||
isActive = true
|
isActive = true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun create(
|
||||||
|
id: Long = tsidFactory.next(),
|
||||||
|
name: String = randomString(),
|
||||||
|
description: String = randomString(),
|
||||||
|
thumbnailUrl: String = "http://www.bing.com/search?q=fugit",
|
||||||
|
difficulty: Difficulty = Difficulty.VERY_EASY,
|
||||||
|
price: Int = 10_000,
|
||||||
|
minParticipants: Short = 3,
|
||||||
|
maxParticipants: Short = 5,
|
||||||
|
availableMinutes: Short = 60,
|
||||||
|
expectedMinutesFrom: Short = 40,
|
||||||
|
expectedMinutesTo: Short = 50,
|
||||||
|
isActive: Boolean = true
|
||||||
|
) = ThemeEntity(
|
||||||
|
id = id,
|
||||||
|
name = name,
|
||||||
|
description = description,
|
||||||
|
thumbnailUrl = thumbnailUrl,
|
||||||
|
difficulty = difficulty,
|
||||||
|
price = price,
|
||||||
|
minParticipants = minParticipants,
|
||||||
|
maxParticipants = maxParticipants,
|
||||||
|
availableMinutes = availableMinutes,
|
||||||
|
expectedMinutesFrom = expectedMinutesFrom,
|
||||||
|
expectedMinutesTo = expectedMinutesTo,
|
||||||
|
isActive = isActive
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
object ScheduleFixture {
|
object ScheduleFixture {
|
||||||
@ -177,6 +211,20 @@ object ScheduleFixture {
|
|||||||
time = LocalTime.now(),
|
time = LocalTime.now(),
|
||||||
themeId = tsidFactory.next()
|
themeId = tsidFactory.next()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun create(
|
||||||
|
id: Long = tsidFactory.next(),
|
||||||
|
date: LocalDate = LocalDate.now().plusDays(1),
|
||||||
|
time: LocalTime = LocalTime.now(),
|
||||||
|
storeId: Long = tsidFactory.next(),
|
||||||
|
themeId: Long = tsidFactory.next()
|
||||||
|
): ScheduleEntity = ScheduleEntityFactory.create(
|
||||||
|
id = id,
|
||||||
|
date = date,
|
||||||
|
time = time,
|
||||||
|
storeId = storeId,
|
||||||
|
themeId = themeId
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
object PaymentFixture {
|
object PaymentFixture {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user