-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
✨ [FEATURE] 판매자의 상품 등록, 수정, 삭제 구현 (#25)
- Loading branch information
Showing
15 changed files
with
302 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/umc/unimade/domain/products/dto/OptionRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//package umc.unimade.domain.products.dto; | ||
// | ||
//import lombok.*; | ||
////import umc.unimade.domain.products.entity.Options; | ||
//import umc.unimade.domain.products.entity.ProductRegister; | ||
// | ||
//@Getter | ||
//@NoArgsConstructor | ||
//@AllArgsConstructor | ||
//public class OptionRequest { | ||
// private String name; | ||
// private String value; | ||
// | ||
// public Options toEntity(ProductRegister productRegister) { | ||
// return Options.builder() | ||
// .name(name) | ||
// .value(value) | ||
// .productRegister(productRegister) | ||
// .build(); | ||
// } | ||
//} |
73 changes: 73 additions & 0 deletions
73
src/main/java/umc/unimade/domain/products/dto/ProductRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package umc.unimade.domain.products.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import umc.unimade.domain.accounts.entity.Seller; | ||
import umc.unimade.domain.products.entity.*; | ||
import umc.unimade.global.registerStatus.RegisterStatus; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
public class ProductRequest { | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class CreateProductDto { // TODO - 셀러 추가 | ||
private String name; | ||
private String content; | ||
private Long price; | ||
private LocalDate deadline; | ||
private ProductStatus status; | ||
private String university; | ||
private PickupOption pickupOption; | ||
private String bankName; | ||
private String accountNumber; | ||
private String accountName; | ||
private RegisterStatus registerStatus; | ||
private Long sellerId; | ||
private Long categoryId; | ||
// private List<OptionRequest> options; | ||
|
||
public ProductRegister toEntity(Category category, Seller seller) { | ||
ProductRegister product = ProductRegister.builder() | ||
.name(name) | ||
.content(content) | ||
.price(price) | ||
.deadline(deadline) | ||
.status(status) | ||
.university(university) | ||
.pickupOption(pickupOption) | ||
.bankName(bankName) | ||
.accountNumber(accountNumber) | ||
.accountName(accountName) | ||
.registerStatus(registerStatus) | ||
.seller(seller) | ||
.category(category) | ||
.build(); | ||
|
||
return product; | ||
} | ||
} | ||
|
||
// 수정 dto | ||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class UpdateProductDto { | ||
private String name; | ||
private String content; | ||
private Long price; | ||
private LocalDate deadline; | ||
private ProductStatus status; | ||
private String university; | ||
private PickupOption pickupOption; | ||
private String bankName; | ||
private String accountNumber; | ||
private String accountName; | ||
private Long categoryId; | ||
// private List<OptionRequest> options; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/umc/unimade/domain/products/entity/ProductStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package umc.unimade.domain.products.entity; | ||
|
||
public enum ProductStatus { | ||
SOLDOUT | ||
SELLING, SOLDOUT | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/umc/unimade/domain/products/exception/ProductExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package umc.unimade.domain.products.exception; | ||
|
||
import umc.unimade.global.common.BaseErrorCode; | ||
import umc.unimade.global.common.exception.CustomException; | ||
|
||
public class ProductExceptionHandler extends CustomException { | ||
public ProductExceptionHandler(BaseErrorCode errorCode) { | ||
super(errorCode); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/umc/unimade/domain/products/repository/CategoryRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package umc.unimade.domain.products.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
import umc.unimade.domain.products.entity.Category; | ||
|
||
@Repository | ||
public interface CategoryRepository extends JpaRepository<Category, Long> { | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/umc/unimade/domain/products/repository/OptionsRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//package umc.unimade.domain.products.repository; | ||
// | ||
//import org.springframework.data.jpa.repository.JpaRepository; | ||
//import org.springframework.stereotype.Repository; | ||
//import umc.unimade.domain.products.entity.Options; | ||
// | ||
//@Repository | ||
//public interface OptionsRepository extends JpaRepository<Options, Long> { | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/umc/unimade/domain/products/repository/ProductsImageRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package umc.unimade.domain.products.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
import umc.unimade.domain.products.entity.ProductsImage; | ||
|
||
@Repository | ||
public interface ProductsImageRepository extends JpaRepository<ProductsImage, Long> { | ||
} |
Oops, something went wrong.