-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from connecSWUn/fix/complete-order
[FEAT] 메뉴 별 주문 상태 수정 API 구현
- Loading branch information
Showing
13 changed files
with
174 additions
and
6 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...eatswunee/domain/ordermenu/adpater/in/web/controller/UpdateOrderMenuStatusController.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,33 @@ | ||
package com.swulab.eatswunee.domain.ordermenu.adpater.in.web.controller; | ||
|
||
import com.swulab.eatswunee.domain.ordermenu.adpater.in.web.dto.request.UpdateOrderMenuStatusRequest; | ||
import com.swulab.eatswunee.domain.ordermenu.adpater.in.web.dto.response.UpdateOrderMenuStatusResponse; | ||
import com.swulab.eatswunee.domain.ordermenu.application.port.in.UpdateOrderMenuStatusUseCase; | ||
import com.swulab.eatswunee.domain.ordermenu.application.port.in.command.UpdateOrderMenuStatusCommand; | ||
import com.swulab.eatswunee.global.common.adapter.web.in.dto.SuccessResponse; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
public class UpdateOrderMenuStatusController { | ||
|
||
public final UpdateOrderMenuStatusUseCase updateOrderMenuStatusUseCase; | ||
|
||
@PatchMapping("/orderMenu/orderMenuStatus") | ||
public ResponseEntity updateOrderMenuStatus(@RequestBody UpdateOrderMenuStatusRequest request) { | ||
|
||
UpdateOrderMenuStatusCommand command = updateOrderMenuStatusUseCase.updateOrderMenuStatus(request.getOrderMenuId(), request.getOrderMenuStatus()); | ||
UpdateOrderMenuStatusResponse response = new UpdateOrderMenuStatusResponse(command); | ||
|
||
return ResponseEntity.ok(SuccessResponse.create200SuccessResponse(response)); | ||
|
||
|
||
|
||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
...b/eatswunee/domain/ordermenu/adpater/in/web/dto/request/UpdateOrderMenuStatusRequest.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.swulab.eatswunee.domain.ordermenu.adpater.in.web.dto.request; | ||
|
||
import com.swulab.eatswunee.domain.ordermenu.domain.model.OrderMenuStatus; | ||
import lombok.Getter; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Getter | ||
@Slf4j | ||
public class UpdateOrderMenuStatusRequest { | ||
|
||
public Long orderMenuId; | ||
public OrderMenuStatus orderMenuStatus; | ||
|
||
public UpdateOrderMenuStatusRequest(Long orderMenuId, OrderMenuStatus orderMenuStatus) { | ||
|
||
this.orderMenuId = orderMenuId; | ||
this.orderMenuStatus = orderMenuStatus; | ||
|
||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...eatswunee/domain/ordermenu/adpater/in/web/dto/response/UpdateOrderMenuStatusResponse.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.swulab.eatswunee.domain.ordermenu.adpater.in.web.dto.response; | ||
|
||
import com.swulab.eatswunee.domain.ordermenu.application.port.in.command.UpdateOrderMenuStatusCommand; | ||
import com.swulab.eatswunee.domain.ordermenu.domain.model.OrderMenuStatus; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class UpdateOrderMenuStatusResponse { | ||
|
||
private Long order_menu_id; | ||
private OrderMenuStatus to_order_menu_status; | ||
|
||
public UpdateOrderMenuStatusResponse(UpdateOrderMenuStatusCommand command) { | ||
this.order_menu_id = command.getOrderMenuId(); | ||
this.to_order_menu_status = command.getOrderMenuStatus(); | ||
} | ||
} |
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
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
10 changes: 10 additions & 0 deletions
10
...m/swulab/eatswunee/domain/ordermenu/application/port/in/UpdateOrderMenuStatusUseCase.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,10 @@ | ||
package com.swulab.eatswunee.domain.ordermenu.application.port.in; | ||
|
||
import com.swulab.eatswunee.domain.ordermenu.application.port.in.command.UpdateOrderMenuStatusCommand; | ||
import com.swulab.eatswunee.domain.ordermenu.domain.model.OrderMenuStatus; | ||
|
||
public interface UpdateOrderMenuStatusUseCase { | ||
|
||
UpdateOrderMenuStatusCommand updateOrderMenuStatus(Long orderMenuId, OrderMenuStatus orderMenuStatus); | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
.../eatswunee/domain/ordermenu/application/port/in/command/UpdateOrderMenuStatusCommand.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.swulab.eatswunee.domain.ordermenu.application.port.in.command; | ||
|
||
import com.swulab.eatswunee.domain.ordermenu.domain.model.OrderMenuStatus; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class UpdateOrderMenuStatusCommand { | ||
|
||
private Long orderMenuId; | ||
private OrderMenuStatus orderMenuStatus; | ||
|
||
public UpdateOrderMenuStatusCommand(Long orderMenuId, | ||
OrderMenuStatus orderMenuStatus) { | ||
this.orderMenuId = orderMenuId; | ||
this.orderMenuStatus = orderMenuStatus; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...in/java/com/swulab/eatswunee/domain/ordermenu/application/port/out/SaveOrderMenuPort.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.swulab.eatswunee.domain.ordermenu.application.port.out; | ||
|
||
import com.swulab.eatswunee.domain.ordermenu.domain.model.OrderMenu; | ||
|
||
public interface SaveOrderMenuPort { | ||
|
||
OrderMenu saveOrderMenu(OrderMenu orderMenu); | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...ava/com/swulab/eatswunee/domain/ordermenu/application/service/UpdateOrderMenuService.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,29 @@ | ||
package com.swulab.eatswunee.domain.ordermenu.application.service; | ||
|
||
import com.swulab.eatswunee.domain.ordermenu.application.port.in.UpdateOrderMenuStatusUseCase; | ||
import com.swulab.eatswunee.domain.ordermenu.application.port.in.command.UpdateOrderMenuStatusCommand; | ||
import com.swulab.eatswunee.domain.ordermenu.application.port.out.FindOrderMenuPort; | ||
import com.swulab.eatswunee.domain.ordermenu.application.port.out.SaveOrderMenuPort; | ||
import com.swulab.eatswunee.domain.ordermenu.domain.model.OrderMenu; | ||
import com.swulab.eatswunee.domain.ordermenu.domain.model.OrderMenuStatus; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class UpdateOrderMenuService implements UpdateOrderMenuStatusUseCase { | ||
|
||
private final FindOrderMenuPort findOrderMenuPort; | ||
private final SaveOrderMenuPort saveOrderMenuPort; | ||
|
||
@Override | ||
public UpdateOrderMenuStatusCommand updateOrderMenuStatus(Long orderMenuId, OrderMenuStatus orderMenuStatus) { | ||
|
||
OrderMenu orderMenu = findOrderMenuPort.findOrderMenuPort(orderMenuId); | ||
orderMenu.changeOrderMenuStatusTo(orderMenuStatus); | ||
OrderMenu savedOrderMenu = saveOrderMenuPort.saveOrderMenu(orderMenu); | ||
|
||
return new UpdateOrderMenuStatusCommand(savedOrderMenu.getOrderMenuId(), savedOrderMenu.getOrderMenuStatus()); | ||
|
||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
src/main/java/com/swulab/eatswunee/domain/ordermenu/domain/model/OrderMenuStatus.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,7 @@ | ||
package com.swulab.eatswunee.domain.ordermenu.domain.model; | ||
|
||
public enum OrderMenuStatus { | ||
|
||
ONGOING, COMPLETED; | ||
|
||
} |
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