Skip to content

Commit

Permalink
Merge pull request #193 from Lotte-Feelmycode/Hotfix
Browse files Browse the repository at this point in the history
!HOTFIX: coupon list api
  • Loading branch information
daeunchung authored Nov 8, 2022
2 parents ae235e1 + 97ae56c commit 2f53af1
Showing 1 changed file with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package com.feelmycode.parabole.controller;

import com.feelmycode.parabole.domain.Coupon;
import com.feelmycode.parabole.domain.Seller;
import com.feelmycode.parabole.domain.User;
import com.feelmycode.parabole.domain.UserCoupon;
import com.feelmycode.parabole.dto.CouponAssignRequestDto;
import com.feelmycode.parabole.dto.CouponCreateRequestDto;
import com.feelmycode.parabole.dto.CouponCreateResponseDto;
import com.feelmycode.parabole.dto.CouponInfoResponseDto;
import com.feelmycode.parabole.dto.CouponSellerResponseDto;
import com.feelmycode.parabole.dto.CouponUseAndAssignRequestDto;
import com.feelmycode.parabole.dto.CouponUserResponseDto;
import com.feelmycode.parabole.global.api.ParaboleResponse;
import com.feelmycode.parabole.global.error.exception.NoDataException;
import com.feelmycode.parabole.global.error.exception.ParaboleException;
import com.feelmycode.parabole.repository.UserCouponRepository;
import com.feelmycode.parabole.repository.UserRepository;
import com.feelmycode.parabole.service.CouponService;
import com.feelmycode.parabole.dto.CouponInfoResponseDto;
import com.feelmycode.parabole.dto.CouponCreateRequestDto;
import com.feelmycode.parabole.dto.CouponCreateResponseDto;
import com.feelmycode.parabole.dto.CouponSellerResponseDto;
import com.feelmycode.parabole.dto.CouponUserResponseDto;
import com.feelmycode.parabole.service.SellerService;
import com.feelmycode.parabole.service.UserService;
import java.util.ArrayList;
Expand Down Expand Up @@ -113,21 +114,21 @@ public ResponseEntity<ParaboleResponse> getUserCouponList(@RequestParam Long use
true, "유저 쿠폰 목록", userCouponList);
}

// @GetMapping("/list")
// public ResponseEntity<ParaboleResponse> getCouponList(@RequestParam Long userId) {
//
// Pageable getPageable = PageRequest.of(DEFAULT_PAGE, DEFAULT_SIZE);
//
// if(userService.isSeller(userId)){
// Page<CouponUserResponseDto> userCouponList = couponService.getUserCouponList(userId);
// return ParaboleResponse.CommonResponse(HttpStatus.OK,
// true, "유저 쿠폰 목록", userCouponList);
// }
// Seller seller = sellerService.getSellerByUserId(userId);
// Page<CouponSellerResponseDto> sellerCouponList = couponService.getSellerCouponList(seller.getId());
// return ParaboleResponse.CommonResponse(HttpStatus.OK,
// true, "셀러 쿠폰 목록", sellerCouponList);
// }
@GetMapping("/list")
public ResponseEntity<ParaboleResponse> getCouponList(@RequestParam Long userId) {

Pageable getPageable = PageRequest.of(DEFAULT_PAGE, DEFAULT_SIZE);

if(userService.isSeller(userId)){
Page<CouponUserResponseDto> userCouponList = couponService.getUserCouponList(userId);
return ParaboleResponse.CommonResponse(HttpStatus.OK,
true, "유저 쿠폰 목록", userCouponList);
}
Seller seller = sellerService.getSellerByUserId(userId);
Page<CouponSellerResponseDto> sellerCouponList = couponService.getSellerCouponList(seller.getId());
return ParaboleResponse.CommonResponse(HttpStatus.OK,
true, "셀러 쿠폰 목록", sellerCouponList);
}

@GetMapping("/info")
public ResponseEntity<ParaboleResponse> getCouponInfo(@RequestParam String couponSNo) {
Expand Down

0 comments on commit 2f53af1

Please sign in to comment.