From 2b31a59830d80bcfb3aa95b7fd7fcef29c3e6ea3 Mon Sep 17 00:00:00 2001 From: Gaurav Daharia <59254@hexaware.com> Date: Sun, 19 Sep 2021 15:15:56 +0530 Subject: [PATCH 01/10] minor routing changed and css --- Angular-UrbanBazaar/angular.json | 6 ++++-- Angular-UrbanBazaar/proxy.config.json | 19 +++++++++++++++++++ .../app/components/cart/cart.component.css | 13 +++++-------- .../app/components/cart/cart.component.html | 10 +++++----- .../app/components/home/home.component.css | 1 + .../src/app/services/cart.service.ts | 2 +- .../src/app/services/member-user.service.ts | 2 +- .../src/app/services/orders.service.ts | 2 +- .../app/services/product-category.service.ts | 2 +- .../src/app/services/product.service.ts | 2 +- .../src/app/services/user.service.ts | 2 +- 11 files changed, 40 insertions(+), 21 deletions(-) create mode 100644 Angular-UrbanBazaar/proxy.config.json diff --git a/Angular-UrbanBazaar/angular.json b/Angular-UrbanBazaar/angular.json index 063ac34..5e7a85b 100644 --- a/Angular-UrbanBazaar/angular.json +++ b/Angular-UrbanBazaar/angular.json @@ -69,10 +69,12 @@ "builder": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { - "browserTarget": "Angular-UrbanBazaar:build:production" + "browserTarget": "Angular-UrbanBazaar:build:production", + "proxyConfig": "proxy.config.json" }, "development": { - "browserTarget": "Angular-UrbanBazaar:build:development" + "browserTarget": "Angular-UrbanBazaar:build:development", + "proxyConfig": "proxy.config.json" } }, "defaultConfiguration": "development" diff --git a/Angular-UrbanBazaar/proxy.config.json b/Angular-UrbanBazaar/proxy.config.json new file mode 100644 index 0000000..14dded7 --- /dev/null +++ b/Angular-UrbanBazaar/proxy.config.json @@ -0,0 +1,19 @@ +{ + "/products":{ + "target":"http://10.3.117.7:8002", + "secure":false + }, + "/user":{ + "target":"http://10.3.117.7:8006", + "secure":false + }, + "/orders":{ + "target":"http://10.3.117.7:8003", + "secure":false + }, + "/cart":{ + "target":"http://10.3.117.7:8004", + "secure":false + } + +} \ No newline at end of file diff --git a/Angular-UrbanBazaar/src/app/components/cart/cart.component.css b/Angular-UrbanBazaar/src/app/components/cart/cart.component.css index cb78379..69ce603 100644 --- a/Angular-UrbanBazaar/src/app/components/cart/cart.component.css +++ b/Angular-UrbanBazaar/src/app/components/cart/cart.component.css @@ -29,11 +29,8 @@ h4,h6{ align-items: center; } -/* .center .btn{ - font-size: 14px !important; - margin-top: 20px !important; - font-weight: 400; - padding: 12px 72px; - border-radius: 3px !important; - -} */ +.CartButtons{ + border-radius: 15px; + border-color:antiquewhite ; + background-color: beige; +} \ No newline at end of file diff --git a/Angular-UrbanBazaar/src/app/components/cart/cart.component.html b/Angular-UrbanBazaar/src/app/components/cart/cart.component.html index b5224d4..a9bd096 100644 --- a/Angular-UrbanBazaar/src/app/components/cart/cart.component.html +++ b/Angular-UrbanBazaar/src/app/components/cart/cart.component.html @@ -18,14 +18,14 @@ {{c.productname}} {{c.productprice}} - + - - - + + + Grand Total : Rs.{{grandTotal}} @@ -46,7 +46,7 @@ alt="">

Your cart is empty!

