Skip to content

Commit

Permalink
Include OrderedProducts related to Order
Browse files Browse the repository at this point in the history
Change in OrderDTO to include OrderedProducts and getter and setter.
Update schema-market in different formats
  • Loading branch information
cabaluniovi committed Nov 14, 2024
1 parent 0d9e45c commit 415f77d
Show file tree
Hide file tree
Showing 6 changed files with 1,403 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Common configuration and customization for all Market tests that use entities in its OpenApi model.
*/
public class BaseMarket extends BaseAll {
protected static final String MARKET_SCHEMA_LOCAL = "../sut-market/src/main/resources/marketWithoutArrays.json";
protected static final String MARKET_SCHEMA_LOCAL = "../sut-market/src/main/resources/marketWithOrderedProducts.json";
private static final String MARKET_URL_LIVE = "http://localhost:8083";

// attributes that can be filtered during comparisons of assertions
Expand Down Expand Up @@ -75,6 +75,7 @@ protected TdSchema getSchema() {
.setIdResolver(new OaSchemaIdResolver().setIdName("id")
.excludeEntity("CartItemDTOReq")
.excludeEntity("CartItemDTORes")
.excludeEntity("OrderedProductDTO")
.excludeEntity("ProductDTORes")
.excludeEntity("ProductDTOReq"))
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,28 @@
"datatype" : "double",
"notnull" : "true"
} ]
}, {
"name" : "OrderedProductDTO",
"entitytype" : "table",
"attributes" : [ {
"name" : "orderId",
"datatype" : "int64",
"uid" : "true",
"notnull" : "true",
"rid" : "OrderDTO.id",
"ridname" : "fk_OrderedProductDTO_orderId"
}, {
"name" : "productId",
"datatype" : "int64",
"uid" : "true",
"notnull" : "true",
"rid" : "ProductDTORes.productId",
"ridname" : "fk_OrderedProductDTO_productId"
}, {
"name" : "quantity",
"datatype" : "int32",
"notnull" : "true"
} ]
}, {
"name" : "ProductDTOReq",
"entitytype" : "table",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ classDiagram
RegionDTORes <--"*" DistilleryDTORes
CreditCardDTO <--"*" OrderDTO
UserDTOReq <--"*" OrderDTO
OrderDTO <--"*" OrderedProductDTO
ProductDTORes <--"*" OrderedProductDTO
DistilleryDTOReq <--"*" ProductDTOReq
DistilleryDTORes <--"*" ProductDTORes
CartItemDTOReq: +put(/customer/cart)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
<column name="productsCost" type="double" notnull="true" />
<column name="totalCost" type="double" notnull="true" />
</table>
<table name="OrderedProductDTO" type="table">
<column name="orderId" type="int64" key="true" notnull="true" fk="OrderDTO.id" fkname="fk_OrderedProductDTO_orderId" />
<column name="productId" type="int64" key="true" notnull="true" fk="ProductDTORes.productId" fkname="fk_OrderedProductDTO_productId" />
<column name="quantity" type="int32" notnull="true" />
</table>
<table name="ProductDTOReq" type="table">
<column name="productId" type="int64" key="true" notnull="true" />
<column name="distillery" type="string" notnull="true" fk="DistilleryDTOReq.title" fkname="fk_ProductDTOReq_distillery" />
Expand Down
14 changes: 14 additions & 0 deletions sut-market/market-core/src/main/java/market/dto/OrderDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import org.springframework.hateoas.RepresentationModel;

import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Set;

public class OrderDTO extends RepresentationModel<OrderDTO> {

Expand All @@ -17,6 +20,17 @@ public class OrderDTO extends RepresentationModel<OrderDTO> {
private double totalCost;
private boolean payed;
private boolean executed;

// Tests: include orderedProducts, getter and setter
private Set<OrderedProductDTO> orderedProducts = Collections.emptySet();

public Set<OrderedProductDTO> getOrderedProducts() {
return orderedProducts;
}

public void setOrderedProducts(Set<OrderedProductDTO> orderedProducts) {
this.orderedProducts = orderedProducts;
}

public String getUserAccount() {
return userAccount;
Expand Down
Loading

0 comments on commit 415f77d

Please sign in to comment.