Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OptimistLabyrinth] ๐Ÿš€ 1๋‹จ๊ณ„ - ํ…Œ์ŠคํŠธ๋ฅผ ํ†ตํ•œ ์ฝ”๋“œ ๋ณดํ˜ธ #641

Open
wants to merge 10 commits into
base: optimistlabyrinth
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
10 commits
Select commit Hold shift + click to select a range
f14886a
feat: ์š”๊ตฌ์‚ฌํ•ญ ๋ฌธ์„œํ™”
OptimistLabyrinth Nov 28, 2022
d2529c2
docs: ๋ฌธ์„œ ๋‚ด์šฉ์„ ๊ฐœ๋ฐœ์ž๊ฐ€ ์•„๋‹Œ ๊ตฌ์„ฑ์›๋„ ์ดํ•ดํ•˜๊ธฐ ์‰ฌ์šด ์–ธ์–ด๋กœ ํ‘œํ˜„ํ•˜๊ธฐ
OptimistLabyrinth Dec 1, 2022
447ea40
feat: ์–ด๋–ค ๋จธ์‹ ์—์„œ ์‹คํ–‰ํ•˜๋“  h2 ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์‚ฌ์šฉํ•˜๋„๋ก application.prop ์ˆ˜์ •
OptimistLabyrinth Dec 2, 2022
cfb03ff
test: ProductRestController, ProductService ์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ
OptimistLabyrinth Dec 3, 2022
8f10335
test: MenuGroupRestController, MenuGroupService ์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ ์ถ”๊ฐ€
OptimistLabyrinth Dec 3, 2022
1f49518
test: ํ…Œ์ŠคํŠธ ์ฝ”๋“œ์— ๋Œ€ํ•œ ์„ค๋ช…(display name) ์ž˜๋ชป๋œ ๋ถ€๋ถ„ ๊ณ ์น˜๊ธฐ
OptimistLabyrinth Dec 3, 2022
805ad80
test: MenuRestController, MenuService ์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ
OptimistLabyrinth Dec 3, 2022
23d9850
test: TableGroupRestController, TableGroupService ์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ
OptimistLabyrinth Dec 12, 2022
a1bf634
test: OrderRestController, OrderService ์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ž‘์„ฑ
OptimistLabyrinth Dec 12, 2022
8647a96
test: TableRestController, TableService ์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ ์ฝ”๋“œ ์ถ”๊ฐ€
OptimistLabyrinth Dec 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 191 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,197 @@

## ์š”๊ตฌ ์‚ฌํ•ญ

## ์ƒํ’ˆ

| ํ•œ๊ธ€๋ช… | ์˜๋ฌธ๋ช… | ์„ค๋ช… |
|--------|---------|------------|
| ์ƒํ’ˆ | Product | ์ƒํ’ˆ ๋„๋ฉ”์ธ ์—”ํ‹ฐํ‹ฐ |
| ์ƒํ’ˆ ์•„์ด๋”” | id | ์ƒํ’ˆ์˜ ๊ณ ์œ  ๋ฒˆํ˜ธ |
| ์ƒํ’ˆ ์ด๋ฆ„ | name | ์ƒํ’ˆ์˜ ์ด๋ฆ„ |
| ์ƒํ’ˆ ๊ฐ€๊ฒฉ | price | ์ƒํ’ˆ์˜ ๊ฐ€๊ฒฉ |
| ์ƒํ’ˆ ๊ฐ€๊ฒฉ | price | ์ƒํ’ˆ์˜ ๊ฐ€๊ฒฉ |

- ์ƒํ’ˆ์„ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ๋‹ค.
- ์ƒํ’ˆ์˜ ๊ฐ€๊ฒฉ์€ 0์› ์ด์ƒ์ด์–ด์•ผ ํ•œ๋‹ค.
- ์ƒํ’ˆ์˜ ๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ˆ˜ ์žˆ๋‹ค.

### ์ƒํ’ˆ ์ƒ์„ฑํ•˜๊ธฐ (POST /api/products)

- HTTP Response Code : 201 CREATED

### ์ƒํ’ˆ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ (GET /api/products)

- HTTP Response Code : 200 OK

## ๋ฉ”๋‰ด ๊ทธ๋ฃน

| ํ•œ๊ธ€๋ช… | ์˜๋ฌธ๋ช… | ์„ค๋ช… |
|----------|-----------|--------------|
| ๋ฉ”๋‰ด ๊ทธ๋ฃน | MenuGroup | ์—ฌ๋Ÿฌ ๋ฉ”๋‰ด์˜ ๋ฌถ์Œ |
| ๋ฉ”๋‰ด๊ทธ๋ฃน ์•„์ด๋”” | id | ๋ฉ”๋‰ด๊ทธ๋ฃน ๊ณ ์œ ์˜ ์‹๋ณ„์ž |
| ๋ฉ”๋‰ด๊ทธ๋ฃน ์ด๋ฆ„ | name | ๋ฉ”๋‰ด ๊ทธ๋ฃน์˜ ์ด๋ฆ„ |

์—ฌ๋Ÿฌ๊ฐœ์˜ ๋ฉ”๋‰ด๋ฅผ ๋ฌต์Œ์œผ๋กœ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด๋ฅผ '๋ฉ”๋‰ด ๊ทธ๋ฃน' ์ด๋ผ๊ณ  ํ•œ๋‹ค.
๋ฉ”๋‰ด ๊ทธ๋ฃน์„ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋‹ค.
๋ฉ”๋‰ด ๊ทธ๋ฃน์˜ ๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ˆ˜ ์žˆ๋‹ค.

### ๋ฉ”๋‰ด ๊ทธ๋ฃน ์ƒ์„ฑํ•˜๊ธฐ (POST /api/menu-groups)

- HTTP Response Code : 201 CREATED

### ๋ฉ”๋‰ด ๊ทธ๋ฃน ๋ฆฌ์ŠคํŠธ ์กฐํšŒํ•˜๊ธฐ (GET /api/menu-groups)

- HTTP Response Code : 200 OK

## ๋ฉ”๋‰ด

| ํ•œ๊ธ€๋ช… | ์˜๋ฌธ๋ช… | ์„ค๋ช… |
|-------------|--------------|----------------------------|
| ๋ฉ”๋‰ด | Menu | ๋ฉ”๋‰ด |
| ๋ฉ”๋‰ด ์•„์ด๋”” | id | ๋ฉ”๋‰ด ๊ณ ์œ  ๋ฒˆํ˜ธ |
| ๋ฉ”๋‰ด ์ด๋ฆ„ | name | ๋ฉ”๋‰ด์˜ ์ด๋ฆ„ |
| ๋ฉ”๋‰ด ๊ฐ€๊ฒฉ | price | ๋ฉ”๋‰ด์˜ ๊ฐ€๊ฒฉ |
| ์†ํ•œ ๋ฉ”๋‰ด๊ทธ๋ฃน ์•„์ด๋”” | menuGroupId | ํ•ด๋‹น ๋ฉ”๋‰ด๊ฐ€ ์†ํ•œ ๋ฉ”๋‰ด๊ทธ๋ฃน ์•„์ด๋”” |
| ๋ฉ”๋‰ด์˜ ์ƒํ’ˆ ๋ฆฌ์ŠคํŠธ | menuProducts | ํ•ด๋‹น ๋ฉ”๋‰ด๋ฅผ ๋งŒ๋“œ๋Š”๋ฐ ํ•„์š”ํ•œ ๋ชจ๋“  ์ƒํ’ˆ์˜ ๋ฆฌ์ŠคํŠธ |

- ๋ฉ”๋‰ด๋ฅผ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ๋‹ค.
- ๋ฉ”๋‰ด์˜ ๊ฐ€๊ฒฉ์€ 0์› ์ด์ƒ์ด์–ด์•ผ ํ•œ๋‹ค.
- ํ•˜๋‚˜์˜ ๋ฉ”๋‰ด์—๋Š” ์—ฌ๋Ÿฌ๊ฐœ์˜ ์ƒํ’ˆ์„ ํฌํ•จํ•  ์ˆ˜ ์žˆ๋‹ค.
- ๋ฉ”๋‰ด์˜ ๊ฐ€๊ฒฉ์€ ํฌํ•จํ•˜๋Š” ๋ชจ๋“  ์ƒํ’ˆ์˜ ์ดํ•ฉ์„ ์ดˆ๊ณผํ•  ์ˆ˜ ์—†๋‹ค.
- ๋ฉ”๋‰ด๋ฅผ ๋“ฑ๋กํ•  ๋•Œ ๋ฉ”๋‰ด ๊ทธ๋ฃน์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

### ๋ฉ”๋‰ด ์ƒ์„ฑํ•˜๊ธฐ (POST /api/menus)

- HTTP Response Code : 201 CREATED

