Skip to content

ERD 명세서

Yeonu Kim edited this page May 30, 2026 · 1 revision

ERD 명세서

다이어그램

erDiagram
  USER {
    uuid id PK
    string username
    string email
    string password_hash
    string wallet_address
    enum role "owner | reviewer"
    timestamp created_at
  }

  STORE {
    uuid id PK
    uuid owner_id FK
    string name
    string address
    int latMax
    int latMin
    int lngMax
    int lngMin
    enum category "restaurant | cafe | fashion | beauty | etc"
    string thumbnail_url
    string description
    timestamp created_at
  }

  EVENT {
    uuid id PK
    uuid store_id FK
    string title
    text condition
    int reward_amount
    boolean is_active
    timestamp created_at
  }

  DEPOSIT {
    uuid id PK
    uuid owner_id FK
    int amount
    timestamp deposited_at
  }

  APPLICATION {
    uuid id PK
    uuid event_id FK
    uuid reviewer_id FK
    enum status "pending | approved | rejected"
    timestamp applied_at
  }

  REVIEW_SUBMISSION {
    uuid id PK
    uuid application_id FK
    text message
    timestamp submitted_at
  }

  REVIEW_IMAGE {
    uuid id PK
    uuid submission_id FK
    string image_url
    int order_index
  }

  REJECTION {
    uuid id PK
    uuid application_id FK
    text reason
    timestamp rejected_at
  }

  USER ||--o{ STORE : "owns"
  USER ||--o{ APPLICATION : "applies"
  USER ||--o{ DEPOSIT : "deposits"
  STORE ||--o{ EVENT : "has"
  EVENT ||--o{ APPLICATION : "receives"
  APPLICATION ||--o| REVIEW_SUBMISSION : "has"
  REVIEW_SUBMISSION ||--o{ REVIEW_IMAGE : "contains"
  APPLICATION ||--o| REJECTION : "has"
Loading

테이블 설명

USER

사장님(owner)과 리뷰어(reviewer) 두 가지 역할을 하나의 테이블로 관리합니다. 블록체인 리워드 지급을 위해 wallet_address를 저장합니다.

STORE

사장님이 등록하는 가게 정보입니다. 지도 핀 표시를 위해 위경도 범위(latMax, latMin, lngMax, lngMin)를 저장합니다.

EVENT

가게별 리뷰 이벤트입니다. 리뷰어가 충족해야 하는 condition과 지급할 reward_amount를 정의합니다. is_active로 이벤트 활성 여부를 관리합니다.

DEPOSIT

사장님이 스마트 컨트랙트에 예치한 금액 기록입니다. 리워드 지급 가능 여부를 판단하는 기준이 됩니다.

APPLICATION

리뷰어가 이벤트에 신청한 기록입니다. 상태는 pending → approved | rejected로 전환됩니다.

REVIEW_SUBMISSION

신청(APPLICATION)에 대한 리뷰 인증 제출 정보입니다. 리뷰어가 작성한 메시지와 인증 사진을 포함합니다.

REVIEW_IMAGE

리뷰 인증에 첨부된 이미지 목록입니다. order_index로 사진 순서를 관리합니다.

REJECTION

사장님이 신청을 반려할 때 작성하는 사유입니다. APPLICATION과 1:1 관계입니다.

Clone this wiki locally