File tree Expand file tree Collapse file tree 4 files changed +8
-11
lines changed
src/main/java/com/trashheroesbe/feature Expand file tree Collapse file tree 4 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -77,9 +77,7 @@ public PurchaseUserCouponResponse purchaseCoupon(
7777 throw new BusinessException (COUPON_NOT_AVAILABLE );
7878 }
7979
80- if (coupon .getIssuedCount () >= coupon .getTotalStock ()) {
81- throw new BusinessException (COUPON_OUT_OF_STOCK );
82- }
80+ coupon .issue ();
8381
8482 Integer pointCost = coupon .getPointCost ();
8583 pointService .usePoint (
@@ -89,8 +87,6 @@ public PurchaseUserCouponResponse purchaseCoupon(
8987 request .couponId ()
9088 );
9189
92- coupon .issue ();
93-
9490 UserCoupon userCoupon = UserCoupon .create (user , coupon );
9591 UserCoupon savedUserCoupon = userCouponRepository .save (userCoupon );
9692
Original file line number Diff line number Diff line change 77import com .trashheroesbe .global .auth .security .CustomerDetails ;
88import com .trashheroesbe .global .response .ApiResponse ;
99import lombok .RequiredArgsConstructor ;
10+ import org .springframework .security .core .annotation .AuthenticationPrincipal ;
1011import org .springframework .web .bind .annotation .GetMapping ;
1112import org .springframework .web .bind .annotation .RequestMapping ;
1213import org .springframework .web .bind .annotation .RestController ;
@@ -20,7 +21,9 @@ public class PointController implements PointControllerApi {
2021
2122 @ Override
2223 @ GetMapping
23- public ApiResponse <UserPointResponse > getMyPoint (CustomerDetails customerDetails ) {
24+ public ApiResponse <UserPointResponse > getMyPoint (
25+ @ AuthenticationPrincipal CustomerDetails customerDetails
26+ ) {
2427 UserPointResponse response = pointService .getMyPoint (customerDetails .getUser ());
2528 return ApiResponse .success (OK , response );
2629 }
Original file line number Diff line number Diff line change 2424import org .springframework .retry .annotation .Backoff ;
2525import org .springframework .retry .annotation .Retryable ;
2626import org .springframework .stereotype .Service ;
27+ import org .springframework .transaction .annotation .Propagation ;
2728import org .springframework .transaction .annotation .Transactional ;
2829
2930@ Slf4j
@@ -74,11 +75,6 @@ public UserPointResponse getMyPoint(User user) {
7475 }
7576
7677 @ Transactional
77- @ Retryable (
78- retryFor = ObjectOptimisticLockingFailureException .class ,
79- maxAttempts = 3 ,
80- backoff = @ Backoff (delay = 100 )
81- )
8278 public void usePoint (
8379 Long userId ,
8480 Integer points ,
Original file line number Diff line number Diff line change 33import com .trashheroesbe .feature .rank .dto .response .RankResponse ;
44import com .trashheroesbe .global .response .ApiResponse ;
55import io .swagger .v3 .oas .annotations .Operation ;
6+ import io .swagger .v3 .oas .annotations .tags .Tag ;
67
8+ @ Tag (name = "Rank" , description = "랭킹 관련 API" )
79public interface TrashRankControllerApi {
810
911 @ Operation (summary = "현재 랭킹 조회" , description = "현재 누적된 쓰레기 검색 랭킹을 조회합니다.(3시간 마다 update)" )
You can’t perform that action at this time.
0 commit comments