### ๋ฉ”๋‰ด ๋ฆฌ์ŠคํŠธ ์กฐํšŒํ•˜๊ธฐ (GET /api/menus)

- HTTP Response Code : 200 OK

## ๋ฉ”๋‰ด ์ƒํ’ˆ

| ํ•œ๊ธ€๋ช… | ์˜๋ฌธ๋ช… | ์„ค๋ช… |
|--------|-------------|------------------------------|
| ๋ฉ”๋‰ด ์ƒํ’ˆ | MenuProduct | ๋ฉ”๋‰ด์— ์†ํ•œ ์ƒํ’ˆ ๋ฆฌ์ŠคํŠธ์— ๋Œ€ํ•œ ๊ด€๊ณ„ ๋„๋ฉ”์ธ ์—”ํ‹ฐํ‹ฐ |
| ์ƒํ’ˆ์˜ ์ˆœ์„œ | seq | ๋ฉ”๋‰ด ๋‚ด์—์„œ ์ƒํ’ˆ์ด ์œ„์น˜ํ•œ ์ˆœ์„œ |
| ๋ฉ”๋‰ด ์•„์ด๋”” | menuId | ์ƒํ’ˆ์ด ํฌํ•จ๋œ ๋ฉ”๋‰ด์˜ ์•„์ด๋”” |
| ์ƒํ’ˆ ์•„์ด๋”” | productId | ์ƒํ’ˆ์˜ ๊ณ ์œ ๋ฒˆํ˜ธ |
| ์ƒํ’ˆ ์ˆ˜๋Ÿ‰ | quantity | ํ•ด๋‹น ๋ฉ”๋‰ด์— ํฌํ•จ๋œ ์ƒํ’ˆ์˜ ๊ฐœ์ˆ˜ |

## ํ…Œ์ด๋ธ” ๊ทธ๋ฃน

| ํ•œ๊ธ€๋ช… | ์˜๋ฌธ๋ช… | ์„ค๋ช… |
|-------------|-------------|---------------------------------|
| ํ…Œ์ด๋ธ”๊ทธ๋ฃน | TableGroup | ์—ฌ๋Ÿฌ ํ…Œ์ด๋ธ”์˜ ๋ฌถ์Œ. ์—ฌ๋Ÿฌ ํ…Œ์ด๋ธ”์— ๊ฑธ์ณ์„œ ์ฃผ๋ฌธํ•˜๋Š” ๊ฒฝ์šฐ |
| ํ…Œ์ด๋ธ” ์•„์ด๋”” | id | ํ…Œ์ด๋ธ” ๊ทธ๋ฃน ๊ณ ์œ  ์‹๋ณ„์ž |
| ํ…Œ์ด๋ธ”๊ทธ๋ฃน ์ƒ์„ฑ ์‹œ๊ฐ„ | createdDate | ํ…Œ์ด๋ธ”๊ทธ๋ฃน์„ ์ƒ์„ฑํ•œ ์‹œ๊ฐ„ |
| ํ…Œ์ด๋ธ” ๋ฆฌ์ŠคํŠธ | orderTables | ํ•ด๋‹น ํ…Œ์ด๋ธ” ๊ทธ๋ฃน์— ์†ํ•œ ํ…Œ์ด๋ธ” ๋ฆฌ์ŠคํŠธ |

- ์—ฌ๋Ÿฌ๊ฐœ์˜ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์„ ๋ฌถ์–ด์„œ ๋‹จ์ฒด ์†๋‹˜์„ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค.
- ๋‹จ์ฒด ์†๋‹˜ ์ •๋ณด๋ฅผ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ๋‹ค.
- ๋‹จ์ฒด ์†๋‹˜์œผ๋กœ ์ง€์ •ํ•˜๋ ค๋ฉด ์ ์–ด๋„ ๋‘ ๊ฐœ ์ด์ƒ์˜ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์„ ๋ฌถ์–ด์•ผ ํ•œ๋‹ค. ํ•œ ๊ฐœ์˜ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์€ ๋‹จ์ฒด ์†๋‹˜์œผ๋กœ ์ง€์ •ํ•  ์ˆ˜ ์—†๋‹ค.
- ๋น„์–ด ์žˆ๋Š” ํ…Œ์ด๋ธ”์€ ๋‹จ์ฒด ์†๋‹˜ ์ •๋ณด์— ํฌํ•จํ•  ์ˆ˜ ์—†๋‹ค.
- ํ•˜๋‚˜์˜ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์„ ๋™์‹œ์— ๋‘ ๊ฐœ ์ด์ƒ์˜ ๋‹จ์ฒด ์†๋‹˜์œผ๋กœ ์ง€์ •ํ•  ์ˆ˜ ์—†๋‹ค.
- ๋‹จ์ฒด ์†๋‹˜์œผ๋กœ ์ง€์ •ํ–ˆ๋˜ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์„ ๋ณ„๋„๋กœ ๋ถ„๋ฆฌํ•˜๋Š” ๊ฒƒ๋„ ๊ฐ€๋Šฅํ•˜๋‹ค.
- ๊ณ„์‚ฐ์„ ์™„๋ฃŒํ•œ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”๋งŒ ๋‹จ์ฒด ์†๋‹˜์—์„œ ๋ถ„๋ฆฌํ•  ์ˆ˜ ์—†๋‹ค.

