-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: meal type으로 음식 조회가 되지 않는 경우 조회 실패 구현(404 NOT FOUND)
- Loading branch information
Showing
10 changed files
with
73 additions
and
79 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
9 changes: 9 additions & 0 deletions
9
BE/src/main/java/sidedish/com/exception/NoSuchProductsException.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 sidedish.com.exception; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
|
||
@ResponseStatus(value = HttpStatus.NOT_FOUND) | ||
public class NoSuchProductsException extends RuntimeException { | ||
|
||
} |
17 changes: 9 additions & 8 deletions
17
BE/src/main/java/sidedish/com/repository/entity/DiscountPolicyEntity.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,26 +1,27 @@ | ||
package sidedish.com.repository.entity; | ||
|
||
import java.time.LocalDateTime; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.data.annotation.Id; | ||
import org.springframework.data.annotation.PersistenceConstructor; | ||
import org.springframework.data.relational.core.mapping.Table; | ||
|
||
@Getter | ||
@Setter | ||
@Table("DISCOUNT_POLICY") | ||
public class DiscountPolicyEntity { | ||
|
||
@Id | ||
private Long id; | ||
private String policyName; | ||
private float discountRate; | ||
private final Long id; | ||
private final String policyName; | ||
private final float discountRate; | ||
|
||
public DiscountPolicyEntity(String policyName) { | ||
@PersistenceConstructor | ||
public DiscountPolicyEntity(Long id, String policyName, float discountRate) { | ||
this.id = id; | ||
this.policyName = policyName; | ||
this.discountRate = discountRate; | ||
} | ||
|
||
public boolean isEqualsId(Long id) { | ||
return this.id == id; | ||
return this.id.equals(id); | ||
} | ||
} |
11 changes: 6 additions & 5 deletions
11
BE/src/main/java/sidedish/com/repository/entity/ImageEntity.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,20 +1,21 @@ | ||
package sidedish.com.repository.entity; | ||
|
||
import lombok.Getter; | ||
import lombok.ToString; | ||
import org.springframework.data.annotation.Id; | ||
import org.springframework.data.annotation.PersistenceConstructor; | ||
import org.springframework.data.relational.core.mapping.Table; | ||
|
||
@Getter | ||
@Table("PRODUCT_IMAGE") | ||
@ToString | ||
public class ImageEntity { | ||
|
||
@Id | ||
private Long id; | ||
private String imageUrl; | ||
private final Long id; | ||
private final String imageUrl; | ||
|
||
public ImageEntity(String imageUrl) { | ||
@PersistenceConstructor | ||
public ImageEntity(Long id, String imageUrl) { | ||
this.id = id; | ||
this.imageUrl = imageUrl; | ||
} | ||
} |
35 changes: 22 additions & 13 deletions
35
BE/src/main/java/sidedish/com/repository/entity/ProductEntity.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,29 +1,38 @@ | ||
package sidedish.com.repository.entity; | ||
|
||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
import org.springframework.data.annotation.Id; | ||
import org.springframework.data.annotation.PersistenceConstructor; | ||
import org.springframework.data.relational.core.mapping.MappedCollection; | ||
import org.springframework.data.relational.core.mapping.Table; | ||
|
||
@Getter | ||
@ToString | ||
@AllArgsConstructor | ||
|
||
@Table("PRODUCT") | ||
public class ProductEntity { | ||
|
||
@Id | ||
private Long id; | ||
private Long discountPolicyId; | ||
private final Long id; | ||
private final Long discountPolicyId; | ||
@MappedCollection(idColumn = "ID", keyColumn = "ID") | ||
private List<ImageEntity> imageEntities; | ||
private String productName; | ||
private String description; | ||
private long originalPrice; | ||
private String mealCategory; | ||
private String bestCategory; | ||
private final List<ImageEntity> imageEntities; | ||
private final String productName; | ||
private final String description; | ||
private final long originalPrice; | ||
private final String mealCategory; | ||
private final String bestCategory; | ||
|
||
@PersistenceConstructor | ||
public ProductEntity(Long id, Long discountPolicyId, | ||
List<ImageEntity> imageEntities, String productName, String description, long originalPrice, | ||
String mealCategory, String bestCategory) { | ||
this.id = id; | ||
this.discountPolicyId = discountPolicyId; | ||
this.imageEntities = imageEntities; | ||
this.productName = productName; | ||
this.description = description; | ||
this.originalPrice = originalPrice; | ||
this.mealCategory = mealCategory; | ||
this.bestCategory = bestCategory; | ||
} | ||
} |
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
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
44 changes: 0 additions & 44 deletions
44
BE/src/test/java/sidedish/com/service/ProductsServiceTest.java
This file was deleted.
Oops, something went wrong.