Skip to content

Commit

Permalink
Feat: 업로드 로직 상위 메서드 예외 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
Taekgil99 committed Dec 1, 2022
1 parent 6bf761a commit c7b245d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.backend.domain.product.application;

import lombok.SneakyThrows;
import org.springframework.web.multipart.MultipartFile;

public interface ImageUploadService {
@SneakyThrows
String StoreImage(MultipartFile img);

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.backend.domain.user.domain.User;
import com.backend.domain.user.exception.MemberNotFound;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
Expand All @@ -39,6 +40,7 @@ public class ProductService {
private final CategoryRepository categoryRepository;
private final AwsS3Service awsS3Service;
// 제품 생성
@SneakyThrows
@Transactional
public Product create(Long userId, int price, String productName,TitleImg titleImg,DetailImg detailImg,String tag,Long categoryId){

Expand Down Expand Up @@ -72,6 +74,7 @@ public Product create(Long userId, int price, String productName,TitleImg titleI
}

// 상품 수정
@SneakyThrows
@Transactional
public Product update(Long productId, Long categoryId, int price , String productName, TitleImg titleImg, DetailImg detailImg) {
Product findProduct = productRepository.findById(productId).orElseThrow(ProductNotFound::new);
Expand Down Expand Up @@ -203,4 +206,4 @@ public List<Product> random() {
}
return list;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.backend.domain.user.domain.User;
import com.backend.domain.user.exception.MemberNotFound;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
Expand All @@ -38,6 +39,7 @@ public class ReviewService {

private final OrderProductRepository orderProductRepository;

@SneakyThrows
@Transactional
public Review create(Long userId,Long productId,String reviewContent,int star,ReviewImg reviewImg) {

Expand Down Expand Up @@ -76,6 +78,7 @@ public Review create(Long userId,Long productId,String reviewContent,int star,Re
log.info("리뷰 생성 ");
return reviewRepository.save(review);
}
@SneakyThrows
@Transactional
public Review update(Long reviewId, Long userId, String reviewContent, int star, ReviewImg reviewImg,String delete) {
log.info("upate 실행");
Expand Down

0 comments on commit c7b245d

Please sign in to comment.