### ํ…Œ์ด๋ธ” ๊ทธ๋ฃน ์ƒ์„ฑํ•˜๊ธฐ (POST /api/table-groups)

- HTTP Response Code : 201 CREATED

### ํ…Œ์ด๋ธ” ๊ทธ๋ฃน ํ•ด์ œํ•˜๊ธฐ (DELETE /api/table-groups/{tableGroupId})

- HTTP Response Code : 204 No Content

## ์ฃผ๋ฌธ

| ํ•œ๊ธ€๋ช… | ์˜๋ฌธ๋ช… | ์„ค๋ช… |
|---------------|----------------|------------------------------------------|
| ์ฃผ๋ฌธ | Order | ์ฃผ๋ฌธ ์ •๋ณด ๋„๋ฉ”์ธ ์—”ํ‹ฐํ‹ฐ |
| ์ฃผ๋ฌธ ์•„์ด๋”” | id | ์ฃผ๋ฌธ ๊ณ ์œ  ๋ฒˆํ˜ธ |
| ์ฃผ๋ฌธ ํ…Œ์ด๋ธ” ์•„์ด๋”” | orderTableId | ์ฃผ๋ฌธ์„ ์š”์ฒญํ•œ ํ…Œ์ด๋ธ” ์•„์ด๋”” |
| ์ฃผ๋ฌธ ์ƒํƒœ | orderStatus | COOKING, MEAL, COMPLETION ์ค‘์— ํ•˜๋‚˜์˜ ์ƒํƒœ๋ฅผ ๊ฐ€์ง„๋‹ค |
| ์ฃผ๋ฌธ ์š”์ฒญ ์‹œ๊ฐ„ | orderedTime | ์ฃผ๋ฌธ ์š”์ฒญ์ด ์ด๋ฃจ์–ด์ง„ ์‹œ๊ฐ„ |
| ์ฃผ๋ฌธ ๋‚ด ๋ฉ”๋‰ด ์ˆ˜๋Ÿ‰ ์ •๋ณด | orderLineItems | ์ฃผ๋ฌธ ๋‚ด ๋ฉ”๋‰ด ๋ฆฌ์ŠคํŠธ. ๊ฐœ๋ณ„ ๋ฉ”๋‰ด์˜ ์ˆ˜๋Ÿ‰ ์ •๋ณด๋ฅผ ํฌํ•จํ•œ๋‹ค |

## ์ฃผ๋ฌธ ํ•ญ๋ชฉ

| ํ•œ๊ธ€๋ช… | ์˜๋ฌธ๋ช… | ์„ค๋ช… |
|--------|---------------|------------------------------|
| ์ฃผ๋ฌธ ํ•ญ๋ชฉ | OrderLineItem | ์ฃผ๋ฌธ์— ํฌํ•จ๋œ ๋ฉ”๋‰ด์˜ ์ƒ์„ธ ์ •๋ณด ๊ด€๊ณ„ ๋„๋ฉ”์ธ ์—”ํ‹ฐํ‹ฐ |
| ๋ฉ”๋‰ด์˜ ์ˆœ์„œ | seq | ์ฃผ๋ฌธ ํ•ญ๋ชฉ ๋‚ด ๋ฉ”๋‰ด์˜ ์ˆœ์„œ |
| ์ฃผ๋ฌธ ์•„์ด๋”” | orderId | ํ•ด๋‹น ์ฃผ๋ฌธ ํ•ญ๋ชฉ์ด ์†ํ•˜๋Š” ์ฃผ๋ฌธ์˜ ๊ณ ์œ  ์‹๋ณ„์ž |
| ๋ฉ”๋‰ด ์•„์ด๋”” | menuId | ํ•ด๋‹น ์ฃผ๋ฌธ ํ•ญ๋ชฉ์ด ๊ฐ€๋ฆฌํ‚ค๋Š” ๋ฉ”๋‰ด์˜ ๊ณ ์œ  ์‹๋ณ„์ž |
| ์ฃผ๋ฌธ ์ˆ˜๋Ÿ‰ | quantity | ์ฃผ๋ฌธํ•œ ๋ฉ”๋‰ด์˜ ์ˆ˜๋Ÿ‰ |

