generated from pricelees/issue-pr-template
[#44] 매장 기능 도입 #45
@ -16,9 +16,18 @@ import java.time.LocalDateTime
|
||||
class StoreEntity(
|
||||
id: Long,
|
||||
|
||||
@Column(unique = false)
|
||||
var name: String,
|
||||
|
||||
@Column(unique = false)
|
||||
var address: String,
|
||||
|
||||
@Column(unique = false)
|
||||
var contact: String,
|
||||
|
||||
@Column(unique = false)
|
||||
val businessRegNum: String,
|
||||
|
||||
val regionCode: String,
|
||||
) : PersistableBaseEntity(id) {
|
||||
|
||||
|
||||
@ -12,12 +12,16 @@ create table if not exists store(
|
||||
id bigint primary key,
|
||||
name varchar(20) not null,
|
||||
address varchar(100) not null,
|
||||
contact varchar(50) not null,
|
||||
business_reg_num varchar(12) not null,
|
||||
region_code varchar(10) not null,
|
||||
|
||||
created_at timestamp not null,
|
||||
updated_at timestamp not null,
|
||||
|
||||
constraint uk_store__name unique (name),
|
||||
constraint uk_store__contact unique (contact),
|
||||
constraint uk_store__address unique (address),
|
||||
constraint uk_store__business_reg_num unique (business_reg_num),
|
||||
constraint fk_store__region_code foreign key (region_code) references region (code)
|
||||
);
|
||||
|
||||
@ -2,6 +2,7 @@ package roomescape.data
|
||||
|
||||
import io.kotest.core.spec.style.StringSpec
|
||||
import roomescape.common.config.next
|
||||
import roomescape.supports.randomPhoneNumber
|
||||
import roomescape.supports.tsidFactory
|
||||
import java.io.File
|
||||
import java.time.LocalDateTime
|
||||
@ -39,6 +40,8 @@ class StoreDataInitializer : StringSpec({
|
||||
} while (usedStoreName.contains(storeName))
|
||||
usedStoreName.add(storeName)
|
||||
|
||||
val contact = randomPhoneNumber()
|
||||
|
||||
var businessRegNum: String
|
||||
do {
|
||||
businessRegNum = generateBusinessRegNum()
|
||||
@ -51,15 +54,15 @@ class StoreDataInitializer : StringSpec({
|
||||
val id: Long = tsidFactory.next().also { storeIds.add(it) }
|
||||
|
||||
storeSqlRows.add(
|
||||
"(${id}, '$storeName', '$address', '$businessRegNum', '${region.regionCode}', '$createdAt', '$updatedAt')"
|
||||
"(${id}, '$storeName', '$address', '$contact', '$businessRegNum', '${region.regionCode}', '$createdAt', '$updatedAt')"
|
||||
)
|
||||
storeDataRows.add(
|
||||
"$id, $storeName, $address, $businessRegNum, ${region.regionCode}, $createdAt, $updatedAt"
|
||||
"$id, $storeName, $address, $contact, $businessRegNum, ${region.regionCode}, $createdAt, $updatedAt"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder("INSERT INTO store (id, name, address, business_reg_num, region_code, created_at, updated_at) VALUES ")
|
||||
StringBuilder("INSERT INTO store (id, name, address, contact, business_reg_num, region_code, created_at, updated_at) VALUES ")
|
||||
.append(storeSqlRows.joinToString(",\n"))
|
||||
.append(";")
|
||||
.toString()
|
||||
|
||||
@ -31,12 +31,14 @@ object StoreFixture {
|
||||
id: Long = tsidFactory.next(),
|
||||
name: String = "테스트-${randomString()}점",
|
||||
address: String = "서울특별시 강북구 행복길 123",
|
||||
contact: String = randomPhoneNumber(),
|
||||
businessRegNum: String = "123-45-67890",
|
||||
regionCode: String = "1111000000"
|
||||
) = StoreEntity(
|
||||
id = id,
|
||||
name = name,
|
||||
address = address,
|
||||
contact = contact,
|
||||
businessRegNum = businessRegNum,
|
||||
regionCode = regionCode
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user