[#44] 매장 기능 도입 #45

Merged
pricelees merged 116 commits from feat/#44 into main 2025-09-20 03:15:06 +00:00
2 changed files with 54 additions and 30 deletions
Showing only changes of commit 1de8d08cb7 - Show all commits

View File

@ -25,17 +25,11 @@ import java.time.OffsetDateTime
const val INVALID_PK: Long = 9999L
val tsidFactory = TsidFactory(0)
fun randomPhoneNumber(): String {
val prefix = "010"
val middle = (1000..9999).random()
val last = (1000..9999).random()
return "$prefix$middle$last"
}
object StoreFixture {
fun create(
id: Long = tsidFactory.next(),
name: String = "테스트행복",
name: String = "테스트-${randomString()}",
address: String = "서울특별시 강북구 행복길 123",
businessRegNum: String = "123-45-67890",
regionCode: String = "1111000000"
@ -49,24 +43,21 @@ object StoreFixture {
}
object AdminFixture {
val default: AdminEntity = create()
val storeDefault: AdminEntity = create(
account = "admin-store",
phone = randomPhoneNumber(),
type = AdminType.STORE,
storeId = tsidFactory.next()
val default: AdminEntity = create(
account = "default"
)
val hqDefault: AdminEntity = create(
account = "admin-hq",
phone = randomPhoneNumber(),
type = AdminType.HQ,
storeId = null
val storeDefault: AdminEntity = createStoreAdmin(
account = "store-default",
)
val hqDefault: AdminEntity = createHqAdmin(
account = "hq-default",
)
fun createStoreAdmin(
id: Long = tsidFactory.next(),
account: String = "admin",
account: String = randomString(),
password: String = "adminPassword",
name: String = "admin12345",
phone: String = randomPhoneNumber(),
@ -87,7 +78,7 @@ object AdminFixture {
fun createHqAdmin(
id: Long = tsidFactory.next(),
account: String = "admin",
account: String = randomString(),
password: String = "adminPassword",
name: String = "admin12345",
phone: String = randomPhoneNumber(),
@ -107,9 +98,9 @@ object AdminFixture {
fun create(
id: Long = tsidFactory.next(),
account: String = "admin",
account: String = randomString(),
password: String = "adminPassword",
name: String = "admin12345",
name: String = "admin",
phone: String = randomPhoneNumber(),
type: AdminType = AdminType.STORE,
storeId: Long? = tsidFactory.next(),
@ -127,14 +118,17 @@ object AdminFixture {
}
object UserFixture {
val default: UserEntity = createUser()
val default: UserEntity = createUser(
name = "default",
email = "default-user@test.com"
)
fun createUser(
id: Long = tsidFactory.next(),
name: String = "sample",
email: String = "sample@example.com",
name: String = randomString(),
email: String = randomEmail(),
password: String = "a".repeat(MIN_PASSWORD_LENGTH),
phone: String = "01012345678",
phone: String = randomPhoneNumber(),
regionCode: String = "1111000000",
status: UserStatus = UserStatus.ACTIVE
): UserEntity = UserEntity(
@ -148,17 +142,17 @@ object UserFixture {
)
val createRequest: UserCreateRequest = UserCreateRequest(
name = "sample",
email = "sample@example.com",
name = randomString(),
email = randomEmail(),
password = "a".repeat(MIN_PASSWORD_LENGTH),
phone = "01012345678",
phone = randomPhoneNumber(),
regionCode = "1111000000"
)
}
object ThemeFixture {
val createRequest: ThemeCreateRequest = ThemeCreateRequest(
name = "Matilda Green",
name = randomString(),
description = "constituto",
thumbnailUrl = "https://duckduckgo.com/?q=mediocrem",
difficulty = Difficulty.VERY_EASY,

View File

@ -0,0 +1,30 @@
package roomescape.supports
import kotlin.random.Random
inline fun <T> initialize(name: String, block: () -> T): T {
return block()
}
fun randomPhoneNumber(): String {
val prefix = "010"
val middle = (1000..9999).random()
val last = (1000..9999).random()
return "$prefix$middle$last"
}
fun randomString(): String {
val chars = ('a'..'z') + ('0'..'9')
return (1..10)
.map { chars.random() }
.joinToString("")
}
fun randomEmail(): String = "${randomString()}@test.com"
fun randomBusinessRegNum(): String {
val part1 = Random.nextInt(100, 1000)
val part2 = Random.nextInt(10, 100)
val part3 = Random.nextInt(10000, 100000)
return "$part1-$part2-$part3"
}