- ์ฃผ๋ฌธ ์š”์ฒญ์ด ๋“ค์–ด์˜ค๋ฉด ์„œ๋ฒ„์— ์ •๋ณด๋ฅผ ์ €์žฅํ•œ๋‹ค.
- ์ฃผ๋ฌธ์—๋Š” ์—ฌ๋Ÿฌ๊ฐœ์˜ ํ•ญ๋ชฉ์„ ํฌํ•จํ•  ์ˆ˜ ์žˆ๋‹ค.
- 1๊ฐœ ์ด์ƒ์˜ ํ•ญ๋ชฉ์„ ์„ ํƒํ•ด์•ผ๋งŒ ์ฃผ๋ฌธ์„ ์š”์ฒญํ•  ์ˆ˜ ์žˆ๋‹ค.
- ์ฃผ๋ฌธ ๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ˆ˜๋„ ์žˆ๋‹ค.
- ์™ธ๋ถ€ ์‹œ์Šคํ…œ์—์„œ ์ฒ˜๋ฆฌ๋ฅผ ํ•œ ๋’ค์— ์ฃผ๋ฌธ ์ƒํƒœ๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ๋„ ๊ฐ€๋Šฅํ•˜๋‹ค.
- ์กฐ๋ฆฌ์ค‘ ๋˜๋Š” ์‹์‚ฌ์ค‘ ์ƒํƒœ์ธ ์ฃผ๋ฌธ๋งŒ ์ƒํƒœ๋ฅผ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅํ•˜๋‹ค. ๊ณ„์‚ฐ ์™„๋ฃŒํ•œ ๋’ค์—๋Š” ๋” ์ด์ƒ ์ฃผ๋ฌธ ์ƒํƒœ๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์—†๋‹ค.

### ์ฃผ๋ฌธ ์ƒ์„ฑํ•˜๊ธฐ (POST /api/orders)

- HTTP Response Code : 201 CREATED

### ์ฃผ๋ฌธ ๋ฆฌ์ŠคํŠธ ์กฐํšŒํ•˜๊ธฐ (GET /api/orders)

- HTTP Response Code : 200 OK

### ์ฃผ๋ฌธ ์ƒํƒœ ๋ณ€๊ฒฝํ•˜๊ธฐ (PUT /api/orders/{orderId}/order-status)

- HTTP Response Code : 200 OK

## ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”

| ํ•œ๊ธ€๋ช… | ์˜๋ฌธ๋ช… | ์„ค๋ช… |
|---------------|----------------|----------------------------------------------------------|
| ์ฃผ๋ฌธ ํ…Œ์ด๋ธ” | OrderTable | ์ฃผ๋ฌธ์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ํ…Œ์ด๋ธ” ๋‹จ์œ„๋กœ ์š”์ฒญํ•œ๋‹ค. ํ…Œ์ด๋ธ”์„ ์—ฌ๋Ÿฌ๊ฐœ ๋ฌถ์–ด์„œ ํ…Œ์ด๋ธ” ๊ทธ๋ฃน์œผ๋กœ ๊ด€๋ฆฌํ•  ์ˆ˜๋„ ์žˆ๋‹ค. |
| ์ฃผ๋ฌธ ํ…Œ์ด๋ธ” ์•„์ด๋”” | id | ์ฃผ๋ฌธํ…Œ์ด๋ธ” ๊ณ ์œ  ๋ฒˆํ˜ธ |
| ์ฃผ๋ฌธ ํ…Œ์ด๋ธ” ๊ทธ๋ฃน ์•„์ด๋”” | tableGroupId | ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์ด ์†ํ•œ ํ…Œ์ด๋ธ” ๊ทธ๋ฃน์˜ ๊ณ ์œ  ์‹๋ณ„์ž |
| ์†๋‹˜ ์ˆ˜ | numberOfGuests | ํ•ด๋‹น ํ…Œ์ด๋ธ”์— ์•‰์€ ์†๋‹˜์˜ ์ˆซ์ž |
| ๋นˆ ํ…Œ์ด๋ธ” ์—ฌ๋ถ€ | empty | ํ•ด๋‹น ํ…Œ์ด๋ธ”์— ์†๋‹˜์ด ์žˆ๋Š”์ง€ ์—†๋Š”์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•œ ํ”Œ๋ž˜๊ทธ ๋ณ€์ˆ˜ |

- ์ฃผ๋ฌธ ํ…Œ์ด๋ธ” ์ •๋ณด๋ฅผ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ๋‹ค.
- ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์˜ ๋ชฉ๋ก์„ ์กฐํšŒํ•  ์ˆ˜ ์žˆ๋‹ค.
- ๊ณ„์‚ฐ์„ ๋งˆ์นœ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์€ ๋น„์–ด์žˆ๋Š” ํ…Œ์ด๋ธ”๋กœ ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ๋‹ค.
- ๋‹จ์ฒด ์†๋‹˜์œผ๋กœ ์ง€์ •ํ•œ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์€ ๋นˆ ํ…Œ์ด๋ธ”๋กœ ํ‘œ์‹œํ•  ์ˆ˜ ์—†๋‹ค.
- ์กฐ๋ฆฌ์ค‘ ๋˜๋Š” ์‹์‚ฌ์ค‘ ์ƒํƒœ์ธ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์€ ๋นˆ ํ…Œ์ด๋ธ”๋กœ ๋งŒ๋“ค ์ˆ˜ ์—†๊ณ , ๊ณ„์‚ฐ ์™„๋ฃŒํ•œ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”๋งŒ ๋นˆ ํ…Œ์ด๋ธ”๋กœ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค.
- ํ…Œ์ด๋ธ”์— ์•‰์•„ ์žˆ๋Š” ์†๋‹˜์˜ ์ˆซ์ž๋ฅผ ๊ธฐ๋กํ•  ์ˆ˜ ์žˆ๋‹ค.
- ํ…Œ์ด๋ธ”์—๋Š” ํ•ญ์ƒ 1๋ช… ์ด์ƒ์˜ ์†๋‹˜์ด ์•‰์•„์žˆ๋‹ค.
- ๋นˆ ํ…Œ์ด๋ธ”์€ ์†๋‹˜์˜ ์ˆซ์ž๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์—†๋‹ค.

## ํ…Œ์ด๋ธ” ์ƒ์„ฑ (POST /api/tables)

- HTTP Response Code : 201 CREATED

### ํ…Œ์ด๋ธ” ๋ฆฌ์ŠคํŠธ ์กฐํšŒ (GET /api/tables)

- HTTP Response Code : 200 OK

### ๋นˆ ํ…Œ์ด๋ธ”๋กœ ํ‘œ์‹œํ•˜๊ธฐ (PUT /api/tables/{orderTableId}/empty)

- HTTP Response Code : 200 OK

### ํ…Œ์ด๋ธ”์˜ ์†๋‹˜ ์ˆซ์ž ๋ณ€๊ฒฝํ•˜๊ธฐ (PUT /api/tables/{orderTableId}/number-of-guests)

- HTTP Response Code : 200 OK

## ์šฉ์–ด ์‚ฌ์ „

