Skip to content

Commit

Permalink
Merge pull request #194 from Troth-Cam/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
aeeazip authored Aug 21, 2023
2 parents c02ef0d + 208fab3 commit a70698d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public class ProductController {
/* 인증서 조회 */
@GetMapping("/products")
public BaseResponse<List<ProductsResDto>> findPublicProducts(
@RequestParam(value = "web-id") String webId, @RequestParam(value = "public") String isPublic) {
@RequestParam(value = "webToken") String webToken, @RequestParam(value = "public") String isPublic) {
List<ProductsResDto> result;
if (isPublic.equals("Y")) {
result = productService.findPublicProducts(webId);
result = productService.findPublicProducts(webToken);
} else if (isPublic.equals("N")) {
result = productService.findPrivateProducts(webId);
result = productService.findPrivateProducts(webToken);
} else throw new BaseException(ErrorCode._BAD_REQUEST);

if (result.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@Repository
public interface ProductRepository extends JpaRepository<Product, Long> {

List<Product> findAllByMember_WebIdAndPublicYn(String webId, PublicYn publicYn); // 인증서 조회
List<Product> findAllByMember_WebTokenAndPublicYn(String webToken, PublicYn publicYn); // 인증서 조회
List<Product> findAllByMember_IdAndPublicYn(Long id, PublicYn publicYn); // 인증서 조회

@Query(value = "select ap.history_id as historyId, ap.product_id as productId, ap.seller_id as sellerId, ap.buyer_id as buyerId, ap.price as price, ap.sold_at as soldAt, p.image_id as imageId, p.title as title, p.tags as tags\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
public class LoginWebResDto {
private String accessToken;
private String refreshToken;
private String webToken;
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public LoginWebResDto webLogin(LoginWebReqDto req) throws BaseException {
member.updateStatus("active"); // inactive -> active로 변환
memberRepository.save(member);

return new LoginWebResDto(newAccessToken, newRefreshToken);
return new LoginWebResDto(newAccessToken, newRefreshToken, member.getWebToken());
}

// 애플 로그인
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public class ProductService {

/* 공개 인증서 조회 */
@Transactional(readOnly = true)
public List<ProductsResDto> findPublicProducts(String webId) throws BaseException {
List<Product> findProducts = productRepository.findAllByMember_WebIdAndPublicYn(webId, PublicYn.Y);
public List<ProductsResDto> findPublicProducts(String webToken) throws BaseException {
List<Product> findProducts = productRepository.findAllByMember_WebTokenAndPublicYn(webToken, PublicYn.Y);

if (findProducts == null || findProducts.isEmpty())
throw new BaseException(ErrorCode.PRODUCT_NOT_FOUND);
Expand All @@ -74,8 +74,8 @@ public List<ProductsResDto> findPublicProducts(String webId) throws BaseExceptio

/* 비공개 인증서 조회 */
@Transactional(readOnly = true)
public List<ProductsResDto> findPrivateProducts(String webId) throws BaseException {
List<Product> findProducts = productRepository.findAllByMember_WebIdAndPublicYn(webId, PublicYn.N);
public List<ProductsResDto> findPrivateProducts(String webToken) throws BaseException {
List<Product> findProducts = productRepository.findAllByMember_WebTokenAndPublicYn(webToken, PublicYn.N);

if (findProducts == null || findProducts.isEmpty())
throw new BaseException(ErrorCode.PRODUCT_NOT_FOUND);
Expand Down

0 comments on commit a70698d

Please sign in to comment.