36 changed files with 353 additions and 723 deletions
Unified View
Diff Options
-
22Angular-UrbanBazaar/src/app/app-routing.module.ts
-
29Angular-UrbanBazaar/src/app/app.module.ts
-
40Angular-UrbanBazaar/src/app/auth/sign-up/sign-up.component.ts
-
51Angular-UrbanBazaar/src/app/components/home/home.component.html
-
51Angular-UrbanBazaar/src/app/components/home/home.component.ts
-
107Angular-UrbanBazaar/src/app/components/memberlist/memberlist.component.ts
-
36Angular-UrbanBazaar/src/app/components/page-nav-bar/page-nav-bar.component.html
-
18Angular-UrbanBazaar/src/app/components/page-nav-bar/page-nav-bar.component.ts
-
0Angular-UrbanBazaar/src/app/components/user-add/user-add.component.css
-
1Angular-UrbanBazaar/src/app/components/user-add/user-add.component.html
-
25Angular-UrbanBazaar/src/app/components/user-add/user-add.component.spec.ts
-
15Angular-UrbanBazaar/src/app/components/user-add/user-add.component.ts
-
46Angular-UrbanBazaar/src/app/components/user-profile-details/user-profile-details.component.ts
-
0Angular-UrbanBazaar/src/app/components/user-search/user-search.component.css
-
1Angular-UrbanBazaar/src/app/components/user-search/user-search.component.html
-
25Angular-UrbanBazaar/src/app/components/user-search/user-search.component.spec.ts
-
15Angular-UrbanBazaar/src/app/components/user-search/user-search.component.ts
-
3Angular-UrbanBazaar/src/app/components/user-show/user-show.component.css
-
29Angular-UrbanBazaar/src/app/components/user-show/user-show.component.html
-
25Angular-UrbanBazaar/src/app/components/user-show/user-show.component.spec.ts
-
22Angular-UrbanBazaar/src/app/components/user-show/user-show.component.ts
-
16Angular-UrbanBazaar/src/app/models/cart.ts
-
8Angular-UrbanBazaar/src/app/models/login.ts
-
16Angular-UrbanBazaar/src/app/models/member-user.ts
-
35Angular-UrbanBazaar/src/app/models/orders.ts
-
7Angular-UrbanBazaar/src/app/models/product-category.ts
-
19Angular-UrbanBazaar/src/app/models/product.ts
-
24Angular-UrbanBazaar/src/app/models/user.ts
-
73Angular-UrbanBazaar/src/app/services/cart.service.ts
-
69Angular-UrbanBazaar/src/app/services/member-user.service.ts
-
22Angular-UrbanBazaar/src/app/services/orders.service.ts
-
13Angular-UrbanBazaar/src/app/services/product-category.service.ts
-
23Angular-UrbanBazaar/src/app/services/product.service.ts
-
89Angular-UrbanBazaar/src/app/services/user.service.ts
-
7UB_UserServiceProxy/src/main/resources/application.properties
-
94grocery_db_tables.sql
@ -1,50 +1,23 @@ |
|||||
|
|
||||
<body> |
<body> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<button style="shape-outside: circle();color:forestgreen; |
||||
|
background-color: white; border-color: forestgreen;" class="EditProfile" (click)=EditProfile()>Edit |
||||
|
Profile</button> |
||||
|
|
||||
<button style="shape-outside: circle();color:forestgreen; background-color: white; border-color: forestgreen;" class="EditProfile" (click)=EditProfile()>Edit Profile</button> |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
<button style="shape-outside: circle();color: forestgreen; background-color: white; border-color: forestgreen;" class="Members List of Curent User" (click)=Members()>Members List of Curent User</button> |
|
||||
<br/><br/> |
|
||||
|
<button style="shape-outside: circle();color: forestgreen; background-color: white; border-color: forestgreen;" class="Members List of Curent User" (click)=Members()>Members List of Curent User</button> |
||||
|
<br /><br /> |
||||
|
|
||||
<form class="form-inline my-2 my-lg-0"> |
<form class="form-inline my-2 my-lg-0"> |
||||
<input class="form-control mr-sm-2" type="text" |
|
||||
[(ngModel)]="searchValue" id="searchValue" [ngModelOptions]="{standalone: true}" |
|
||||
placeholder="Search" aria-label="Search"> |
|
||||
<button class="btn btn-outline-success my-2 my-sm-0" |
|
||||
type="submit" (click)="searchProduct()">Search</button> |
|
||||
</form> |
|
||||
<button class="showCart" (click)="showCart()">Show Cart</button> |
|
||||
|
|
||||
|
<input class="form-control mr-sm-2" type="text" [(ngModel)]="searchValue" id="searchValue" [ngModelOptions]="{standalone: true}" placeholder="Search" aria-label="Search"> |
||||
|
<button class="btn btn-outline-success my-2 my-sm-0" type="submit" (click)="searchProduct()">Search</button> |
||||
|
</form> |
||||
|
<button class="showCart" (click)="showCart()">Show Cart</button> |
||||
|
|
||||
<div class="cardParent"> |
<div class="cardParent"> |
||||
<div class="card" *ngFor="let i of Searchedproducts"> |
<div class="card" *ngFor="let i of Searchedproducts"> |
||||
<img src="{{i.productimage}}" style="width:85%"> |
<img src="{{i.productimage}}" style="width:85%"> |
||||
<h5>{{i.productname}}</h5> |
<h5>{{i.productname}}</h5> |
||||
<p class="price">Rs. {{i.productprice}} <br> |
|
||||
Weight: {{i.productweight}} Kg</p> |
|
||||
|
<p class="price">Rs. {{i.productprice}} <br> Weight: {{i.productweight}} Kg</p> |
||||
<p><button class="AddToCart" (click)=addCart(i)>Add to Cart</button></p> |
<p><button class="AddToCart" (click)=addCart(i)>Add to Cart</button></p> |
||||
</div> |
</div> |
||||
</div> |
</div> |
||||
|
|
||||
</body> |
|
||||
<!-- <div > |
|
||||
<app-page-nav-bar></app-page-nav-bar> |
|
||||
</div> --> |
|
||||
|
|
||||
<!-- <button type="button" style="text-align:center;background-color:dimgray;" cls="btn" (click)="btnClick();">EditProfile</button> --> |
|
||||
|
|
||||
|
|
||||
<!-- <div style="text-align:center;"> |
|
||||
<a [routerLink]="['/home', {outlets: {'member': ['memberlist']}}]">Members List of Curent User</a> |
|
||||
</div> |
|
||||
<router-outlet name="member"></router-outlet> --> |
|
||||
<!-- |
|
||||
<div style="text-align:center;"> |
|
||||
<a [routerLink]="['/home', {outlets: {'user': ['user-profile-details']}}]">EditProfile</a> |
|
||||
</div> |
|
||||
<router-outlet name="user"></router-outlet> --> |
|
||||
|
</body> |
||||
@ -1,55 +1,52 @@ |
|||||
import { Component, OnInit } from '@angular/core'; |
import { Component, OnInit } from '@angular/core'; |
||||
import { ProductService } from './../../services/product.service'; |
import { ProductService } from './../../services/product.service'; |
||||
import { Observable } from 'rxjs'; |
|
||||
import { Product } from './../../models/product'; |
import { Product } from './../../models/product'; |
||||
import { ActivatedRoute, Router } from '@angular/router'; |
|
||||
|
import { Router } from '@angular/router'; |
||||
import { CartService } from 'src/app/services/cart.service'; |
import { CartService } from 'src/app/services/cart.service'; |
||||
import { Cart } from 'src/app/models/cart'; |
|
||||
import { ThrowStmt } from '@angular/compiler'; |
|
||||
|
|
||||
@Component({ |
@Component({ |
||||
selector: 'app-home', |
selector: 'app-home', |
||||
templateUrl: './home.component.html', |
templateUrl: './home.component.html', |
||||
styleUrls: ['./home.component.css'] |
|
||||
|
styleUrls: ['./home.component.css'], |
||||
}) |
}) |
||||
export class HomeComponent implements OnInit { |
export class HomeComponent implements OnInit { |
||||
|
|
||||
public products: Product[]; |
public products: Product[]; |
||||
public Searchedproducts: Product[]; |
public Searchedproducts: Product[]; |
||||
searchValue : string = ""; |
|
||||
|
searchValue: string = ''; |
||||
|
|
||||
constructor(private productservice: ProductService, |
|
||||
private router: Router, |
|
||||
private cartservice: CartService, |
|
||||
) {} |
|
||||
|
constructor( |
||||
|
private productservice: ProductService, |
||||
|
private router: Router, |
||||
|
private cartservice: CartService |
||||
|
) {} |
||||
|
|
||||
public showCart(){ |
|
||||
|
public showCart() { |
||||
this.router.navigateByUrl('/showCart'); |
this.router.navigateByUrl('/showCart'); |
||||
} |
} |
||||
|
|
||||
addCart(item:any){ |
|
||||
|
addCart(item: any) { |
||||
this.cartservice.addtoCart(item); |
this.cartservice.addtoCart(item); |
||||
} |
} |
||||
|
|
||||
searchProduct() { |
searchProduct() { |
||||
if(this.searchValue=="") { |
|
||||
|
if (this.searchValue == '') { |
||||
this.Searchedproducts = this.products; |
this.Searchedproducts = this.products; |
||||
} else { |
} else { |
||||
// this.productservice.searchProduct(this.searchValue).subscribe(
|
|
||||
// res => {this.Searchedproducts = res;}
|
|
||||
// );
|
|
||||
this.Searchedproducts = this.products.filter(p => p.productname.toLocaleLowerCase().includes(this.searchValue)); |
|
||||
|
this.Searchedproducts = this.products.filter((p) => |
||||
|
p.productname.toLocaleLowerCase().includes(this.searchValue) |
||||
|
); |
||||
} |
} |
||||
} |
} |
||||
EditProfile(){ |
|
||||
this.router.navigateByUrl('/user-profile-details') |
|
||||
} |
|
||||
Members(){ |
|
||||
this.router.navigateByUrl('/memberlist') |
|
||||
} |
|
||||
|
EditProfile() { |
||||
|
this.router.navigateByUrl('/user-profile-details'); |
||||
|
} |
||||
|
Members() { |
||||
|
this.router.navigateByUrl('/memberlist'); |
||||
|
} |
||||
ngOnInit(): void { |
ngOnInit(): void { |
||||
this.productservice.showAllProduct().subscribe(res=>{ |
|
||||
|
this.productservice.showAllProduct().subscribe((res) => { |
||||
this.products = res; |
this.products = res; |
||||
this.Searchedproducts = res; |
this.Searchedproducts = res; |
||||
}) |
|
||||
}} |
|
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -1,29 +1,19 @@ |
|||||
<nav class="navbar navbar-expand-lg navbar-light bg-light"> |
<nav class="navbar navbar-expand-lg navbar-light bg-light"> |
||||
<a class="navbar-brand" href="#">Urban Bazaar</a> |
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> |
|
||||
|
<a class="navbar-brand" href="#">Urban Bazaar</a> |
||||
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> |
||||
<span class="navbar-toggler-icon"></span> |
<span class="navbar-toggler-icon"></span> |
||||
</button> |
</button> |
||||
|
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent"> |
|
||||
<ul class="navbar-nav mr-auto"> |
|
||||
<li class="nav-item active"> |
|
||||
<a class="nav-link" href="/home">Home <span class="sr-only">(current)</span></a> |
|
||||
</li> |
|
||||
|
<div class="collapse navbar-collapse" id="navbarSupportedContent"> |
||||
|
<ul class="navbar-nav mr-auto"> |
||||
|
<li class="nav-item active"> |
||||
|
<a class="nav-link" href="/home">Home <span class="sr-only">(current)</span></a> |
||||
|
</li> |
||||
|
|
||||
<li class="nav-item active"> |
|
||||
|
|
||||
<a class="nav-link" href="/profile"> Profile <span class="sr-only">(current)</span></a> |
|
||||
</li> |
|
||||
<!-- Dropdown --> |
|
||||
<!-- <li class="nav-item dropdown" dropdown> |
|
||||
<a dropdownToggle mdbWavesEffect type="button" class="nav-link dropdown-toggle waves-light" mdbWavesEffect> |
|
||||
Profile<span class="caret"></span></a> |
|
||||
<div *dropdownMenu class="dropdown-menu dropdown-menu-right dropdown dropdown-primary" role="menu"> |
|
||||
<a class="dropdown-item waves-light" mdbWavesEffect href="#">My account</a> |
|
||||
<a class="dropdown-item waves-light" mdbWavesEffect href="#">Log out</a> |
|
||||
</div> |
|
||||
</li> --> |
|
||||
</ul> |
|
||||
|
|
||||
</div> |
|
||||
|
<li class="nav-item active"> |
||||
|
<a class="nav-link" href="/user-profile-details"> |
||||
|
Profile <span class="sr-only">(current)</span></a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
</nav> |
</nav> |
||||
@ -1 +0,0 @@ |
|||||
<p>user-add works!</p> |
|
||||
@ -1,25 +0,0 @@ |
|||||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|
||||
|
|
||||
import { UserAddComponent } from './user-add.component'; |
|
||||
|
|
||||
describe('UserAddComponent', () => { |
|
||||
let component: UserAddComponent; |
|
||||
let fixture: ComponentFixture<UserAddComponent>; |
|
||||
|
|
||||
beforeEach(async () => { |
|
||||
await TestBed.configureTestingModule({ |
|
||||
declarations: [ UserAddComponent ] |
|
||||
}) |
|
||||
.compileComponents(); |
|
||||
}); |
|
||||
|
|
||||
beforeEach(() => { |
|
||||
fixture = TestBed.createComponent(UserAddComponent); |
|
||||
component = fixture.componentInstance; |
|
||||
fixture.detectChanges(); |
|
||||
}); |
|
||||
|
|
||||
it('should create', () => { |
|
||||
expect(component).toBeTruthy(); |
|
||||
}); |
|
||||
}); |
|
||||
@ -1,15 +0,0 @@ |
|||||
import { Component, OnInit } from '@angular/core'; |
|
||||
|
|
||||
@Component({ |
|
||||
selector: 'app-user-add', |
|
||||
templateUrl: './user-add.component.html', |
|
||||
styleUrls: ['./user-add.component.css'] |
|
||||
}) |
|
||||
export class UserAddComponent implements OnInit { |
|
||||
|
|
||||
constructor() { } |
|
||||
|
|
||||
ngOnInit(): void { |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -1 +0,0 @@ |
|||||
<p>user-search works!</p> |
|
||||
@ -1,25 +0,0 @@ |
|||||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|
||||
|
|
||||
import { UserSearchComponent } from './user-search.component'; |
|
||||
|
|
||||
describe('UserSearchComponent', () => { |
|
||||
let component: UserSearchComponent; |
|
||||
let fixture: ComponentFixture<UserSearchComponent>; |
|
||||
|
|
||||
beforeEach(async () => { |
|
||||
await TestBed.configureTestingModule({ |
|
||||
declarations: [ UserSearchComponent ] |
|
||||
}) |
|
||||
.compileComponents(); |
|
||||
}); |
|
||||
|
|
||||
beforeEach(() => { |
|
||||
fixture = TestBed.createComponent(UserSearchComponent); |
|
||||
component = fixture.componentInstance; |
|
||||
fixture.detectChanges(); |
|
||||
}); |
|
||||
|
|
||||
it('should create', () => { |
|
||||
expect(component).toBeTruthy(); |
|
||||
}); |
|
||||
}); |
|
||||
@ -1,15 +0,0 @@ |
|||||
import { Component, OnInit } from '@angular/core'; |
|
||||
|
|
||||
@Component({ |
|
||||
selector: 'app-user-search', |
|
||||
templateUrl: './user-search.component.html', |
|
||||
styleUrls: ['./user-search.component.css'] |
|
||||
}) |
|
||||
export class UserSearchComponent implements OnInit { |
|
||||
|
|
||||
constructor() { } |
|
||||
|
|
||||
ngOnInit(): void { |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -1,3 +0,0 @@ |
|||||
body { |
|
||||
padding-left: 10px; |
|
||||
} |
|
||||
@ -1,29 +0,0 @@ |
|||||
<p>user-show works!</p> |
|
||||
|
|
||||
<body> |
|
||||
<h3>All User Details</h3> |
|
||||
|
|
||||
<table class="table table-hover"> |
|
||||
<tr> |
|
||||
<th>User Id</th> |
|
||||
<th>User Email</th> |
|
||||
<th>First Name</th> |
|
||||
<th>City</th> |
|
||||
<th>Zipcode</th> |
|
||||
<th>Phone</th> |
|
||||
<th>Address Line 1</th> |
|
||||
<th>Address Line 2</th> |
|
||||
</tr> |
|
||||
<tr *ngFor="let user of userList | async"> |
|
||||
<td>{{user.userid}}</td> |
|
||||
<td>{{user.useremail}}</td> |
|
||||
<td>{{user.userfirstname}}</td> |
|
||||
<td>{{user.usercity}}</td> |
|
||||
<td>{{user.userzip}}</td> |
|
||||
<td>{{user.userphone}}</td> |
|
||||
<td>{{user.useraddress}}</td> |
|
||||
<td>{{user.useraddress2}}</td> |
|
||||
</tr> |
|
||||
</table> |
|
||||
|
|
||||
</body> |
|
||||
@ -1,25 +0,0 @@ |
|||||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|
||||
|
|
||||
import { UserShowComponent } from './user-show.component'; |
|
||||
|
|
||||
describe('UserShowComponent', () => { |
|
||||
let component: UserShowComponent; |
|
||||
let fixture: ComponentFixture<UserShowComponent>; |
|
||||
|
|
||||
beforeEach(async () => { |
|
||||
await TestBed.configureTestingModule({ |
|
||||
declarations: [ UserShowComponent ] |
|
||||
}) |
|
||||
.compileComponents(); |
|
||||
}); |
|
||||
|
|
||||
beforeEach(() => { |
|
||||
fixture = TestBed.createComponent(UserShowComponent); |
|
||||
component = fixture.componentInstance; |
|
||||
fixture.detectChanges(); |
|
||||
}); |
|
||||
|
|
||||
it('should create', () => { |
|
||||
expect(component).toBeTruthy(); |
|
||||
}); |
|
||||
}); |
|
||||
@ -1,22 +0,0 @@ |
|||||
import { Component, OnInit } from '@angular/core'; |
|
||||
import { Observable } from 'rxjs'; |
|
||||
import { User } from 'src/app/models/user'; |
|
||||
import { UserService } from 'src/app/services/user.service'; |
|
||||
|
|
||||
@Component({ |
|
||||
selector: 'app-user-show', |
|
||||
templateUrl: './user-show.component.html', |
|
||||
styleUrls: ['./user-show.component.css'] |
|
||||
}) |
|
||||
export class UserShowComponent implements OnInit { |
|
||||
|
|
||||
userList : Observable<User[]>; |
|
||||
|
|
||||
constructor(private _userService : UserService) { |
|
||||
this.userList = this._userService.showAllUsers(); |
|
||||
} |
|
||||
|
|
||||
ngOnInit(): void { |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -1,10 +1,10 @@ |
|||||
export class Cart { |
export class Cart { |
||||
public cartid : number; |
|
||||
public userid : number; |
|
||||
public orderid : number; |
|
||||
public productname : string; |
|
||||
public productprice : number; |
|
||||
public quantity : number; |
|
||||
|
|
||||
constructor() {} |
|
||||
|
public cartid: number; |
||||
|
public userid: number; |
||||
|
public orderid: number; |
||||
|
public productname: string; |
||||
|
public productprice: number; |
||||
|
public quantity: number; |
||||
|
|
||||
|
constructor() {} |
||||
} |
} |
||||
@ -1,6 +1,6 @@ |
|||||
export class Login { |
export class Login { |
||||
public userfirstname : string; |
|
||||
public userpassword : string; |
|
||||
|
|
||||
constructor() {} |
|
||||
|
public userfirstname: string; |
||||
|
public userpassword: string; |
||||
|
|
||||
|
constructor() {} |
||||
} |
} |
||||
@ -1,10 +1,10 @@ |
|||||
export class MemberUser { |
export class MemberUser { |
||||
public userid : number; |
|
||||
public memberid : number; |
|
||||
public membername : string; |
|
||||
public totalitems : number; |
|
||||
public memberphone : string; |
|
||||
public membertotalamount : number; |
|
||||
public memberdoornumber: number; |
|
||||
constructor() {} |
|
||||
|
public userid: number; |
||||
|
public memberid: number; |
||||
|
public membername: string; |
||||
|
public totalitems: number; |
||||
|
public memberphone: string; |
||||
|
public membertotalamount: number; |
||||
|
public memberdoornumber: number; |
||||
|
constructor() {} |
||||
} |
} |
||||
@ -1,21 +1,20 @@ |
|||||
export class Orders { |
export class Orders { |
||||
|
public orderid: number; |
||||
|
public orderuserid: number; |
||||
|
public orderamount: number; |
||||
|
public ordershipaddress: string; |
||||
|
public ordershipaddress2: string; |
||||
|
public ordercity: string; |
||||
|
public orderzip: string; |
||||
|
public orderstate: string; |
||||
|
public ordercountry: string; |
||||
|
public orderphone: string; |
||||
|
public ordershippingcost: number; |
||||
|
public ordertax: number; |
||||
|
public orderemail: string; |
||||
|
public orderdate: Date; |
||||
|
public ordershipped: string; |
||||
|
public ordertrackingnumber: string; |
||||
|
|
||||
public orderid : number; |
|
||||
public orderuserid : number; |
|
||||
public orderamount : number; |
|
||||
public ordershipaddress : string; |
|
||||
public ordershipaddress2 : string; |
|
||||
public ordercity : string; |
|
||||
public orderzip : string; |
|
||||
public orderstate : string; |
|
||||
public ordercountry : string; |
|
||||
public orderphone : string; |
|
||||
public ordershippingcost : number; |
|
||||
public ordertax : number; |
|
||||
public orderemail : string; |
|
||||
public orderdate : Date; |
|
||||
public ordershipped : string; |
|
||||
public ordertrackingnumber : string; |
|
||||
|
|
||||
constructor() {} |
|
||||
|
constructor() {} |
||||
} |
} |
||||
@ -1,7 +1,6 @@ |
|||||
export class ProductCategory { |
export class ProductCategory { |
||||
|
public categoryid: number; |
||||
|
public categoryname: string; |
||||
|
|
||||
public categoryid : number; |
|
||||
public categoryname : string; |
|
||||
|
|
||||
constructor() {} |
|
||||
|
constructor() {} |
||||
} |
} |
||||
@ -1,13 +1,12 @@ |
|||||
export class Product { |
export class Product { |
||||
|
public productid: number; |
||||
|
public productname: string; |
||||
|
public productprice: number; |
||||
|
public productweight: number; |
||||
|
public productshortdesc: string; |
||||
|
public productlongdesc: string; |
||||
|
public productimage: string; |
||||
|
public productcategoryid: number; |
||||
|
|
||||
public productid : number; |
|
||||
public productname : string; |
|
||||
public productprice : number; |
|
||||
public productweight : number; |
|
||||
public productshortdesc : string; |
|
||||
public productlongdesc : string; |
|
||||
public productimage : string; |
|
||||
public productcategoryid : number; |
|
||||
|
|
||||
constructor() {} |
|
||||
|
constructor() {} |
||||
} |
} |
||||
@ -1,15 +1,15 @@ |
|||||
export class User { |
export class User { |
||||
public userid : number; |
|
||||
public useremail : string; |
|
||||
public userpassword : string; |
|
||||
public userfirstname : string; |
|
||||
public userlastname : string; |
|
||||
public usercity: string; |
|
||||
public userstate : string; |
|
||||
public userzip : string; |
|
||||
public userphone : string; |
|
||||
public useraddress : string; |
|
||||
public useraddress2 : string; |
|
||||
|
public userid: number; |
||||
|
public useremail: string; |
||||
|
public userpassword: string; |
||||
|
public userfirstname: string; |
||||
|
public userlastname: string; |
||||
|
public usercity: string; |
||||
|
public userstate: string; |
||||
|
public userzip: string; |
||||
|
public userphone: string; |
||||
|
public useraddress: string; |
||||
|
public useraddress2: string; |
||||
|
|
||||
constructor() {} |
|
||||
|
constructor() {} |
||||
} |
} |
||||
@ -1,82 +1,39 @@ |
|||||
// import { HttpClient } from '@angular/common/http';
|
|
||||
import { Injectable } from '@angular/core'; |
import { Injectable } from '@angular/core'; |
||||
import { Http,Response } from '@angular/http'; |
|
||||
// import { Observable } from 'rxjs';
|
|
||||
import { Login } from '../models/login'; |
import { Login } from '../models/login'; |
||||
import { User } from '../models/user'; |
import { User } from '../models/user'; |
||||
import 'rxjs/add/operator/map'; |
|
||||
import { Observable } from 'rxjs'; |
|
||||
import { HttpClient } from '@angular/common/http'; |
import { HttpClient } from '@angular/common/http'; |
||||
|
|
||||
|
import { Observable } from 'rxjs'; |
||||
|
|
||||
@Injectable({ |
@Injectable({ |
||||
providedIn: 'root' |
|
||||
|
providedIn: 'root', |
||||
}) |
}) |
||||
export class UserService { |
export class UserService { |
||||
|
currentUser: User; |
||||
|
private _url: string = 'http://localhost:8500/users/'; |
||||
|
|
||||
|
constructor(private _http: HttpClient) {} |
||||
|
|
||||
// private _url : string = "http://localhost:9000";
|
|
||||
|
|
||||
constructor(private _http : HttpClient) { } |
|
||||
|
|
||||
// public showAllUsers() : Observable<User[]> {
|
|
||||
// return this._http.get<User[]>(this._url + "/showAllUsers");
|
|
||||
// }
|
|
||||
|
|
||||
// public searchUser(id : number) : Observable<User> {
|
|
||||
// return this._http.get<User>(this._url+"/findUserById/"+id);
|
|
||||
// }
|
|
||||
|
|
||||
// public addUser(user : User) {
|
|
||||
// this._http.post(this._url+"/addUser/", user);
|
|
||||
currentUser:User |
|
||||
private _url:string ="http://localhost:8008/user/" |
|
||||
showAllUsers() { |
|
||||
return this._http.get<User[]>(this._url+"showAllUsers")} |
|
||||
// .map((res : Response) => res.json());}
|
|
||||
|
|
||||
addUser(user: User) { |
|
||||
return this._http.post(this._url+"addUser/",user)} |
|
||||
// .map((res: Response)=> null).pipe();}
|
|
||||
// loginUser (user:User):Observable<any>{
|
|
||||
// return this._http.post("http://localhost:8006/user/login/",user).map((res: Response)=>null);
|
|
||||
// }
|
|
||||
searchUser(userid : number) { |
|
||||
return this._http.get<User>(this._url+"findUserById/" +userid)} |
|
||||
// .map((res : Response) => res.json());}
|
|
||||
updateUser(user : User) { |
|
||||
return this._http.put(this._url+"update/",user)} |
|
||||
// .map((res: Response)=> null);}
|
|
||||
// findUserByUsername(name : string) : Observable<User> {
|
|
||||
// return this._http.get("http://localhost:8006/user/findUserByName/"+name).map((res : Response) => res.json());
|
|
||||
// }
|
|
||||
|
|
||||
public loginUser(user : Login) { |
|
||||
return this._http.post<string>(this._url+"login/",user)} |
|
||||
// .map((res: Response)=>null);}
|
|
||||
|
|
||||
public findUserByUsername(name : string) { |
|
||||
return this._http.get<User>(this._url+"findUserByName/"+name)} |
|
||||
//.map((res : Response) => res.json());}
|
|
||||
|
|
||||
|
|
||||
// private _url : String = "http://localhost:8001/user";
|
|
||||
// currentUser : User;
|
|
||||
|
|
||||
// constructor(private _http : HttpClient) { }
|
|
||||
|
public showAllUsers(): Observable<User[]> { |
||||
|
return this._http.get<User[]>(this._url + 'showAllUsers'); |
||||
|
} |
||||
|
|
||||
// public showAllUsers() : Observable<User[]> {
|
|
||||
// return this._http.get<User[]>(this._url + "/showAllUsers");
|
|
||||
// }
|
|
||||
|
public addUser(user: User) { |
||||
|
return this._http.post(this._url + 'addUser/', user); |
||||
|
} |
||||
|
|
||||
// public searchUser(id : number) : Observable<User> {
|
|
||||
// return this._http.get<User>(this._url+"/findUserById/"+id);
|
|
||||
// }
|
|
||||
|
public searchUser(userid: number) { |
||||
|
return this._http.get<User>(this._url + 'findUserById/' + userid); |
||||
|
} |
||||
|
|
||||
// public addUser(user : User) {
|
|
||||
// this._http.post(this._url+"/addUser", user);
|
|
||||
// }
|
|
||||
|
public updateUser(user: User) { |
||||
|
return this._http.put(this._url + 'update/', user); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public loginUser(user: Login) { |
||||
|
return this._http.post<string>(this._url + 'login/', user); |
||||
|
} |
||||
|
|
||||
|
public findUserByUsername(name: string) { |
||||
|
return this._http.get<User>(this._url + 'findUserByName/' + name); |
||||
|
} |
||||
} |
} |
||||
@ -1,9 +1,10 @@ |
|||||
server.port=8008 |
|
||||
spring.datasource.url=jdbc:mysql://10.3.117.21:3306/grocery_db?createDatabaseIfNotExist=true |
|
||||
|
server.port=8500 |
||||
|
|
||||
|
spring.datasource.url=jdbc:mysql://10.3.117.22:3306/grocery_db?createDatabaseIfNotExist=true |
||||
spring.datasource.username=testuser |
spring.datasource.username=testuser |
||||
spring.datasource.password=Password123 |
spring.datasource.password=Password123 |
||||
|
|
||||
server.servlet.context-path=/user |
|
||||
|
server.servlet.context-path=/users |
||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect |
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect |
||||
|
|
||||
spring.jpa.hibernate.ddl-auto=update |
spring.jpa.hibernate.ddl-auto=update |
||||
|
|||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue