-
Notifications
You must be signed in to change notification settings - Fork 0
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
상품 판매 등록 기능 구현 #10
base: main
Are you sure you want to change the base?
상품 판매 등록 기능 구현 #10
Conversation
@Size(max = 3, message = "이미지는 최대 3장까지 입니다.") @RequestPart("images") List<MultipartFile> images | ||
) { | ||
productService.createProduct(request, images); | ||
return ResponseEntity.ok().build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
작성이 완료되었다는거니까 OK 대신에 created
는 어떤가요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ea7fc42
수정했습니다.
|
||
@Getter | ||
@AllArgsConstructor | ||
public class CreateProductReq { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
record 클래스로 변경해주시면 좋을거같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
60f49b0
수정했습니다
import com.mango.amango.domain.product.entity.Product; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface ProductRepository extends CrudRepository<Product, Long> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CrudRepository
를 상속받으신 이유가 있나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4a6021f
spring data의 save 기능만을 생각하고 상속받았었는데 보고나니 Product는 나중에 기능을 추가하다보면 JPARepository가 필요할 것 같아서 수정 했습니다.
@Service | ||
@Transactional | ||
@RequiredArgsConstructor | ||
public class ProductService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
다른 서비스 파일들과 같게 Impl 파일을 사용하는 형식으로 바꾸면 좋을거같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auth 서비스는 로그인 방식이 바뀔 상황을 생각해서 전략 패턴으로 구현했는데 product 서비스 부분도 이와 같은 방법으로 구현하는게 좋을지 궁금합니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
인터페이스와 구현체를 분리하여 구현체를 독립적으로 확장할 수 있으며, 구현체 클래스를 변경하거나 확장해도 이를 사용하는 클라이언트의 코드에 영향을 주지 않습니다
이와 같이 구현을 하게 되면 객체지향의 5원칙중 OCP 원칙을 가장 잘 실행해주는 방법입니다.
또한 관습적으로 많이 사용하는 방법이기도 합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security Config에 endpoint 추가가 안된거같아요
💡 개요
상품 판매 등록 기능을 구현했습니다.
📃 작업내용
🔀 변경사항