-
Notifications
You must be signed in to change notification settings - Fork 54
Business Rule(Cart)
아이템 : 메뉴 + 옵션리스트
- 고객 로그인 상태에서만 장바구니를 이용 가능
- 장바구니는 Redis서버에 저장(캐싱)
- 장바구니에 있는 가격데이터는 데이터의 동일성을 보장하지 않으므로 주문시 가격을 다시 조회해야 함
- 장바구니 아이템은 수정이 불가능함.
- 장바구니 아이템은 삭제가 가능함.
- 동일한 종류의 아이템을 장바구니에 넣을 수 없음
동일 메뉴 조건
- 동일한 메뉴 id
- 동일한 옵션 리스트(옵션id)
- 최대 10개의 종류를 장바구니에 입력할 수 있음
- 동일한 매장의 메뉴만 장바구니에 담을 수 있음
장바구니에 아이템 입력 예시
url :(POST) http://localhost/members/cart/menus
body :
{ "menuInfo" : { "id" : "1", "name" : "바사삭치킨", "price" : "3000" }, "options" : [{ "id" : "1", "name" : "치즈추가", "price" : "2000" }], "count" : "1", "price" : "5000", "shopInfo" : { "id" : "3", "name" : "호식이 두마리 치킨" } }
성공시 상태값 : 200(OK)
url :(GET) http://localhost/members/cart/menus
결과 상태 : 200(OK)
결과 body : json 배열
예시 : [ { "menuInfo": { "id": 1, "name": "바사삭치킨", "price": 3000, "photo": null, "createdAt": null, "updatedAt": null, "status": null, "priority": null, "content": null, "menuGroupId": null, "optionList": null }, "options": [ { "id": 1, "name": "치즈추가", "price": 2000, "status": null, "menuId": null } ], "count": 1, "price": 5000, "shopInfo": { "id": 3, "name": "호식이 두마리 치킨", "deliveryType": null, "signatureMenuId": null, "tel": null, "addressCode": null, "addressDetail": null, "bizNumber": null, "info": null, "minOrderPrice": null, "notice": null, "operatingTime": null, "ownerId": null, "createdAt": null, "updatedAt": null, "status": null, "orderType": null, "originInfo": null, "workCondition": null } } ]
- 아이템의 순서를 지정하여 삭제할 수 있음
- 인덱스를 벗어나게 지정할 시 오류 발생
url :(DELETE) http://localhost/members/cart/menus/1
성공시 상태값 : 200(OK)
- 장바구니에 있는 모든 아이템을 삭제할 수 있음
url : (DELETE) http://localhost/members/cart/menus
성공시 상태값 : 200(OK)
- 장바구니 아이템들의 총 가격을 계산
url : (GET) http://localhost/members/cart/price
성공시 상태값 : 200(OK)
결과 예시 : `{ "totalPrice": 5000 }`