Skip to content

[BE] ERD 문서화 Ver.2

장현호 Hyunho Jang edited this page Sep 8, 2024 · 7 revisions

🚀 목차


⚠️ 주요 변경사항 (24.09.08)

  • 기획에 맞춰 ERD 전반적 수정 작업

📚 ERD

이커머스 서비스, 관리자 공통 사용

erDiagram
    CATEGORY {
        bigint id PK
        varchar name
        bigint parent_id FK
        int depth
        datetime created_at
        datetime updated_at
    }
    PRODUCT {
        bigint id PK
        varchar title
        varchar author
        text description
        decimal price
        decimal discounted_price
        varchar isbn
        int pages
        varchar publisher
        date publish_date
        decimal rating
        enum status
        int stock_quantity
        varchar cover_image
        varchar preview_link
        bigint category_id FK
        datetime created_at
        datetime updated_at
        datetime deleted_at
    }
    MEMBER {
        bigint id PK
        varchar name
        varchar email
        varchar password
        varchar phone
        datetime last_login_date
        varchar refresh_token
        datetime created_at
        datetime updated_at
        datetime deleted_at
    }
    REVIEW {
        bigint id PK
        text content
        decimal score
        bigint member_id FK
        bigint product_id FK
        varchar order_item_id FK
        datetime created_at
        datetime updated_at
    }
    ORDERS {
        bigint id PK
        varchar order_number
        bigint member_id FK
        datetime order_date
        decimal price
        decimal discounted_price
        enum status
        varchar payment_method
        varchar recipient
        varchar postal_code
        varchar street_address
        varchar detail_address
        varchar content
        datetime created_at
        datetime updated_at
    }
    ORDER_PRODUCT {
        bigint id PK
        bigint order_id FK
        bigint product_id FK
        int quantity
        decimal price
        decimal discounted_price
        datetime created_at
        datetime updated_at
    }
    SHOPPING_CART {
        bigint id PK
        bigint member_id FK
        bigint product_id FK
        int quantity
        datetime created_at
        datetime updated_at
    }

    CATEGORY ||--o{ CATEGORY : "parent_of"
    CATEGORY ||--o{ PRODUCT : "has"
    PRODUCT ||--o{ REVIEW : "receives"
    MEMBER ||--o{ REVIEW : "writes"
    MEMBER ||--o{ ORDERS : "places"
    ORDERS ||--o{ ORDER_PRODUCT : "contains"
    PRODUCT ||--o{ ORDER_PRODUCT : "included in"
    MEMBER ||--o{ SHOPPING_CART : "has"
    PRODUCT ||--o{ SHOPPING_CART : "added to"
Loading

📚 ERD 엔티티 상세 설명

CATEGORY

필드명 데이터 타입 설명
id bigint 카테고리의 고유 식별자 (기본 키)
name varchar(255) 카테고리 이름
parent_id bigint 상위 카테고리의 ID (자체 참조 외래 키)
depth int 카테고리 계층 구조에서의 깊이
created_at datetime 카테고리 생성 일시
updated_at datetime 카테고리 정보 최종 수정 일시

PRODUCT

필드명 데이터 타입 설명
id bigint 제품의 고유 식별자 (기본 키)
title varchar(255) 책 제목
author varchar(255) 저자 이름
description text 책 설명
price decimal(38,2) 정가
discounted_price decimal(38,2) 할인가
isbn varchar(255) 국제 표준 도서 번호
pages int 페이지 수
publisher varchar(255) 출판사
publish_date date 출판일
rating decimal(38,2) 평균 평점
status enum 상품 상태 (재고 있음, 품절 등)
stock_quantity int 재고 수량
cover_image varchar(255) 표지 이미지 URL
preview_link varchar(255) 미리보기 링크
category_id bigint 연관된 카테고리 ID (외래 키)
created_at datetime 제품 등록 일시
updated_at datetime 제품 정보 최종 수정 일시
deleted_at datetime 제품 삭제 일시 (소프트 삭제용)

MEMBER

필드명 데이터 타입 설명
id bigint 회원의 고유 식별자 (기본 키)
name varchar(255) 회원 이름
email varchar(255) 이메일 주소
password varchar(255) 암호화된 비밀번호
phone varchar(255) 전화번호
last_login_date datetime 최종 로그인 일시
refresh_token varchar(255) 리프레시 토큰
created_at datetime 회원 가입 일시
updated_at datetime 회원 정보 최종 수정 일시
deleted_at datetime 회원 탈퇴 일시 (소프트 삭제용)

REVIEW

필드명 데이터 타입 설명
id bigint 리뷰의 고유 식별자 (기본 키)
content text 리뷰 내용
score decimal(38,2) 평점
member_id bigint 리뷰 작성자 ID (외래 키)
product_id bigint 리뷰 대상 제품 ID (외래 키)
order_item_id varchar(255) 관련 주문 항목 ID
created_at datetime 리뷰 작성 일시
updated_at datetime 리뷰 수정 일시

ORDERS

필드명 데이터 타입 설명
id bigint 주문의 고유 식별자 (기본 키)
order_number varchar(255) 주문 번호
member_id bigint 주문한 회원 ID (외래 키)
order_date datetime 주문 일시
price decimal(38,2) 총 주문 금액
discounted_price decimal(38,2) 할인 적용 후 최종 금액
status enum 주문 상태 (대기중, 처리중, 배송됨 등)
payment_method varchar(255) 결제 방법
recipient varchar(255) 수령인 이름
postal_code varchar(255) 우편번호
street_address varchar(255) 도로명 주소
detail_address varchar(255) 상세 주소
content varchar(255) 주문 내용
created_at datetime 주문 생성 일시
updated_at datetime 주문 정보 최종 수정 일시

ORDER_PRODUCT

필드명 데이터 타입 설명
id bigint 주문 항목의 고유 식별자 (기본 키)
order_id bigint 연관된 주문 ID (외래 키)
product_id bigint 주문된 제품 ID (외래 키)
quantity int 주문 수량
price decimal(38,2) 항목별 가격
discounted_price decimal(38,2) 할인 적용 후 항목별 가격
created_at datetime 주문 항목 생성 일시
updated_at datetime 주문 항목 정보 최종 수정 일시

SHOPPING_CART

필드명 데이터 타입 설명
id bigint 장바구니 항목의 고유 식별자 (기본 키)
member_id bigint 장바구니 소유자 ID (외래 키)
product_id bigint 장바구니에 담긴 제품 ID (외래 키)
quantity int 담긴 수량
created_at datetime 장바구니 항목 추가 일시
updated_at datetime 장바구니 항목 정보 최종 수정 일시

🚚... 커머스 프로젝트

이너서클 1기

🧑🏼‍🎨공통

🧑🏻‍💻백엔드

👨🏻‍🏫멘토링 일지


커머스 5&6 백엔드팀 스토리

이너서클 MVP 발표회 발표자: $\small{\color{#5ad7b7}@이호준}$
이너서클 최종 발표회 발표자: $\small{\color{#5ad7b7}@이재훈}$

Clone this wiki locally