diff --git a/docs/20260929_크리에이터_선물하기/gift-schema.sql b/docs/20260929_크리에이터_선물하기/gift-schema.sql index 7e969356..81dbfff3 100644 --- a/docs/20260929_크리에이터_선물하기/gift-schema.sql +++ b/docs/20260929_크리에이터_선물하기/gift-schema.sql @@ -15,6 +15,16 @@ CREATE TABLE gift_category ( UNIQUE KEY uk_gift_category_receipt_code (receipt_code) ) COMMENT='선물 카테고리'; +CREATE TABLE gift_mailbox ( + id BIGINT NOT NULL COMMENT '전역 단일 설정 ID. 항상 1', + name VARCHAR(50) NOT NULL COMMENT '받을 사람 이름', + phone_number VARCHAR(30) NOT NULL COMMENT '받을 연락처', + zip_code VARCHAR(20) NOT NULL COMMENT '받을 우편번호', + address VARCHAR(255) NOT NULL COMMENT '받을 주소', + address_detail VARCHAR(255) NULL COMMENT '받을 상세주소', + PRIMARY KEY (id) +) COMMENT='선물 받을 주소 전역 설정'; + CREATE TABLE gift ( id BIGINT NOT NULL AUTO_INCREMENT COMMENT '내부 기본키', application_no VARCHAR(40) NOT NULL COMMENT '신청번호', diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/gift/adapter/out/persistence/GiftMailbox.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/gift/adapter/out/persistence/GiftMailbox.kt new file mode 100644 index 00000000..88e46a3e --- /dev/null +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/gift/adapter/out/persistence/GiftMailbox.kt @@ -0,0 +1,33 @@ +package kr.co.vividnext.sodalive.v2.gift.adapter.out.persistence + +import javax.persistence.Column +import javax.persistence.Entity +import javax.persistence.Id +import javax.persistence.Table + +@Entity +@Table(name = "gift_mailbox") +class GiftMailbox( + @Id + @Column(name = "id", nullable = false) + val id: Long = SINGLETON_ID, + + @Column(name = "name", nullable = false, length = 50) + var name: String, + + @Column(name = "phone_number", nullable = false, length = 30) + var phoneNumber: String, + + @Column(name = "zip_code", nullable = false, length = 20) + var zipCode: String, + + @Column(name = "address", nullable = false, length = 255) + var address: String, + + @Column(name = "address_detail", length = 255) + var addressDetail: String? +) { + companion object { + const val SINGLETON_ID = 1L + } +} diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/gift/adapter/out/persistence/GiftMailboxRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/gift/adapter/out/persistence/GiftMailboxRepository.kt new file mode 100644 index 00000000..914cadfe --- /dev/null +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/gift/adapter/out/persistence/GiftMailboxRepository.kt @@ -0,0 +1,5 @@ +package kr.co.vividnext.sodalive.v2.gift.adapter.out.persistence + +import org.springframework.data.jpa.repository.JpaRepository + +interface GiftMailboxRepository : JpaRepository