-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1105 process to checkout - AC1: Create API to get Product information (
#1188) * add API GET product checkout list * add test for new method * add image to response * fix checkstyle in old code * config API url * remove duplicate init product data in test
- Loading branch information
Showing
7 changed files
with
158 additions
and
41 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
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
41 changes: 41 additions & 0 deletions
41
product/src/main/java/com/yas/product/viewmodel/product/ProductCheckoutListVm.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,41 @@ | ||
package com.yas.product.viewmodel.product; | ||
|
||
import com.yas.product.model.Product; | ||
import java.time.ZonedDateTime; | ||
import java.util.Objects; | ||
import lombok.Builder; | ||
|
||
@Builder(toBuilder = true) | ||
public record ProductCheckoutListVm(Long id, | ||
String name, | ||
String description, | ||
String shortDescription, | ||
String sku, | ||
Long parentId, | ||
Long brandId, | ||
Double price, | ||
Long taxClassId, | ||
String thumbnailUrl, | ||
ZonedDateTime createdOn, | ||
String createdBy, | ||
ZonedDateTime lastModifiedOn, | ||
String lastModifiedBy) { | ||
public static ProductCheckoutListVm fromModel(Product product) { | ||
return new ProductCheckoutListVm( | ||
product.getId(), | ||
product.getName(), | ||
product.getDescription(), | ||
product.getShortDescription(), | ||
product.getSku(), | ||
Objects.isNull(product.getParent()) ? null : product.getParent().getId(), | ||
product.getBrand().getId(), | ||
product.getPrice(), | ||
product.getTaxClassId(), | ||
"", | ||
product.getCreatedOn(), | ||
product.getCreatedBy(), | ||
product.getLastModifiedOn(), | ||
product.getLastModifiedBy() | ||
); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
product/src/main/java/com/yas/product/viewmodel/product/ProductGetCheckoutListVm.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,13 @@ | ||
package com.yas.product.viewmodel.product; | ||
|
||
import java.util.List; | ||
|
||
public record ProductGetCheckoutListVm( | ||
List<ProductCheckoutListVm> productCheckoutListVms, | ||
int pageNo, | ||
int pageSize, | ||
int totalElements, | ||
int totalPages, | ||
boolean isLast | ||
) { | ||
} |
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