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

✏️ 재고 차감요청에 대한 return값 정의 #51

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kr.bb.store.domain.cargo.controller;

import bloomingblooms.domain.flower.StockChangeDto;
import bloomingblooms.response.CommonResponse;
import kr.bb.store.domain.cargo.facade.CargoFacade;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
Expand All @@ -14,12 +15,14 @@
public class CargoFeignController {
private final CargoFacade cargoFacade;
@PutMapping("/add")
public void addStock(@RequestBody List<StockChangeDto> stockChangeDtos) {
public CommonResponse addStock(@RequestBody List<StockChangeDto> stockChangeDtos) {
cargoFacade.plusStocksWithLock(stockChangeDtos);
return CommonResponse.success(null);
}

@PutMapping("/subtract")
public void subtractStock(@RequestBody List<StockChangeDto> stockChangeDtos) {
public CommonResponse subtractStock(@RequestBody List<StockChangeDto> stockChangeDtos) {
cargoFacade.minusStocksWithLock(stockChangeDtos);
return CommonResponse.success(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void plusStocksWithLock(List<StockChangeDto> stockChangeDtos) {
} catch (Exception e) {
Long userId = stockChangeDtos.get(0).getUserId();
String phoneNumber = stockChangeDtos.get(0).getPhoneNumber();
orderStatusSQSPublisher.publish(userId, phoneNumber, NotificationKind.INVALID_COUPON);
orderStatusSQSPublisher.publish(userId, phoneNumber, NotificationKind.OUT_OF_STOCK);
throw e;
}
}
Expand All @@ -75,7 +75,7 @@ public void minusStocksWithLock(List<StockChangeDto> stockChangeDtos) {
} catch (Exception e) {
Long userId = stockChangeDtos.get(0).getUserId();
String phoneNumber = stockChangeDtos.get(0).getPhoneNumber();
orderStatusSQSPublisher.publish(userId, phoneNumber, NotificationKind.INVALID_COUPON);
orderStatusSQSPublisher.publish(userId, phoneNumber, NotificationKind.OUT_OF_STOCK);
throw e;
}
}
Expand Down
Loading