aquarium-shop-platform-with-chatbot

Tables (13)

addresses (Untitled2)

  • 주소 (id) — Primary key — NOT NULL
  • 회원 (user_id) — FK(users) — Foreign key → users.회원
  • 상세 주소 (address_text) — Text
  • 우편주소 (postal_code) — Char(10)
  • 기본 배송지 여부 (is_default) — Bool
  • 별명 (name) — Char(50) — 집, 회사 등 별명
  • 생성일시 (created_at) — DateTime

cart_items (Untitled8)

  • 장바구니 아이템 (id) — Primary key — NOT NULL
  • 장바구니 (cart_id) — FK(carts) — Foreign key → carts.장바구니 — NOT NULL
  • 제품 (product_id) — FK(products) — Foreign key → producsts.제품 — NOT NULL
  • 수량 (quantity) — Int
  • 추가일시 (added_at) — DateTime

carts (Untitled7)

  • 장바구니 (id) — Primary key — NOT NULL
  • 회원 (user_id) — FK(users) — Foreign key → users.회원 — NOT NULL
  • 생성일시 (created_at) — DateTime

categroies (Untitled4)

  • 카테고리 (id) — Primary key — NOT NULL
  • 카테고리 명 (name) — Char(100)
  • 카테고리 (parnet_id) — FK(categories) — Foreign key → categroies.카테고리 — NOT NULL — 자신 참조
  • 분류 레벨 (level) — Int — 1: 대분류, 2: 중분류, 3: 소분류

discount_usages (Untitled13)

  • 할인 사용 로깅 (id) — Primary key — NOT NULL
  • 매장 할인 정보 (store_discount_id) — FK(store_discounts) — Foreign key → store_discounts.매장 할인 정보 — NOT NULL
  • 수족관 (store_id) — FK(stores) — Foreign key → stores.수족관 — NOT NULL
  • 회원 (user_id) — FK(users) — Foreign key → users.회원 — NOT NULL
  • 주문(전체) (order_id) — FK(orders) — Foreign key → orders.주문(전체) — NOT NULL
  • 적용된 할인 금액 (used_amount) — Int
  • 생성일시 (created_at) — DateTime

inventory (Untitled6)

  • 제품 재고 (id) — Primary key — NOT NULL
  • 제품 (product_id) — FK(products) — Foreign key → producsts.제품 — NOT NULL
  • 재고 수량 (stock_quantity) — Int
  • 주문 예약 수량 (reserved_quantity) — Int
  • 수정일시 (DateTime) — redis sync 용도

order_items (Untitled10)

  • 주문 상품 (id) — Primary key — NOT NULL
  • 주문(전체) (order_id) — FK(orders) — Foreign key → orders.주문(전체) — NOT NULL
  • 제품 (product_id) — FK(products) — Foreign key → producsts.제품 — NOT NULL
  • 수량 (quantity) — Int
  • 구매당시 가격 (price_at_purchase) — Int — 할인 적용 등에 따른 변동 가격 저장
  • 제품 주문 총액 (subtotal) — Int — quantity * price_at_purchase = 고민 되는 부분 구현하면서 최적화 필요 여부에 따라서 유무 고민할 것

orders (Untitled9)

  • 주문(전체) (id) — Primary key — NOT NULL
  • 회원 (user_id) — FK(users) — Foreign key → users.회원 — NOT NULL
  • 수족관 (store_id) — FK(stores) — Foreign key → stores.수족관 — NOT NULL
  • 전체 금액 (total_amount) — Int — 쿼리 최적화 용도
  • 주문 상태 (status) — Enum — pending, paid, shipped, delivered, cancelled
  • 주소 (shipping_address) — Text — 주소가 삭제된 경우 방지
  • 생성일시 (created_at) — DateTime

payments (Untitled11)

  • 결제 정보 (id) — Primary key — NOT NULL
  • 주문(전체) (order_id) — FK(orders) — Foreign key → orders.주문(전체) — NOT NULL
  • TossPayment ID (payment_id) — Char(100)
  • 결제 금액 (amount) — Int
  • 결제 상태 (status) — Enum — pending, completed, failed
  • 결제일시 (paid_at) — DateTime

producsts (Untitled5)

  • 제품 (id) — Primary key — NOT NULL
  • 카테고리 (category_id) — FK(categories) — Foreign key → categroies.카테고리 — NOT NULL
  • 수족관 (store_id) — FK(stores) — Foreign key → stores.수족관 — NOT NULL
  • 제품명 (name) — Char(100)
  • 제품 설명 (description) — Text
  • 가격 (price) — Int
  • 제품 이미지 (image_url) — Text
  • 제품 활성 여부 (is_active) — Bool
  • 생성일시 (created_at) — DateTime

store_discounts (Untitled12)

  • 매장 할인 정보 (id) — Primary key — NOT NULL
  • 수족관 (store_id) — FK(stores) — Foreign key → stores.수족관 — NOT NULL
  • 할인 명 (name) — Char(100) — 예: 팬더 코리 20% 할인
  • 할인 유형 (discount_type) — Enum — % 또는 금액
  • 할인 값 (discount_value) — Decimal — 10.0(10%) 또는 4500
  • 적용 대상 타입 (apply_to) — Enum — 할인 적용 대상(product, category)
  • 제품 (product_id) — Int — Foreign key → producsts.제품 — NOT NULL
  • 카테고리 (category_id) — Int — Foreign key → categroies.카테고리 — NOT NULL
  • 할인 시작일시 (valid_from) — DateTime
  • 할인 마감일시 (valid_until) — DateTime
  • 활성화 여부 (is_active) — Bool
  • 생성일시 (created_at) — DateTime
  • 수정일시 (updated_at) — DateTime

stores (Untitled3)

  • 수족관 (id) — Primary key — NOT NULL
  • 회원 (seller_id) — FK(users) — Foreign key → users.회원 — NOT NULL — 수족관 사장님
  • 수족관명 (name) — Char(100)
  • 위도/경도 (location) — Point — PostGIS 확장 적용해볼 예정
  • 영업시간 (business_hours) — JSON — {"mon": "09:00-18:00", ...}
  • 가게 설명 (description) — Text
  • 배경 이미지 URL (backgroud_img_url) — Text
  • 생성일시 (created_at) — DateTime

users (Untitled)

  • 회원 (id) — Primary key — NOT NULL
  • username — Char(50)
  • 이메일 (email) — Char(100)
  • 비밀번호 (password) — Char(100)
  • 카카오 Token (kakao_auth_token) — Char(255)
  • 역할 (role) — Enum — NOT NULL — customer, seller, admin
  • 포인트 (points) — Int — NOT NULL
  • 활성 여부 (is_active) — Bool — NOT NULL
  • 생성일시 (created_at) — DateTime — NOT NULL