This repository has been archived by the owner on Aug 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
1,105 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,68 @@ | ||
# DoorRush | ||
|
||
|
||
<img width="600" alt="README 이미지_2" src="https://user-images.githubusercontent.com/56250078/151295612-86d6cf93-49ea-4c92-ba8a-d3c7c55d2400.png"> | ||
|
||
#### "Restaurnts and more, delivered to your door!" | ||
|
||
#### Door Dash, 배달의 민족을 모티브로 만든 배달 플랫폼 API 서버 프로젝트입니다. | ||
|
||
|
||
<br><br> | ||
|
||
### ![:풍선:](https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/[email protected]) **목표** | ||
|
||
- Door Dash/ 배달의 민족와 같은 배달 앱 서비스를 구현해 내는 것이 목표입니다. | ||
- 유지보수성을 위해 객체지향적 설계와 이론을 바탕으로 클린한 코드를 작성하는 것이 목표입니다. | ||
- 단순한 기능 구현뿐 아니라 대용량 트래픽 처리까지 고려한 기능을 구현하는 것이 목표입니다. | ||
- 테스트를 높은 우선순위를 두어 작성하여 Code Coverage 70%를 유지하고 있습니다. | ||
- CI/CD를 통한 자동화를 구현하여 쉽게 협업이 가능한 프로젝트로 만들고 있습니다. | ||
- Github, Slack을 통한 활발한 소통을 바탕으로 효율적인 협업을 추구합니다. | ||
|
||
<br><br> | ||
|
||
### ![:축구공:](https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/[email protected]) 기술적 이슈와 해결 과정 | ||
|
||
- [외부 API가 응답 코드조차 보낼 수 없는 장애가 발생했다면? Circuit Breaker Pattern로 해결하기](https://github.com/f-lab-edu/DoorRush/issues/67) <br> | ||
|
||
- [인증 기능에는 어떤 기술을 사용해야 할까?](https://github.com/ypr821/TIL/blob/main/2022_01/%EC%9D%B8%EC%A6%9D(Authentication)%EA%B3%BC_%EC%9D%B8%EA%B0%80(Authorization).md) <br> | ||
|
||
- [인증 관련 보안 이슈](https://github.com/ypr821/TIL/blob/main/2022_01/%EC%9E%90%EB%8F%99%EB%A1%9C%EA%B7%B8%EC%9D%B8%EA%B8%B0%EB%8A%A5_%EB%B3%B4%EC%95%88%EC%9D%B4%EC%8A%88_%EA%B3%A0%EB%AF%BC.md) <br> | ||
|
||
- [로그인 체크는 어떻게 하면 좋을까?](https://dev-promise.tistory.com/entry/%EB%A1%9C%EA%B7%B8%EC%9D%B8-%EC%B2%B4%ED%81%AC%EB%A5%BC-%EC%9C%84%ED%95%9C-%EA%B8%B0%EC%88%A0%EC%A0%81-%EA%B3%A0%EB%AF%BC) | ||
<br> | ||
|
||
|
||
|
||
<br><br> | ||
|
||
### ![:렌치:](https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-medium/[email protected]) **기술 스택** | ||
|
||
### **Java 11, Spring Boot 2.5.6, Spring MVC, MyBatis, gradle, MySQL** | ||
|
||
|
||
|
||
|
||
|
||
|
||
<br><br> | ||
|
||
### ![:책갈피_탭:](https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-large/[email protected])**ERD** | ||
|
||
![image](https://user-images.githubusercontent.com/56250078/152634236-79887af9-5b27-4265-ba99-e737e57c6016.png) | ||
|
||
|
||
<br><br> | ||
|
||
### 주요 기능 시퀀스 다이어그램 | ||
|
||
- 로그인 기능 | ||
![로그인시퀀스다이어그램](https://user-images.githubusercontent.com/56250078/152634301-141280e0-93ec-4b59-87e6-1f5c4f229603.png) | ||
|
||
|
||
|
||
|
||
<br><br> | ||
### ![:구급차:](https://a.slack-edge.com/production-standard-emoji-assets/13.0/google-large/[email protected]) 서버 구조도 | ||
- 링크 업데이트 예정 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/com/flab/doorrush/domain/order/api/OrderController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.flab.doorrush.domain.order.api; | ||
|
||
import com.flab.doorrush.domain.order.dto.request.MenuDTO; | ||
import com.flab.doorrush.domain.order.dto.request.OrderRequest; | ||
import com.flab.doorrush.domain.order.dto.response.CreateOrderResponse; | ||
import com.flab.doorrush.domain.order.dto.response.OrderMenusCartResponse; | ||
import com.flab.doorrush.domain.order.service.OrderService; | ||
import com.flab.doorrush.global.Response.BasicResponse; | ||
import java.util.List; | ||
import javax.servlet.http.HttpSession; | ||
import javax.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/orders/") | ||
@RequiredArgsConstructor | ||
public class OrderController { | ||
|
||
private final OrderService orderService; | ||
|
||
@GetMapping("check-price") | ||
public ResponseEntity<BasicResponse<OrderMenusCartResponse>> checkPrice(@RequestBody @Valid List<MenuDTO> menus) { | ||
return ResponseEntity.status(HttpStatus.OK) | ||
.body(BasicResponse.success(orderService.getTotalPrice(menus))); | ||
} | ||
|
||
@PostMapping | ||
public ResponseEntity<BasicResponse<CreateOrderResponse>> createOrder( | ||
@RequestBody @Valid OrderRequest orderRequest, | ||
HttpSession session) { | ||
CreateOrderResponse response = orderService.createOrder(orderRequest, | ||
session.getAttribute("loginId").toString()); | ||
return ResponseEntity.status(HttpStatus.CREATED).body(BasicResponse.success(response) | ||
); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/flab/doorrush/domain/order/dao/OrderMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.flab.doorrush.domain.order.dao; | ||
|
||
import com.flab.doorrush.domain.order.domain.Order; | ||
import com.flab.doorrush.domain.order.domain.OrderMenu; | ||
import com.flab.doorrush.domain.order.dto.request.MenuDTO; | ||
import com.flab.doorrush.domain.order.dto.response.OrderHistory; | ||
import com.flab.doorrush.domain.order.dto.response.OrderMenuPrice; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import org.apache.ibatis.annotations.Mapper; | ||
|
||
@Mapper | ||
public interface OrderMapper { | ||
|
||
void insertOrder(Order order); | ||
|
||
void insertOrderMenu(List<OrderMenu> orderMenus); | ||
|
||
List<OrderHistory> selectOrderBySeq(Long orderSeq); | ||
|
||
Optional<OrderMenuPrice> selectPriceByMenuDTO(MenuDTO menuDTO); | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/flab/doorrush/domain/order/domain/Order.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.flab.doorrush.domain.order.domain; | ||
|
||
import java.time.LocalDateTime; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Builder | ||
@Getter | ||
public class Order { | ||
|
||
private Long orderSeq; | ||
private Long userSeq; | ||
private String address; | ||
private Long restaurantSeq; | ||
private String restaurantName; | ||
private OrderStatus orderStatus; | ||
private Long amount; | ||
private LocalDateTime orderTime; | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/flab/doorrush/domain/order/domain/OrderMenu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.flab.doorrush.domain.order.domain; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
public class OrderMenu { | ||
|
||
private Long menuSeq; | ||
private Long orderSeq; | ||
private int count; | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/com/flab/doorrush/domain/order/domain/OrderStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.flab.doorrush.domain.order.domain; | ||
|
||
public enum OrderStatus { | ||
READY, REQUEST_PAY, APPROVAL_PAY, COMPLETE_PAY, CANCEL ; | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/flab/doorrush/domain/order/dto/request/MenuDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.flab.doorrush.domain.order.dto.request; | ||
|
||
import com.flab.doorrush.domain.order.domain.OrderMenu; | ||
import javax.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
public class MenuDTO { | ||
@NotNull | ||
private Long menuSeq; | ||
@NotNull | ||
private int count; | ||
|
||
public OrderMenu toEntity(Long orderSeq){ | ||
return OrderMenu.builder() | ||
.menuSeq(this.menuSeq) | ||
.orderSeq(orderSeq) | ||
.count(this.count) | ||
.build(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/flab/doorrush/domain/order/dto/request/OrderRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.flab.doorrush.domain.order.dto.request; | ||
|
||
import java.util.List; | ||
import javax.validation.constraints.NotEmpty; | ||
import javax.validation.constraints.NotNull; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class OrderRequest { | ||
|
||
@NotEmpty | ||
@NotNull | ||
private List<MenuDTO> menus; | ||
@NotNull | ||
private Long restaurantSeq; | ||
@NotNull | ||
private Long addressSeq; | ||
@NotNull | ||
private Long amount; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/flab/doorrush/domain/order/dto/response/CreateOrderResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.flab.doorrush.domain.order.dto.response; | ||
|
||
import com.flab.doorrush.domain.order.domain.Order; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Builder | ||
@Getter | ||
public class CreateOrderResponse { | ||
|
||
private Order order; | ||
|
||
public static CreateOrderResponse from(Order order) { | ||
return CreateOrderResponse.builder() | ||
.order(order) | ||
.build(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/flab/doorrush/domain/order/dto/response/OrderHistory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.flab.doorrush.domain.order.dto.response; | ||
|
||
import com.flab.doorrush.domain.order.domain.OrderStatus; | ||
import java.time.LocalDateTime; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
public class OrderHistory { | ||
|
||
private Long orderSeq; | ||
private String address; | ||
private Long restaurantSeq; | ||
private String restaurantName; | ||
private Long amount; | ||
private OrderStatus orderStatus; | ||
private String menuName; | ||
private String menuPrice; | ||
private String menuCount; | ||
private LocalDateTime orderTime; | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/flab/doorrush/domain/order/dto/response/OrderMenuPrice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.flab.doorrush.domain.order.dto.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class OrderMenuPrice { | ||
|
||
private String name; | ||
private Long price; | ||
private Long menuSumPrice; | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/flab/doorrush/domain/order/dto/response/OrderMenusCartResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.flab.doorrush.domain.order.dto.response; | ||
|
||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class OrderMenusCartResponse { | ||
private Long totalPrice; | ||
private List<OrderMenuPrice> orderMenuCarts; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/flab/doorrush/domain/order/exception/OrderException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.flab.doorrush.domain.order.exception; | ||
|
||
public class OrderException extends RuntimeException { | ||
|
||
public OrderException(String message) { | ||
super(message); | ||
} | ||
|
||
} |
Oops, something went wrong.