31 changed files with 449 additions and 123 deletions
Split View
Diff Options
-
15Shopify-Cart/src/main/java/com/shopify/cart/controller/CartController.java
-
48Shopify-Cart/src/main/java/com/shopify/cart/controller/ProductController.java
-
36Shopify-Cart/src/main/java/com/shopify/cart/controller/UserController.java
-
3Shopify-Cart/src/main/java/com/shopify/cart/repository/CartRepository.java
-
4Shopify-Cart/src/main/resources/application.properties
-
12ShopifyUI/proxy.conf.json
-
6ShopifyUI/src/app/app-routing.module.ts
-
27ShopifyUI/src/app/auth/login/login.component.css
-
42ShopifyUI/src/app/auth/login/login.component.html
-
33ShopifyUI/src/app/auth/login/login.component.ts
-
33ShopifyUI/src/app/auth/sign-up/sign-up.component.css
-
42ShopifyUI/src/app/auth/sign-up/sign-up.component.html
-
34ShopifyUI/src/app/auth/sign-up/sign-up.component.ts
-
14ShopifyUI/src/app/components/cart/cart.component.css
-
11ShopifyUI/src/app/components/cart/cart.component.html
-
27ShopifyUI/src/app/components/cart/cart.component.ts
-
7ShopifyUI/src/app/components/home/home.component.css
-
13ShopifyUI/src/app/components/home/home.component.html
-
17ShopifyUI/src/app/components/payments/payments.component.css
-
32ShopifyUI/src/app/components/payments/payments.component.html
-
16ShopifyUI/src/app/components/payments/payments.component.ts
-
3ShopifyUI/src/app/components/product-detail/product-detail.component.css
-
29ShopifyUI/src/app/components/product-detail/product-detail.component.html
-
31ShopifyUI/src/app/components/product-detail/product-detail.component.ts
-
4ShopifyUI/src/app/components/products/products.component.css
-
2ShopifyUI/src/app/components/products/products.component.html
-
6ShopifyUI/src/app/model/review.model.ts
-
7ShopifyUI/src/app/service/cart.service.ts
-
2ShopifyUI/src/app/service/product.service.ts
-
12ShopifyUI/src/app/service/review.service.ts
-
4ShopifyUI/src/styles.css
@ -1,48 +0,0 @@ |
|||
package com.shopify.cart.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.CrossOrigin; |
|||
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.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import com.shopify.cart.model.Product; |
|||
import com.shopify.cart.repository.ProductRepository; |
|||
|
|||
@RestController |
|||
public class ProductController { |
|||
|
|||
@Autowired |
|||
private ProductRepository productRepository; |
|||
|
|||
@PostMapping("/product") |
|||
public Product postProduct(@RequestBody Product product) { |
|||
return productRepository.save(product); |
|||
} |
|||
|
|||
@GetMapping("/product") |
|||
public List<Product> getAllProducts() { |
|||
return productRepository.findAll(); |
|||
} |
|||
|
|||
@GetMapping("/product/trending") |
|||
public List<Product> getAllTrendingProducts() { |
|||
return productRepository.findAllByTrending(); |
|||
} |
|||
|
|||
@GetMapping("/product/{pid}") |
|||
public Product getProductById(@PathVariable("pid") Long pid) { |
|||
return productRepository.getById(pid); |
|||
} |
|||
|
|||
@GetMapping("/product/name/{name}") |
|||
public List<Product> showProduct(@PathVariable String name) |
|||
{ |
|||
return productRepository.findAllByName(name); |
|||
} |
|||
} |
|||
@ -1,36 +0,0 @@ |
|||
package com.shopify.cart.controller; |
|||
|
|||
import java.util.List; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
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.shopify.cart.model.User; |
|||
import com.shopify.cart.repository.UserRepository; |
|||
|
|||
|
|||
@RestController |
|||
public class UserController { |
|||
|
|||
@Autowired |
|||
private UserRepository userRepository; |
|||
|
|||
@PostMapping("/user") |
|||
public User postUser(@RequestBody User user) { |
|||
return userRepository.save(user); |
|||
} |
|||
|
|||
@GetMapping("/user") |
|||
public List<User> getAllUser() { |
|||
return userRepository.findAll(); |
|||
} |
|||
|
|||
@GetMapping("/user/{uid}") |
|||
public User getUserById(@PathVariable("uid") Long uid) { |
|||
return userRepository.getById(uid); |
|||
} |
|||
} |
|||
@ -1,6 +1,14 @@ |
|||
{ |
|||
"/api": { |
|||
"target": "http://10.3.117.22:8002", |
|||
"/api1": { |
|||
"target": "http://10.3.117.26:8001", |
|||
"secure": false |
|||
}, |
|||
"/api2": { |
|||
"target": "http://10.3.117.26:8002", |
|||
"secure": false |
|||
}, |
|||
"/api3": { |
|||
"target": "http://10.3.117.26:8003", |
|||
"secure": false |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
.login_form { |
|||
margin: 0px auto; |
|||
border: none; |
|||
padding: 16px; |
|||
height: 440px; |
|||
box-shadow: 2px 4px 14px 0px rgba(0, 0, 0, 0.74); |
|||
-webkit-box-shadow: 2px 4px 14px 0px rgba(0, 0, 0, 0.74); |
|||
-moz-box-shadow: 2px 4px 14px 0px rgba(0, 0, 0, 0.74); |
|||
} |
|||
|
|||
.login_form input { |
|||
width: 100%; |
|||
height: 45px; |
|||
padding: 12px; |
|||
} |
|||
|
|||
.login_form button { |
|||
border: none; |
|||
background-color: #1F618D; |
|||
color: white; |
|||
padding: 12px 16px; |
|||
width: 100%; |
|||
} |
|||
|
|||
.login_form p { |
|||
color: #E74C3C; |
|||
} |
|||
@ -1 +1,41 @@ |
|||
<p>login works!</p> |
|||
<div class="row navbar"> |
|||
<div class="col-10"> |
|||
<h2>Shopify</h2> |
|||
</div> |
|||
<div class="col-1"> |
|||
<a routerLink="/home">Home</a> |
|||
</div> |
|||
<div class="col-1"> |
|||
<a routerLink="/products">Products</a> |
|||
</div> |
|||
</div> |
|||
<BR><BR><BR><BR><BR><BR> |
|||
<div class="row"> |
|||
<div class="col-3 card login_form text-center"> |
|||
<h1 style="color: #1B4F72;">LOGIN</h1> |
|||
<form [formGroup]='loginForm' (submit)='onLoginFormSubmit()'> |
|||
<input type="text" placeholder="Enter Username" formControlName="username" /> |
|||
<div *ngIf="loginForm.controls['username'].invalid && (loginForm.controls['username'].touched || loginForm.controls['username'].dirty)"> |
|||
<p>Invalid Username</p> |
|||
</div> |
|||
<BR><BR> |
|||
<input type="password" placeholder="Enter Password" formControlName="password" /> |
|||
<div *ngIf="loginForm.controls['password'].invalid && (loginForm.controls['password'].touched || loginForm.controls['password'].dirty)"> |
|||
<p>Invalid Password</p> |
|||
</div> |
|||
<BR><BR> |
|||
<button [disabled]='!loginForm.valid'>Login</button> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
{{msg}} |
|||
</div> |
|||
</div> |
|||
<br> |
|||
<div class="row"> |
|||
<div class="col-12 text-center"> |
|||
<p style="color: #1B4F72;">Don't have an account ? <a routerLink="/signup">Sign Up</a></p> |
|||
</div> |
|||
</div> |
|||
@ -0,0 +1,33 @@ |
|||
.login_form { |
|||
margin: 0px auto; |
|||
border: none; |
|||
padding: 16px; |
|||
height: 570px; |
|||
box-shadow: 2px 4px 14px 0px rgba(0, 0, 0, 0.74); |
|||
-webkit-box-shadow: 2px 4px 14px 0px rgba(0, 0, 0, 0.74); |
|||
-moz-box-shadow: 2px 4px 14px 0px rgba(0, 0, 0, 0.74); |
|||
} |
|||
|
|||
.login_form input { |
|||
width: 100%; |
|||
height: 45px; |
|||
padding: 12px; |
|||
} |
|||
|
|||
.login_form button { |
|||
border: none; |
|||
background-color: #1F618D; |
|||
color: white; |
|||
padding: 12px 16px; |
|||
width: 100%; |
|||
} |
|||
|
|||
.login_form select { |
|||
width: 100%; |
|||
height: 45px; |
|||
} |
|||
|
|||
.login_form p { |
|||
color: #E74C3C; |
|||
} |
|||
|
|||
@ -1 +1,41 @@ |
|||
<p>sign-up works!</p> |
|||
<div class="row navbar"> |
|||
<div class="col-10"> |
|||
<h2>Shopify</h2> |
|||
</div> |
|||
<div class="col-1"> |
|||
<a routerLink="/home">Home</a> |
|||
</div> |
|||
<div class="col-1"> |
|||
<a routerLink="/products">Products</a> |
|||
</div> |
|||
</div> |
|||
<BR><BR><BR><BR><BR><BR> |
|||
<div class="row"> |
|||
<div class="col-3 card login_form text-center"> |
|||
<h1 style="color: #1B4F72;">SIGN UP</h1> |
|||
<form [formGroup]='signUpForm' (submit)='onSignUpFormSubmit()'> |
|||
<input type="text" placeholder="Enter Name" formControlName="name" /> |
|||
<div *ngIf="signUpForm.controls['name'].invalid && (signUpForm.controls['name'].touched || signUpForm.controls['name'].dirty)"> |
|||
<p>Invalid Name</p> |
|||
</div> |
|||
<BR><BR> |
|||
<input type="text" placeholder="Enter Username" formControlName="username" /> |
|||
<div *ngIf="signUpForm.controls['username'].invalid && (signUpForm.controls['username'].touched || signUpForm.controls['username'].dirty)"> |
|||
<p>Invalid Username</p> |
|||
</div> |
|||
<BR><BR> |
|||
<input type="password" placeholder="Enter Password" formControlName="password" /> |
|||
<div *ngIf="signUpForm.controls['password'].invalid && (signUpForm.controls['password'].touched || signUpForm.controls['password'].dirty)"> |
|||
<p>Invalid Password</p> |
|||
</div> |
|||
<BR><BR> |
|||
<button [disabled]='!signUpForm.valid'>Sign Up</button> |
|||
</form> |
|||
</div> |
|||
</div> |
|||
<br> |
|||
<div class="row"> |
|||
<div class="col-12 text-center"> |
|||
<p style="color: #1B4F72;">Already have an account ? <a routerLink="/login">Login</a></p> |
|||
</div> |
|||
</div> |
|||
@ -0,0 +1,17 @@ |
|||
.paymentLine { |
|||
margin: 0px auto; |
|||
box-shadow: 2px 4px 14px 0px rgba(0, 0, 0, 0.74); |
|||
-webkit-box-shadow: 2px 4px 14px 0px rgba(0, 0, 0, 0.74); |
|||
-moz-box-shadow: 2px 4px 14px 0px rgba(0, 0, 0, 0.74); |
|||
padding: 12px; |
|||
color: #1B4F72; |
|||
} |
|||
|
|||
.payBtn button { |
|||
border: 1px solid transparent; |
|||
padding: 12px 14px; |
|||
border-radius: 20px; |
|||
color: white; |
|||
background-color: #2E86C1; |
|||
width: 95%; |
|||
} |
|||
@ -1 +1,31 @@ |
|||
<p>payments works!</p> |
|||
<div class="row navbar"> |
|||
<div class="col-8"> |
|||
<h2>Shopify</h2> |
|||
</div> |
|||
<div class="col-1"> |
|||
<a routerLink="/home">Home</a> |
|||
</div> |
|||
<div class="col-1"> |
|||
<a routerLink="/products">Products</a> |
|||
</div> |
|||
<div class="col-1 active"> |
|||
<a routerLink="/cart/{{uid}}">{{cartNo}} <i class="bi bi-cart3"></i>Cart</a> |
|||
</div> |
|||
<div class="col-1 loginbtn"> |
|||
<a routerLink="/login">Login</a> |
|||
</div> |
|||
</div> |
|||
<br><br> |
|||
<div class="row"> |
|||
<div class="col-10 paymentLine"> |
|||
<div> |
|||
<h3>We only take cash on delivery</h3> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<br><br> |
|||
<div class="row"> |
|||
<div class="col-12 text-center payBtn"> |
|||
<button routerLink="/order">Proceed To Checkout</button> |
|||
</div> |
|||
</div> |
|||
@ -0,0 +1,6 @@ |
|||
export class ReviewDto { |
|||
reviewText:string; |
|||
rating:number; |
|||
username:string; |
|||
product_name:string; |
|||
} |
|||
@ -1,9 +1,19 @@ |
|||
import { HttpClient } from '@angular/common/http'; |
|||
import { Injectable } from '@angular/core'; |
|||
import { Observable } from 'rxjs'; |
|||
import { ReviewDto } from '../model/review.model'; |
|||
|
|||
@Injectable({ |
|||
providedIn: 'root' |
|||
}) |
|||
export class ReviewService { |
|||
|
|||
constructor() { } |
|||
path:string = "http://localhost:59279/api3"; |
|||
|
|||
constructor(private httpClient:HttpClient) { } |
|||
|
|||
public getReviewsByProduct(pid:string): Observable<ReviewDto[]> { |
|||
let review_get_api = this.path + "/review/product?pid=" + pid; |
|||
return this.httpClient.get<ReviewDto[]>(review_get_api); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue