Comments (6)
1. store_in_requests
stores, store_in_requests 테이블을 나누신 이유가 있으신까요?
큰 이유가 없다면 store_status 컬럼 하나로도 충분히 관리가 가능해보입니다.
2. orders
orders, order_products 테이블을 나누신 이유가 있으신가요?
1번과 마찬가지로 큰 이유가 없다면 하나의 테이블로 관리가 가능할 것 같습니다.
3. store
store와 product 테이블의 1:N 관계 표현이 잘못된것 같습니다.
Table products {
id long [pk, increment]
store_id long [ref: > stores.id] // 하나의 스토어는 여러 개의 제품을 가진다.
// (생략)
}
2. events
event와 products 테이블의 N:1 관계 표현이 잘못된것 같습니다.
추가로, 제품과 이벤트 테이블은 경우에 따라서 구조가 달라질 것 같습니다. 이 부분도 논의가 필요해보입니다.
제품 : 이벤트 = 1 : N
Table events {
id long [pk, increment] // auto-increment
product_id [ref: > [products.id](http://products.id/)]
event_type varchar
discount_rate float
started_at timestamp
ended_at timestamp
created_at timestamp
updated_at timestamp
}
제품 : 이벤트 = N : N
// event, product 관계 테이블
Table event_product_relation {
id long [pk, increment] // auto-increment
product_id [ref: > products.id]
event_id [ref: > events.id]
}
3. categories (option)
카테고리가 텍스트로만 이루어져있어서 지금 구조로도 괜찮지만 별도의 테이블로 분리하는 것도 생각해보면 좋을 것 같습니다.
이 부분도 같이 생각해보시죠! 🤔
4. user_cart
장바구니의 경우에는 user와 product의 관계 테이블 하나만 있으면 될 것 같은데 혹시 고려하시는 내용이 있으신가요?
Table user_cart {
id long [pk, increment] // auto-increment
user_id long [ref: - users.id]
product_id long [ref: - [products.id](http://products.id/)]
created_at timestamp
updated_at timestamp
}
from yousinsa.
-
과도하게 정규화를 한거 같네요 stores에 status 추가해서 진행하는 방향으로 하시죠
-
many to many 관계를 중간테이블을 통해 풀었습니다. 1:N, N:1 로 관계를 설정하기 위해서 order_product - 중간 테이블을 생성했습니다.
-
맞습니다. 툴이 익숙치 않아서 반대로 했네요
-
초기 생각은 한 product에 하나의 event만 생각했는데 many-to-many 가시죠
-
동적으로 확장하는 설계도 고려해보았는데 catego�ry도(subcartegory는 추가가능) 동적으로 하면 기획이 더 커지기 때문에 줄였습니다.
-
정책에 따라 달라질 수 있긴한데 이렇게 가시죠!
from yousinsa.
- 해당사항 반영했습니다.
- 변경 없음
- 해당사항 반영했습니다.
- event와 product -> many-to-many
- 변경 없음
- 해당사항 반영했습니다.
- User의 Role field를 추가했습니다. 마찬가지로 동적으로 role을 추가할 수 있지만 간소화하기 위해서 enum을 사용했습니다.
https://dbdiagram.io/d/626c11c695e7f23c619ca37d
// You can also define relaionship separately
// > many-to-one; < one-to-many; - one-to-one
Table users {
id long [pk, increment] // auto-increment
user_name varchar
user_email varchar
user_password_hash varchar
user_role role
created_at timestamp
updated_at timestamp
}
Table stores {
id long [pk, increment] // auto-increment
store_name varchar
store_owner long [ref: - users.id]
store_status store_in_request_status
created_at timestamp
updated_at timestamp
}
Table products {
id long [pk, increment] // auto-increment
store_id long [ref: > stores.id] // many-to-one
sub_category_id long [ref: > sub_categories.id] // many-to-one
category category
price int
product_count int
product_size varchar
thumbnail_image_id long [ref: - product_detail_images.id]
created_at timestamp
updated_at timestamp
}
Table orders {
id long [pk, increment] // auto-increment
buyer_id long [ref: > users.id]
order_status varchar
created_at timestamp
updated_at timestamp
}
Table order_products {
id long [pk, increment] // auto-increment
order_id long [ref: > orders.id]
product_id long [ref: > products.id]
buy_count int
created_at timestamp
updated_at timestamp
}
Table reviews {
id long [pk, increment] // auto-increment
product_id long [ref: > products.id]
reviewer_id long [ref: > users.id]
content text
created_at timestamp
updated_at timestamp
}
Table events {
id long [pk, increment] // auto-increment
event_type varchar
discount_rate float
started_at timestamp
ended_at timestamp
created_at timestamp
updated_at timestamp
}
Table favorites {
id long [pk, increment] // auto-increment
product_id long [ref: - products.id]
user_id long [ref: > users.id]
created_at timestamp
}
Table product_detail_images {
id long [pk, increment] // auto-increment
product_id long [ref: > products.id]
imagepath varchar
created_at timestamp
updated_at timestamp
}
Table sub_categories {
id long [pk, increment] // auto-increment
category_name varchar
category category
created_at timestamp
updated_at timestamp
}
Table carts {
id long [pk, increment] // auto-increment
user_id long [ref: - users.id]
product_id long [ref: < products.id]
created_at timestamp
updated_at timestamp
}
Table event_products {
id long [pk, increment] // auto-increment
product_id long [ref: > products.id] // many-to-one
event_id long [ref: > events.id] // many-to-one
}
Enum category {
TOP
OUTER
PANTS
}
Enum order_status {
ORDERED
PAID
DELIVERING
DELIVERED
}
Enum store_in_request_status {
REQUESTED
ACCEPTED
REJECTED
PENDING
}
Enum role {
BUYER
STORE_OWNER
ADMIN
}
from yousinsa.
https://dbdiagram.io/d/626c11c695e7f23c619ca37d
-
Users
-
Stores
-
Products
-
Orders
-
Reviews
-
Events
-
Favorites
-
ProductImages
-
StoreInRequest
-
장바구니에 대한 부분에 대한 논의가 필요합니다
from yousinsa.
해당 툴에서 공동 수정하려면 프로 플랜이 필요해서 해당 스크립트도 첨부합니다
// You can also define relaionship separately
// > many-to-one; < one-to-many; - one-to-one
Table users {
id long [pk, increment] // auto-increment
user_name varchar
user_email varchar
user_password_hash varchar
created_at timestamp
updated_at timestamp
}
Table stores {
id long [pk, increment] // auto-increment
store_name varchar
store_owner long [ref: - users.id]
created_at timestamp
updated_at timestamp
}
Table products {
id long [pk, increment] // auto-increment
store_id long [ref: < stores.id]
category category
sub_category long [ref: > sub_categories.id]
price int
product_count int
product_size varchar
event_id long [ref: < events.id]
thumbnail_image_id long [ref: - product_detail_images.id]
created_at timestamp
updated_at timestamp
}
Table orders {
id long [pk, increment] // auto-increment
buyer_id long [ref: > users.id]
order_status varchar
created_at timestamp
updated_at timestamp
}
Table order_products {
id long [pk, increment] // auto-increment
order_id long [ref: > orders.id]
product_id long [ref: > products.id]
buy_count int
created_at timestamp
updated_at timestamp
}
Table reviews {
id long [pk, increment] // auto-increment
product_id long [ref: > products.id]
reviewer_id long [ref: > users.id]
content text
created_at timestamp
updated_at timestamp
}
Table events {
id long [pk, increment] // auto-increment
event_type varchar
discount_rate float
started_at timestamp
ended_at timestamp
created_at timestamp
updated_at timestamp
}
Table favorites {
id long [pk, increment] // auto-increment
product_id long [ref: - products.id]
user_id long [ref: > users.id]
created_at timestamp
}
Table product_detail_images {
id long [pk, increment] // auto-increment
product_id long [ref: > products.id]
imagepath varchar
created_at timestamp
updated_at timestamp
}
Table store_in_request {
id long [pk, increment] // auto-increment
store_name varchar
request_state varchar
requester_id long [ref: - users.id]
created_at timestamp
updated_at timestamp
}
Table sub_categories {
id long [pk, increment] // auto-increment
category_name varchar
category category
created_at timestamp
updated_at timestamp
}
Enum category {
TOP
OUTER
PANTS
}
Enum order_status {
ORDERED
PAID
DELIVERING
DELIVERED
}
Enum store_in_request_status {
REQUESTED
ACCEPTED
REJECTED
PENDING
}
from yousinsa.
from yousinsa.
Related Issues (20)
- [#SO3] 신청된 주문을 수락하는 API
- [#SO4] 신청된 주문을 취소하는 API
- [#SO5] 소유자가 Store에서 선착순 Event를 Product에 적용하는 API
- [#B1] 등록된 물품을 조회 API
- [#B2] 물품에 대한 상세 조회 API
- [#B3] 물품을 장바구니에 추가하는 API
- [#B4] 물품을 장바구니에서 제거하는 API
- [#B5] 물품 즐겨찾기 추가/삭제 API
- [#B5] 물품 구매 API
- [#B6] 물품 구매 취소 API
- [#B8] 주문 내역 조회 API
- [#B7] 선착순 내에 선정되어 물품 구매
- [#A1] 입점신청을 수락 API
- [#A2] 모든 Store의 정보를 조회 API
- [#B8] 이벤트 생성 API
- [#B] Product Domain 작성
- [#B8] 물품 조회수 구현
- [#B9] 물품 좋아요 기능 구현
- [#B] Order 도메인 작성
- [#E] Event Domain 설계
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yousinsa.