| ํ•œ๊ธ€๋ช… | ์˜๋ฌธ๋ช… | ์„ค๋ช… |
| --- | --- | --- |
| ์ƒํ’ˆ | product | ๋ฉ”๋‰ด๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ๊ธฐ์ค€์ด ๋˜๋Š” ๋ฐ์ดํ„ฐ |
| ๋ฉ”๋‰ด ๊ทธ๋ฃน | menu group | ๋ฉ”๋‰ด ๋ฌถ์Œ, ๋ถ„๋ฅ˜ |
| ๋ฉ”๋‰ด | menu | ๋ฉ”๋‰ด ๊ทธ๋ฃน์— ์†ํ•˜๋Š” ์‹ค์ œ ์ฃผ๋ฌธ ๊ฐ€๋Šฅ ๋‹จ์œ„ |
| ๋ฉ”๋‰ด ์ƒํ’ˆ | menu product | ๋ฉ”๋‰ด์— ์†ํ•˜๋Š” ์ˆ˜๋Ÿ‰์ด ์žˆ๋Š” ์ƒํ’ˆ |
| ๊ธˆ์•ก | amount | ๊ฐ€๊ฒฉ * ์ˆ˜๋Ÿ‰ |
| ์ฃผ๋ฌธ ํ…Œ์ด๋ธ” | order table | ๋งค์žฅ์—์„œ ์ฃผ๋ฌธ์ด ๋ฐœ์ƒํ•˜๋Š” ์˜์—ญ |
| ๋นˆ ํ…Œ์ด๋ธ” | empty table | ์ฃผ๋ฌธ์„ ๋“ฑ๋กํ•  ์ˆ˜ ์—†๋Š” ์ฃผ๋ฌธ ํ…Œ์ด๋ธ” |
| ์ฃผ๋ฌธ | order | ๋งค์žฅ์—์„œ ๋ฐœ์ƒํ•˜๋Š” ์ฃผ๋ฌธ |
| ์ฃผ๋ฌธ ์ƒํƒœ | order status | ์ฃผ๋ฌธ์€ ์กฐ๋ฆฌ โžœ ์‹์‚ฌ โžœ ๊ณ„์‚ฐ ์™„๋ฃŒ ์ˆœ์„œ๋กœ ์ง„ํ–‰๋œ๋‹ค. |
| ํ•œ๊ธ€๋ช… | ์˜๋ฌธ๋ช… | ์„ค๋ช… |
|----------|------------------|-------------------------------|
| ์ƒํ’ˆ | product | ๋ฉ”๋‰ด๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ๊ธฐ์ค€์ด ๋˜๋Š” ๋ฐ์ดํ„ฐ |
| ๋ฉ”๋‰ด ๊ทธ๋ฃน | menu group | ๋ฉ”๋‰ด ๋ฌถ์Œ, ๋ถ„๋ฅ˜ |
| ๋ฉ”๋‰ด | menu | ๋ฉ”๋‰ด ๊ทธ๋ฃน์— ์†ํ•˜๋Š” ์‹ค์ œ ์ฃผ๋ฌธ ๊ฐ€๋Šฅ ๋‹จ์œ„ |
| ๋ฉ”๋‰ด ์ƒํ’ˆ | menu product | ๋ฉ”๋‰ด์— ์†ํ•˜๋Š” ์ˆ˜๋Ÿ‰์ด ์žˆ๋Š” ์ƒํ’ˆ |
| ๊ธˆ์•ก | amount | ๊ฐ€๊ฒฉ * ์ˆ˜๋Ÿ‰ |
| ์ฃผ๋ฌธ ํ…Œ์ด๋ธ” | order table | ๋งค์žฅ์—์„œ ์ฃผ๋ฌธ์ด ๋ฐœ์ƒํ•˜๋Š” ์˜์—ญ |
| ๋นˆ ํ…Œ์ด๋ธ” | empty table | ์ฃผ๋ฌธ์„ ๋“ฑ๋กํ•  ์ˆ˜ ์—†๋Š” ์ฃผ๋ฌธ ํ…Œ์ด๋ธ” |
| ์ฃผ๋ฌธ | order | ๋งค์žฅ์—์„œ ๋ฐœ์ƒํ•˜๋Š” ์ฃผ๋ฌธ |
| ์ฃผ๋ฌธ ์ƒํƒœ | order status | ์ฃผ๋ฌธ์€ ์กฐ๋ฆฌ โžœ ์‹์‚ฌ โžœ ๊ณ„์‚ฐ ์™„๋ฃŒ ์ˆœ์„œ๋กœ ์ง„ํ–‰๋œ๋‹ค. |
| ๋ฐฉ๋ฌธํ•œ ์†๋‹˜ ์ˆ˜ | number of guests | ํ•„์ˆ˜ ์‚ฌํ•ญ์€ ์•„๋‹ˆ๋ฉฐ ์ฃผ๋ฌธ์€ 0๋ช…์œผ๋กœ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ๋‹ค. |
| ๋‹จ์ฒด ์ง€์ • | table group | ํ†ตํ•ฉ ๊ณ„์‚ฐ์„ ์œ„ํ•ด ๊ฐœ๋ณ„ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์„ ๊ทธ๋ฃนํ™”ํ•˜๋Š” ๊ธฐ๋Šฅ |
| ์ฃผ๋ฌธ ํ•ญ๋ชฉ | order line item | ์ฃผ๋ฌธ์— ์†ํ•˜๋Š” ์ˆ˜๋Ÿ‰์ด ์žˆ๋Š” ๋ฉ”๋‰ด |
| ๋งค์žฅ ์‹์‚ฌ | eat in | ํฌ์žฅํ•˜์ง€ ์•Š๊ณ  ๋งค์žฅ์—์„œ ์‹์‚ฌํ•˜๋Š” ๊ฒƒ |
| ๋‹จ์ฒด ์ง€์ • | table group | ํ†ตํ•ฉ ๊ณ„์‚ฐ์„ ์œ„ํ•ด ๊ฐœ๋ณ„ ์ฃผ๋ฌธ ํ…Œ์ด๋ธ”์„ ๊ทธ๋ฃนํ™”ํ•˜๋Š” ๊ธฐ๋Šฅ |
| ์ฃผ๋ฌธ ํ•ญ๋ชฉ | order line item | ์ฃผ๋ฌธ์— ์†ํ•˜๋Š” ์ˆ˜๋Ÿ‰์ด ์žˆ๋Š” ๋ฉ”๋‰ด |
| ๋งค์žฅ ์‹์‚ฌ | eat in | ํฌ์žฅํ•˜์ง€ ์•Š๊ณ  ๋งค์žฅ์—์„œ ์‹์‚ฌํ•˜๋Š” ๊ฒƒ |
3 changes: 3 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
logging.level.org.springframework.jdbc.core=TRACE
spring.datasource.url=jdbc:h2:~/kitchenpos;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.h2.console.enabled=true
73 changes: 73 additions & 0 deletions src/test/java/kitchenpos/application/MenuGroupServiceTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package kitchenpos.application;

