Skip to content

Commit 76624f7

Browse files
committed
updates for release 3 - 07-security-order-history-base-functionality
1 parent 7e75217 commit 76624f7

File tree

11 files changed

+64
-16561
lines changed

11 files changed

+64
-16561
lines changed

source-code/ecommerce-project-release-3.0/07-security-order-history-base-functionality/01-starter-files/db-scripts/02-create-products.sql

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,34 @@ AUTO_INCREMENT = 1;
4343
-- Add sample data
4444
-- -----------------------------------------------------
4545

46-
INSERT INTO product_category(category_name) VALUES ('BOOKS');
46+
INSERT INTO PRODUCT_CATEGORY(CATEGORY_NAME) VALUES ('BOOKS');
4747

48-
INSERT INTO product (sku, name, description, image_url, active, units_in_stock,
49-
unit_price, category_id, date_created)
48+
INSERT INTO PRODUCT (SKU, NAME, DESCRIPTION, IMAGE_URL, ACTIVE, UNITS_IN_STOCK,
49+
UNIT_PRICE, CATEGORY_ID,DATE_CREATED)
5050
VALUES ('BOOK-TECH-1000', 'JavaScript - The Fun Parts', 'Learn JavaScript',
5151
'assets/images/products/placeholder.png'
5252
,1,100,19.99,1, NOW());
5353

54-
INSERT INTO product (sku, name, description, image_url, active, units_in_stock,
55-
unit_price, category_id, date_created)
54+
INSERT INTO PRODUCT (SKU, NAME, DESCRIPTION, IMAGE_URL, ACTIVE, UNITS_IN_STOCK,
55+
UNIT_PRICE, CATEGORY_ID, DATE_CREATED)
5656
VALUES ('BOOK-TECH-1001', 'Spring Framework Tutorial', 'Learn Spring',
5757
'assets/images/products/placeholder.png'
5858
,1,100,29.99,1, NOW());
5959

60-
INSERT INTO product (sku, name, description, image_url, active, units_in_stock,
61-
unit_price, category_id, date_created)
60+
INSERT INTO PRODUCT (SKU, NAME, DESCRIPTION, IMAGE_URL, ACTIVE, UNITS_IN_STOCK,
61+
UNIT_PRICE, CATEGORY_ID, DATE_CREATED)
6262
VALUES ('BOOK-TECH-1002', 'Kubernetes - Deploying Containers', 'Learn Kubernetes',
6363
'assets/images/products/placeholder.png'
6464
,1,100,24.99,1, NOW());
6565

66-
INSERT INTO product (sku, name, description, image_url, active, units_in_stock,
67-
unit_price, category_id, date_created)
66+
INSERT INTO PRODUCT (SKU, NAME, DESCRIPTION, IMAGE_URL, ACTIVE, UNITS_IN_STOCK,
67+
UNIT_PRICE, CATEGORY_ID, DATE_CREATED)
6868
VALUES ('BOOK-TECH-1003', 'Internet of Things (IoT) - Getting Started', 'Learn IoT',
6969
'assets/images/products/placeholder.png'
7070
,1,100,29.99,1, NOW());
7171

72-
INSERT INTO product (sku, name, description, image_url, active, units_in_stock,
73-
unit_price, category_id, date_created)
72+
INSERT INTO PRODUCT (SKU, NAME, DESCRIPTION, IMAGE_URL, ACTIVE, UNITS_IN_STOCK,
73+
UNIT_PRICE, CATEGORY_ID, DATE_CREATED)
7474
VALUES ('BOOK-TECH-1004', 'The Go Programming Language: A to Z', 'Learn Go',
7575
'assets/images/products/placeholder.png'
7676
,1,100,24.99,1, NOW());

source-code/ecommerce-project-release-3.0/07-security-order-history-base-functionality/02-backend/spring-boot-ecommerce/src/main/java/com/luv2code/ecommerce/config/MyDataRestConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void configureRepositoryRestConfiguration(RepositoryRestConfiguration con
3535
HttpMethod[] theUnsupportedActions = {HttpMethod.PUT, HttpMethod.POST,
3636
HttpMethod.DELETE, HttpMethod.PATCH};
3737

38-
// disable HTTP methods for ProductCategory: PUT, POST, DELETE and PATCH
38+
// disable HTTP methods for ProductCategory: PUT, POST and DELETE
3939
disableHttpMethods(Product.class, config, theUnsupportedActions);
4040
disableHttpMethods(ProductCategory.class, config, theUnsupportedActions);
4141
disableHttpMethods(Country.class, config, theUnsupportedActions);
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package com.luv2code.ecommerce.dao;
22

33
import com.luv2code.ecommerce.entity.Order;
4+
import org.springframework.data.domain.Page;
5+
import org.springframework.data.domain.Pageable;
46
import org.springframework.data.jpa.repository.JpaRepository;
57
import org.springframework.data.repository.query.Param;
68
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
79

8-
import java.util.List;
9-
1010
@RepositoryRestResource
1111
public interface OrderRepository extends JpaRepository<Order, Long> {
1212

13-
List<Order> findOrdersByCustomerEmail(@Param("email") String email);
13+
Page<Order> findByCustomerEmailOrderByDateCreatedDesc(@Param("email") String email, Pageable pageable);
1414

1515
}

source-code/ecommerce-project-release-3.0/07-security-order-history-base-functionality/02-backend/spring-boot-ecommerce/src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ spring.data.rest.base-path=/api
99

1010
allowed.origins=http://localhost:4200
1111

12-
spring.data.rest.detection-strategy=ANNOTATED
12+
spring.data.rest.detection-strategy=ANNOTATED

0 commit comments

Comments
 (0)