Add item to it now
- + \ No newline at end of file diff --git a/Angular-UrbanBazaar/src/app/components/home/home.component.css b/Angular-UrbanBazaar/src/app/components/home/home.component.css index e0e2b2c..340a3f9 100644 --- a/Angular-UrbanBazaar/src/app/components/home/home.component.css +++ b/Angular-UrbanBazaar/src/app/components/home/home.component.css @@ -39,4 +39,5 @@ body { display: flex; justify-content: space-between; flex-grow:1; + flex-wrap: wrap; } \ No newline at end of file diff --git a/Angular-UrbanBazaar/src/app/services/cart.service.ts b/Angular-UrbanBazaar/src/app/services/cart.service.ts index 9c57534..56dcc78 100644 --- a/Angular-UrbanBazaar/src/app/services/cart.service.ts +++ b/Angular-UrbanBazaar/src/app/services/cart.service.ts @@ -9,7 +9,7 @@ import { Cart } from '../models/cart'; }) export class CartService { - private _url : String = "http://localhost:9000"; + private _url : String = "http://localhost:4405/cart"; constructor(private _http : HttpClient) { } // public showAllOrder():Observable diff --git a/Angular-UrbanBazaar/src/app/services/member-user.service.ts b/Angular-UrbanBazaar/src/app/services/member-user.service.ts index e7ba94e..a5e6fe7 100644 --- a/Angular-UrbanBazaar/src/app/services/member-user.service.ts +++ b/Angular-UrbanBazaar/src/app/services/member-user.service.ts @@ -8,7 +8,7 @@ import { MemberUser } from '../models/member-user'; }) export class MemberUserService { - private _url : String = "http://localhost:8001/user"; + private _url : String = "http://localhost:4405/user"; constructor(private _http : HttpClient) { } diff --git a/Angular-UrbanBazaar/src/app/services/orders.service.ts b/Angular-UrbanBazaar/src/app/services/orders.service.ts index 749f7ea..5c84bbf 100644 --- a/Angular-UrbanBazaar/src/app/services/orders.service.ts +++ b/Angular-UrbanBazaar/src/app/services/orders.service.ts @@ -8,7 +8,7 @@ import { Orders } from '../models/orders'; }) export class OrdersService { - private _url : String = "http://localhost:8003/orders"; + private _url : String = "http://localhost:4405/orders"; constructor(private _http : HttpClient) { } diff --git a/Angular-UrbanBazaar/src/app/services/product-category.service.ts b/Angular-UrbanBazaar/src/app/services/product-category.service.ts index c250024..f6730a7 100644 --- a/Angular-UrbanBazaar/src/app/services/product-category.service.ts +++ b/Angular-UrbanBazaar/src/app/services/product-category.service.ts @@ -8,7 +8,7 @@ import { ProductCategory } from '../models/product-category'; }) export class ProductCategoryService { - private _url : String = "http://localhost:8002/products"; + private _url : String = "http://localhost:4405/products"; constructor(private _http : HttpClient) { } diff --git a/Angular-UrbanBazaar/src/app/services/product.service.ts b/Angular-UrbanBazaar/src/app/services/product.service.ts index 435bbde..b47ae52 100644 --- a/Angular-UrbanBazaar/src/app/services/product.service.ts +++ b/Angular-UrbanBazaar/src/app/services/product.service.ts @@ -8,7 +8,7 @@ import {map} from 'rxjs/operators'; providedIn: 'root' }) export class ProductService { - private _url : String = "http://localhost:8002/products"; + private _url : String = "http://localhost:4405/products"; search : string; constructor(private _http : HttpClient) { } diff --git a/Angular-UrbanBazaar/src/app/services/user.service.ts b/Angular-UrbanBazaar/src/app/services/user.service.ts index 083caae..eba6ae2 100644 --- a/Angular-UrbanBazaar/src/app/services/user.service.ts +++ b/Angular-UrbanBazaar/src/app/services/user.service.ts @@ -9,7 +9,7 @@ import { User } from '../models/user'; }) export class UserService { - private _url : String = "http://localhost:8001/user"; + private _url : String = "http://localhost:4405/user"; currentUser : User; constructor(private _http : HttpClient) { } From 9f60411dfe5d0c78f9b600ae87f2ed5eddeb1eef Mon Sep 17 00:00:00 2001 From: Gowrisankar Date: Mon, 20 Sep 2021 10:17:42 +0530 Subject: [PATCH 02/10] Update 'grocery_db_tables.sql' --- grocery_db_tables.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/grocery_db_tables.sql b/grocery_db_tables.sql index 023e238..9b624ff 100644 --- a/grocery_db_tables.sql +++ b/grocery_db_tables.sql @@ -140,9 +140,10 @@ SELECT * FROM orders; -- Members Table Schema create table `members`( - `UserID` int(11) NOT NULL, - `MemberID` int(11) not null, + `UserID` int(11) NOT NULL, + `MemberID` int(11) not null, `MemberName` varchar(20) not null, + `MemberDoorNumber` int(4) not null, `TotalItems` int(3) not null default 0, `MemberPhone` varchar(15) not null, `MemberTotalAmount` float not null default 0, @@ -158,7 +159,7 @@ select * from members; -- Cart Table Schema CREATE TABLE IF NOT EXISTS `cart` ( - `CartID` int NOT NULL, + `CartID` int NOT NULL, `UserID` int NOT NULL, `OrderID` int NOT NULL, `ProductName` varchar(50) NOT NULL, From dbaa329141f72dc53555f39d16f9421275c0caa4 Mon Sep 17 00:00:00 2001 From: Gowrisankar Date: Mon, 20 Sep 2021 12:12:46 +0530 Subject: [PATCH 03/10] Update 'grocery_db_tables.sql' --- grocery_db_tables.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grocery_db_tables.sql b/grocery_db_tables.sql index 9b624ff..ed358bd 100644 --- a/grocery_db_tables.sql +++ b/grocery_db_tables.sql @@ -141,7 +141,7 @@ SELECT * FROM orders; -- Members Table Schema create table `members`( `UserID` int(11) NOT NULL, - `MemberID` int(11) not null, + `MemberID` int(11) not null AUTO_INCREMENT, `MemberName` varchar(20) not null, `MemberDoorNumber` int(4) not null, `TotalItems` int(3) not null default 0, @@ -159,7 +159,7 @@ select * from members; -- Cart Table Schema CREATE TABLE IF NOT EXISTS `cart` ( - `CartID` int NOT NULL, + `CartID` int NOT NULL AUTO_INCREMENT, `UserID` int NOT NULL, `OrderID` int NOT NULL, `ProductName` varchar(50) NOT NULL, From ba5b138becf569fbed712f3ba8c31e6cace7310c Mon Sep 17 00:00:00 2001 From: Gowrisankar Date: Mon, 20 Sep 2021 13:21:09 +0530 Subject: [PATCH 04/10] Update 'grocery_db_tables.sql' --- grocery_db_tables.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/grocery_db_tables.sql b/grocery_db_tables.sql index ed358bd..c46ee33 100644 --- a/grocery_db_tables.sql +++ b/grocery_db_tables.sql @@ -163,6 +163,7 @@ CREATE TABLE IF NOT EXISTS `cart` ( `UserID` int NOT NULL, `OrderID` int NOT NULL, `ProductName` varchar(50) NOT NULL, + `ProductPrice` int(5) NOT NULL, `Quantity` int NOT NULL, PRIMARY KEY (`CartID`), FOREIGN KEY (`UserID`) REFERENCES users(`UserID`) From a14c1bee6b9613fe8952801d78be0f8cc144ea4b Mon Sep 17 00:00:00 2001 From: Gowrisankar J g <59323@hexaware.com> Date: Mon, 20 Sep 2021 13:41:42 +0530 Subject: [PATCH 05/10] updated ub cart and orders proxy --- .../controller/CartController.java | 20 +- .../com/example/urbanbazaar/model/Cart.java | 9 + .../repository/CartRepository.java | 3 + .../controller/OrderController.java | 68 +++++++ .../com/example/urbanbazaar/model/Orders.java | 186 ++++++++++++++++++ .../repository/OrderRepository.java | 17 ++ 6 files changed, 302 insertions(+), 1 deletion(-) create mode 100644 UB_OrderServiceProxy/src/main/java/com/example/urbanbazaar/controller/OrderController.java create mode 100644 UB_OrderServiceProxy/src/main/java/com/example/urbanbazaar/model/Orders.java create mode 100644 UB_OrderServiceProxy/src/main/java/com/example/urbanbazaar/repository/OrderRepository.java diff --git a/UB_CartServiceProxy/src/main/java/com/example/urbanbazaar/controller/CartController.java b/UB_CartServiceProxy/src/main/java/com/example/urbanbazaar/controller/CartController.java index 3766983..395e943 100644 --- a/UB_CartServiceProxy/src/main/java/com/example/urbanbazaar/controller/CartController.java +++ b/UB_CartServiceProxy/src/main/java/com/example/urbanbazaar/controller/CartController.java @@ -3,7 +3,10 @@ package com.example.urbanbazaar.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import com.example.urbanbazaar.model.Cart; @@ -15,9 +18,24 @@ public class CartController { @Autowired public CartRepository repo; - @GetMapping("showCart/{userId}") + @GetMapping("/showCart/{userId}") public List showCartForUserId(int userId) { return repo.showCartForUserId(userId); } + + @PostMapping("/addCartItem") + public void addCartItemForUserId(@RequestBody Cart cartItem) { + repo.save(cartItem); + } + + @DeleteMapping("/deleteCartItem/{cart_id}") + public void deleteCartItemForUserId(int cart_id) { + repo.deleteById(cart_id); + } + + @DeleteMapping("/deleteAllCartItemsForUser/{userId}") + public void removeCartItemsForUser(int userId){ + repo.deleteAllCartItems(userId); + } } diff --git a/UB_CartServiceProxy/src/main/java/com/example/urbanbazaar/model/Cart.java b/UB_CartServiceProxy/src/main/java/com/example/urbanbazaar/model/Cart.java index 1eab2ca..5f0dc24 100644 --- a/UB_CartServiceProxy/src/main/java/com/example/urbanbazaar/model/Cart.java +++ b/UB_CartServiceProxy/src/main/java/com/example/urbanbazaar/model/Cart.java @@ -13,6 +13,7 @@ public class Cart { private int userid; private int orderid; private String productname; + private int productprice; private int quantity; public Cart() {} @@ -48,6 +49,14 @@ public class Cart { public void setProductname(String productname) { this.productname = productname; } + + public int getProductprice() { + return productprice; + } + + public void setProductprice(int productprice) { + this.productprice = productprice; + } public int getQuantity() { return quantity; diff --git a/UB_CartServiceProxy/src/main/java/com/example/urbanbazaar/repository/CartRepository.java b/UB_CartServiceProxy/src/main/java/com/example/urbanbazaar/repository/CartRepository.java index 949741d..8afcd95 100644 --- a/UB_CartServiceProxy/src/main/java/com/example/urbanbazaar/repository/CartRepository.java +++ b/UB_CartServiceProxy/src/main/java/com/example/urbanbazaar/repository/CartRepository.java @@ -11,4 +11,7 @@ public interface CartRepository extends JpaRepository { @Query(value="select * from cart where UserID=?1", nativeQuery=true) public List showCartForUserId(int userId); + + @Query(value="delete from cart where UserID=?1", nativeQuery=true) + public void deleteAllCartItems(int userId); } diff --git a/UB_OrderServiceProxy/src/main/java/com/example/urbanbazaar/controller/OrderController.java b/UB_OrderServiceProxy/src/main/java/com/example/urbanbazaar/controller/OrderController.java new file mode 100644 index 0000000..23ba804 --- /dev/null +++ b/UB_OrderServiceProxy/src/main/java/com/example/urbanbazaar/controller/OrderController.java @@ -0,0 +1,68 @@ +package com.example.urbanbazaar.controller; + +import java.util.List; +import java.util.NoSuchElementException; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import com.example.urbanbazaar.model.Orders; +import com.example.urbanbazaar.repository.OrderRepository; + + +@RestController +public class OrderController { + + @Autowired + private OrderRepository repo; + + @PostMapping("/addOrder") + public void addOrders( @RequestBody Orders order) { + repo.save(order); + } + + @GetMapping("/findOrder/{id}") + public ResponseEntity findOrder(@PathVariable Integer id) { + + try { + Orders order = repo.findById(id).get(); + return new ResponseEntity(order,HttpStatus.OK); + } catch (NoSuchElementException e) { + return new ResponseEntity(HttpStatus.NOT_FOUND); + } + } + + @GetMapping("/findOrdersByUser/{id}") + public ResponseEntity> findOrderByUser(@PathVariable Integer id) { + + try { + List orders = repo.findByorderuserid(id); + return new ResponseEntity>(orders, HttpStatus.OK); + } catch (NoSuchElementException e) { + return new ResponseEntity>(HttpStatus.NOT_FOUND); + } + } + + @GetMapping("/trackOrder/{trackid}") + public ResponseEntity searchOrderByTrackingNumber(@PathVariable String trackid) + { + try { + Orders order = repo.findByTrackId(trackid); + return new ResponseEntity(order,HttpStatus.OK); + } catch (NoSuchElementException e) { + return new ResponseEntity(HttpStatus.NOT_FOUND); + } + } + + @GetMapping("/showAllOrders") + public List showAllOrders() + { + return repo.findAll(); + } +} diff --git a/UB_OrderServiceProxy/src/main/java/com/example/urbanbazaar/model/Orders.java b/UB_OrderServiceProxy/src/main/java/com/example/urbanbazaar/model/Orders.java new file mode 100644 index 0000000..c0d100e --- /dev/null +++ b/UB_OrderServiceProxy/src/main/java/com/example/urbanbazaar/model/Orders.java @@ -0,0 +1,186 @@ +package com.example.urbanbazaar.model; + +import java.sql.Date; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "orders") +public class Orders { + + @Id + @GeneratedValue + private int orderid; + private int orderuserid; + private float orderamount; + private String ordershipaddress; + private String ordershipaddress2; + private String ordercity; + private String orderzip; + private String orderstate; + private String ordercountry; + private String orderphone; + private float ordershippingcost; + private float ordertax; + private String orderemail; + private Date orderdate; + private String ordershipped; + private String ordertrackingnumber; + + public int getOrderid() { + return orderid; + } + + public void setOrderid(int orderid) { + this.orderid = orderid; + } + + public int getOrderuserid() { + return orderuserid; + } + + public void setOrderuserid(int orderuserid) { + this.orderuserid = orderuserid; + } + + public float getOrderamount() { + return orderamount; + } + + public void setOrderamount(float orderamount) { + this.orderamount = orderamount; + } + + public String getOrdershipaddress() { + return ordershipaddress; + } + + public void setOrdershipaddress(String ordershipaddress) { + this.ordershipaddress = ordershipaddress; + } + + public String getOrdershipaddress2() { + return ordershipaddress2; + } + + public void setOrdershipaddress2(String ordershipaddress2) { + this.ordershipaddress2 = ordershipaddress2; + } + + public String getOrdercity() { + return ordercity; + } + + public void setOrdercity(String ordercity) { + this.ordercity = ordercity; + } + + public String getOrderzip() { + return orderzip; + } + + public void setOrderzip(String orderzip) { + this.orderzip = orderzip; + } + + public String getOrderstate() { + return orderstate; + } + + public void setOrderstate(String orderstate) { + this.orderstate = orderstate; + } + + public String getOrdercountry() { + return ordercountry; + } + + public void setOrdercountry(String ordercountry) { + this.ordercountry = ordercountry; + } + + public String getOrderphone() { + return orderphone; + } + + public void setOrderphone(String orderphone) { + this.orderphone = orderphone; + } + + public float getOrdershippingcost() { + return ordershippingcost; + } + + public void setOrdershippingcost(float ordershippingcost) { + this.ordershippingcost = ordershippingcost; + } + + public float getOrdertax() { + return ordertax; + } + + public void setOrdertax(float ordertax) { + this.ordertax = ordertax; + } + + public String getOrderemail() { + return orderemail; + } + + public void setOrderemail(String orderemail) { + this.orderemail = orderemail; + } + + public Date getOrderdate() { + return orderdate; + } + + public void setOrderdate(Date orderdate) { + this.orderdate = orderdate; + } + + public String getOrdershipped() { + return ordershipped; + } + + public void setOrdershipped(String ordershipped) { + this.ordershipped = ordershipped; + } + + public String getOrdertrackingnumber() { + return ordertrackingnumber; + } + + public void setOrdertrackingnumber(String ordertrackingnumber) { + this.ordertrackingnumber = ordertrackingnumber; + } + + public Orders(int orderid, int orderuserid, float orderamount, String ordershipaddress, String ordershipaddress2, + String ordercity, String orderzip, String orderstate, String ordercountry, String orderphone, + float ordershippingcost, float ordertax, String orderemail, Date orderdate, String ordershipped, + String ordertrackingnumber) { + this.orderid = orderid; + this.orderuserid = orderuserid; + this.orderamount = orderamount; + this.ordershipaddress = ordershipaddress; + this.ordershipaddress2 = ordershipaddress2; + this.ordercity = ordercity; + this.orderzip = orderzip; + this.orderstate = orderstate; + this.ordercountry = ordercountry; + this.orderphone = orderphone; + this.ordershippingcost = ordershippingcost; + this.ordertax = ordertax; + this.orderemail = orderemail; + this.orderdate = orderdate; + this.ordershipped = ordershipped; + this.ordertrackingnumber = ordertrackingnumber; + } + + public Orders() { + + } + +} diff --git a/UB_OrderServiceProxy/src/main/java/com/example/urbanbazaar/repository/OrderRepository.java b/UB_OrderServiceProxy/src/main/java/com/example/urbanbazaar/repository/OrderRepository.java new file mode 100644 index 0000000..8a99f49 --- /dev/null +++ b/UB_OrderServiceProxy/src/main/java/com/example/urbanbazaar/repository/OrderRepository.java @@ -0,0 +1,17 @@ +package com.example.urbanbazaar.repository; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import com.example.urbanbazaar.model.Orders; + +public interface OrderRepository extends JpaRepository { + + @Query("SELECT o FROM Orders o WHERE o.ordertrackingnumber=:id") + public Orders findByTrackId(@Param("id") String id); + + public List findByorderuserid(int id); +} From b6c1cddc9c54287323782874e737d85489362efb Mon Sep 17 00:00:00 2001 From: Gowrisankar J g <59323@hexaware.com> Date: Mon, 20 Sep 2021 13:51:02 +0530 Subject: [PATCH 06/10] --- Angular-UrbanBazaar/package-lock.json | 130 +++++++----------- Angular-UrbanBazaar/package.json | 2 +- .../src/app/components/cart/cart.component.ts | 28 ++-- .../src/app/components/home/home.component.ts | 2 +- Angular-UrbanBazaar/src/app/models/cart.ts | 15 +- 5 files changed, 75 insertions(+), 102 deletions(-) diff --git a/Angular-UrbanBazaar/package-lock.json b/Angular-UrbanBazaar/package-lock.json index 521b158..8dc30b4 100644 --- a/Angular-UrbanBazaar/package-lock.json +++ b/Angular-UrbanBazaar/package-lock.json @@ -1801,9 +1801,9 @@ "dev": true }, "@trysound/sax": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.1.1.tgz", - "integrity": "sha512-Z6DoceYb/1xSg5+e+ZlPZ9v0N16ZvZ+wYMraFue4HYrE4ttONKtsvruIRf6t9TBR0YvSOfi1hUU0fJfBLCDYow==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", + "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==", "dev": true }, "@types/component-emitter": { @@ -2612,16 +2612,6 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -3311,9 +3301,9 @@ "dev": true }, "core-js-compat": { - "version": "3.17.3", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.17.3.tgz", - "integrity": "sha512-+in61CKYs4hQERiADCJsdgewpdl/X0GhEX77pjKgbeibXviIt2oxEjTc8O2fqHX8mDdBrDvX8MYD/RYsBv4OiA==", + "version": "3.18.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.18.0.tgz", + "integrity": "sha512-tRVjOJu4PxdXjRMEgbP7lqWy1TWJu9a01oBkn8d+dNrhgmBwdTkzhHZpVJnEmhISLdoJI1lX08rcBcHi3TZIWg==", "dev": true, "requires": { "browserslist": "^4.17.0", @@ -4737,13 +4727,6 @@ "escape-string-regexp": "^1.0.5" } }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -6734,9 +6717,9 @@ } }, "memfs": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.2.4.tgz", - "integrity": "sha512-2mDCPhuduRPOxlfgsXF9V+uqC6Jgz8zt/bNe4d4W7d5f6pCzHrWkxLNr17jKGXd4+j2kQNsAG2HARPnt74sqVQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/memfs/-/memfs-3.3.0.tgz", + "integrity": "sha512-BEE62uMfKOavX3iG7GYX43QJ+hAeeWnwIAuJ/R6q96jaMtiLzhsxHJC8B1L7fK7Pt/vXDRwb3SG/yBpNGDPqzg==", "dev": true, "requires": { "fs-monkey": "1.0.3" @@ -7051,13 +7034,6 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, - "nan": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", - "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", - "dev": true, - "optional": true - }, "nanoid": { "version": "3.1.25", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", @@ -7288,9 +7264,9 @@ } }, "nth-check": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz", - "integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz", + "integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==", "dev": true, "requires": { "boolbase": "^1.0.0" @@ -9629,12 +9605,12 @@ "dev": true }, "regenerate-unicode-properties": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz", - "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-9.0.0.tgz", + "integrity": "sha512-3E12UeNSPfjrgwjkR81m5J7Aw/T55Tu7nUyZVQYCKEOs+2dkxEY+DpPtZzO4YruuiPb7NkYLVcyJC4+zCbk5pA==", "dev": true, "requires": { - "regenerate": "^1.4.0" + "regenerate": "^1.4.2" } }, "regenerator-runtime": { @@ -9679,17 +9655,17 @@ } }, "regexpu-core": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.7.1.tgz", - "integrity": "sha512-ywH2VUraA44DZQuRKzARmw6S66mr48pQVva4LBeRhcOltJ6hExvWly5ZjFLYo67xbIxb6W1q4bAGtgfEl20zfQ==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.8.0.tgz", + "integrity": "sha512-1F6bYsoYiz6is+oz70NWur2Vlh9KWtswuRuzJOfeYUrfPX2o8n74AnUVaOGDbUqVGO9fNHu48/pjJO4sNVwsOg==", "dev": true, "requires": { - "regenerate": "^1.4.0", - "regenerate-unicode-properties": "^8.2.0", - "regjsgen": "^0.5.1", - "regjsparser": "^0.6.4", - "unicode-match-property-ecmascript": "^1.0.4", - "unicode-match-property-value-ecmascript": "^1.2.0" + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^9.0.0", + "regjsgen": "^0.5.2", + "regjsparser": "^0.7.0", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.0.0" } }, "regjsgen": { @@ -9699,9 +9675,9 @@ "dev": true }, "regjsparser": { - "version": "0.6.9", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.9.tgz", - "integrity": "sha512-ZqbNRz1SNjLAiYuwY0zoXW8Ne675IX5q+YHioAGbCw4X96Mjl2+dcX9B2ciaeyYjViDAfvIjFpQjJgLttTEERQ==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.7.0.tgz", + "integrity": "sha512-A4pcaORqmNMDVwUjWoTzuhwMGpP+NykpfqAsEgI1FSH/EzC7lrN5TMd+kN8YCovX+jMpu8eaqXgXPCa0g8FQNQ==", "dev": true, "requires": { "jsesc": "~0.5.0" @@ -10827,13 +10803,13 @@ } }, "svgo": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.5.0.tgz", - "integrity": "sha512-FSdBOOo271VyF/qZnOn1PgwCdt1v4Dx0Sey+U1jgqm1vqRYjPGdip0RGrFW6ItwtkBB8rHgHk26dlVr0uCs82Q==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.6.1.tgz", + "integrity": "sha512-SDo274ymyG1jJ3HtCr3hkfwS8NqWdF0fMr6xPlrJ5y2QMofsQxIEFWgR1epwb197teKGgnZbzozxvJyIeJpE2Q==", "dev": true, "requires": { - "@trysound/sax": "0.1.1", - "colorette": "^1.3.0", + "@trysound/sax": "0.2.0", + "colorette": "^1.4.0", "commander": "^7.2.0", "css-select": "^4.1.3", "css-tree": "^1.1.3", @@ -10848,9 +10824,9 @@ "dev": true }, "tapable": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz", - "integrity": "sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", "dev": true }, "tar": { @@ -11097,31 +11073,31 @@ "dev": true }, "unicode-canonical-property-names-ecmascript": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", - "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", + "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", "dev": true }, "unicode-match-property-ecmascript": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", - "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", "dev": true, "requires": { - "unicode-canonical-property-names-ecmascript": "^1.0.4", - "unicode-property-aliases-ecmascript": "^1.0.4" + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" } }, "unicode-match-property-value-ecmascript": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz", - "integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", + "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==", "dev": true }, "unicode-property-aliases-ecmascript": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz", - "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz", + "integrity": "sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==", "dev": true }, "union-value": { @@ -11651,11 +11627,7 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - } + "optional": true }, "glob-parent": { "version": "3.1.0", diff --git a/Angular-UrbanBazaar/package.json b/Angular-UrbanBazaar/package.json index b2facac..84a61e2 100644 --- a/Angular-UrbanBazaar/package.json +++ b/Angular-UrbanBazaar/package.json @@ -26,7 +26,7 @@ "zone.js": "~0.11.4" }, "devDependencies": { - "@angular-devkit/build-angular": "~12.1.1", + "@angular-devkit/build-angular": "^12.1.4", "@angular/cli": "~12.1.1", "@angular/compiler-cli": "~12.1.1", "@types/jasmine": "~3.6.0", diff --git a/Angular-UrbanBazaar/src/app/components/cart/cart.component.ts b/Angular-UrbanBazaar/src/app/components/cart/cart.component.ts index ea192af..9295a9c 100644 --- a/Angular-UrbanBazaar/src/app/components/cart/cart.component.ts +++ b/Angular-UrbanBazaar/src/app/components/cart/cart.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { Cart } from 'src/app/models/cart'; +import { User } from 'src/app/models/user'; import { CartService } from 'src/app/services/cart.service'; @Component({ @@ -12,25 +13,28 @@ export class CartComponent implements OnInit { public cartdetails:any =[]; public grandTotal!: number; + user : User; - constructor(private cartservice:CartService) { - // this.cartdetails = this.cartservice.showAllOrder(); + constructor(private cartservice : CartService) { + this.user = JSON.parse(localStorage.getItem('currentUser')); + this.cartdetails = this.cartservice.showCartForUser(this.user.userid); } ngOnInit(): void { - this.cartservice.getProducts() - .subscribe(res=>{ - this.cartdetails = res; - this.grandTotal = this.cartservice.getTotalPrice(); - }) + this.user = JSON.parse(localStorage.getItem('currentUser')); + this.cartdetails = this.cartservice.showCartForUser(this.user.userid); } - removeItem(item:any){ - this.cartservice.removeCartItem(item); + + public removeItem(cart_id : number){ + this.cartservice.deleteCartItemForUserId(cart_id); + } + + public addCartItem(cartItem : Cart) { + this.cartservice.addCartItem(cartItem) } - emptyCart() - { - this.cartservice.removeAllCart(); + public emptyCart() { + this.cartservice.removeAllCartForUserId(this.user.userid); } } diff --git a/Angular-UrbanBazaar/src/app/components/home/home.component.ts b/Angular-UrbanBazaar/src/app/components/home/home.component.ts index daaa1cc..12b3125 100644 --- a/Angular-UrbanBazaar/src/app/components/home/home.component.ts +++ b/Angular-UrbanBazaar/src/app/components/home/home.component.ts @@ -28,7 +28,7 @@ export class HomeComponent implements OnInit { } addCart(item:any){ - this.cartservice.addtoCart(item); + this.cartservice.addCartItem(item); } searchProduct() { diff --git a/Angular-UrbanBazaar/src/app/models/cart.ts b/Angular-UrbanBazaar/src/app/models/cart.ts index 5c5f2cc..e9568b2 100644 --- a/Angular-UrbanBazaar/src/app/models/cart.ts +++ b/Angular-UrbanBazaar/src/app/models/cart.ts @@ -1,13 +1,10 @@ export class Cart { - - public productid : number; + public cartid : number; + public userid : number; + public orderid : number; public productname : string; public productprice : number; - public productweight : number; - public productshortdesc : string; - public productlongdesc : string; - public productimage : string; - public productcategoryid : number; - - constructor() {} + public quantity : number; + + constructor() {} } From 73c7c910bed25b93034d481d2bb554a88b56dc90 Mon Sep 17 00:00:00 2001 From: Gowrisankar Date: Mon, 20 Sep 2021 13:52:18 +0530 Subject: [PATCH 07/10] Update 'Angular-UrbanBazaar/proxy.config.json' --- Angular-UrbanBazaar/proxy.config.json | 1 - 1 file changed, 1 deletion(-) diff --git a/Angular-UrbanBazaar/proxy.config.json b/Angular-UrbanBazaar/proxy.config.json index 14dded7..7a93e10 100644 --- a/Angular-UrbanBazaar/proxy.config.json +++ b/Angular-UrbanBazaar/proxy.config.json @@ -15,5 +15,4 @@ "target":"http://10.3.117.7:8004", "secure":false } - } \ No newline at end of file From 8446a67624c6e92629e39addf3fbbd644a8e55f2 Mon Sep 17 00:00:00 2001 From: Gowrisankar Date: Mon, 20 Sep 2021 14:18:40 +0530 Subject: [PATCH 08/10] Update 'grocery_db_tables.sql' --- grocery_db_tables.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grocery_db_tables.sql b/grocery_db_tables.sql index c46ee33..1c13aa0 100644 --- a/grocery_db_tables.sql +++ b/grocery_db_tables.sql @@ -152,8 +152,8 @@ create table `members`( ); INSERT INTO members VALUES(100, 1, "Abhishek", 0,"1234512345", 0); -INSERT INTO members VALUES(100, 2, "Meera", 5,"12345234567", 1200); -INSERT INTO members VALUES(100, 3, "Shyam", 10,"1234598745", 800); +INSERT INTO members VALUES(101, 2, "Meera", 5,"12345234567", 1200); +INSERT INTO members VALUES(102, 3, "Shyam", 10,"1234598745", 800); select * from members; From cc22a0e3c3d89b8222dfe7a186011e8bbdabd713 Mon Sep 17 00:00:00 2001 From: Gowrisankar Date: Mon, 20 Sep 2021 14:19:48 +0530 Subject: [PATCH 09/10] Update 'grocery_db_tables.sql' --- grocery_db_tables.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grocery_db_tables.sql b/grocery_db_tables.sql index 1c13aa0..6c605eb 100644 --- a/grocery_db_tables.sql +++ b/grocery_db_tables.sql @@ -151,9 +151,9 @@ create table `members`( FOREIGN KEY (`UserID`) REFERENCES users(`UserID`) ); -INSERT INTO members VALUES(100, 1, "Abhishek", 0,"1234512345", 0); -INSERT INTO members VALUES(101, 2, "Meera", 5,"12345234567", 1200); -INSERT INTO members VALUES(102, 3, "Shyam", 10,"1234598745", 800); +INSERT INTO members VALUES(100, 1, "Abhishek", 501, 0,"1234512345", 0); +INSERT INTO members VALUES(101, 2, "Meera", 502, 5,"12345234567", 1200); +INSERT INTO members VALUES(102, 3, "Shyam", 503, 10,"1234598745", 800); select * from members; From fb2720ddac9edea8fcd3eac8052c4a5bac31e6f0 Mon Sep 17 00:00:00 2001 From: Gowrisankar Date: Mon, 20 Sep 2021 14:22:29 +0530 Subject: [PATCH 10/10] Update 'grocery_db_tables.sql' --- grocery_db_tables.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grocery_db_tables.sql b/grocery_db_tables.sql index 6c605eb..ee3ac7c 100644 --- a/grocery_db_tables.sql +++ b/grocery_db_tables.sql @@ -152,8 +152,8 @@ create table `members`( ); INSERT INTO members VALUES(100, 1, "Abhishek", 501, 0,"1234512345", 0); -INSERT INTO members VALUES(101, 2, "Meera", 502, 5,"12345234567", 1200); -INSERT INTO members VALUES(102, 3, "Shyam", 503, 10,"1234598745", 800); +INSERT INTO members VALUES(100, 2, "Meera", 502, 5,"12345234567", 1200); +INSERT INTO members VALUES(100, 3, "Shyam", 503, 10,"1234598745", 800); select * from members;