import kitchenpos.dao.MenuGroupDao;
import kitchenpos.domain.MenuGroup;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;

import java.util.Arrays;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;

@ExtendWith(MockitoExtension.class)
@DisplayName("MenuGroupService ํด๋ž˜์Šค ํ…Œ์ŠคํŠธ")
public class MenuGroupServiceTest {
@Mock
private MenuGroupDao menuGroupDao;
@InjectMocks
private MenuGroupService menuGroupService;

@Nested
@DisplayName("create ๋ฉ”์„œ๋“œ ํ…Œ์ŠคํŠธ")
public class CreateMethod {
@Test
@DisplayName("๋ฉ”๋‰ด๊ทธ๋ฃน ์ƒ์„ฑ ์„ฑ๊ณต")
public void success() {
// given
final MenuGroup mockMenuGroup = setupSuccess("test menu group");

// when
final MenuGroup createdMenuGroup = menuGroupService.create(mockMenuGroup);

// then
assertThat(createdMenuGroup.getName()).isEqualTo(mockMenuGroup.getName());
}

private MenuGroup setupSuccess(String name) {
final MenuGroup mockMenuGroup = new MenuGroup();
mockMenuGroup.setName("test menu group");
Comment on lines +43 to +45

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private MenuGroup setupSuccess(String name) {
final MenuGroup mockMenuGroup = new MenuGroup();
mockMenuGroup.setName("test menu group");
private MenuGroup setupSuccess(String name) {
final MenuGroup mockMenuGroup = new MenuGroup();
mockMenuGroup.setName(name);

๋น ํŠธ๋ฆฌ์‹ ๊ฒƒ ๊ฐ™์•„์š” ๐Ÿ˜€

Mockito.when(menuGroupDao.save(Mockito.any())).thenReturn(mockMenuGroup);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Mockito.when(menuGroupDao.save(Mockito.any())).thenReturn(mockMenuGroup);
BDDMockito.given(menuGroupDao.save(Mockito.any())).willReturn(mockMenuGroup);

BDDMockito๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด given when then ์Šคํƒ€์ผ์— ๋งž๊ฒŒ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์–ด์š” ๐Ÿ˜€

return mockMenuGroup;
}
}

@Nested
@DisplayName("list ๋ฉ”์„œ๋“œ ํ…Œ์ŠคํŠธ")
public class ListMethod {
@Test
@DisplayName("๋ฉ”๋‰ด๊ทธ๋ฃน ์ƒ์„ฑ ์„ฑ๊ณต")
public void success() {
// given
final List<MenuGroup> mockMenuGroups = setupSuccess();

// when
final List<MenuGroup> createdMenuGroups = menuGroupService.list();

// then
assertThat(createdMenuGroups.size()).isEqualTo(mockMenuGroups.size());
}

private List<MenuGroup> setupSuccess() {
final List<MenuGroup> mockMenuGroups = Arrays.asList(new MenuGroup(), new MenuGroup(), new MenuGroup());
Mockito.when(menuGroupDao.findAll()).thenReturn(mockMenuGroups);
return mockMenuGroups;
}
}
}
Loading