15 changed files with 2369 additions and 48 deletions
@ -0,0 +1,17 @@ |
|||
# Proxy Generation Output |
|||
|
|||
This directory includes the output of the latest proxy generation. |
|||
The files and folders in it will be overwritten when proxy generation is run again. |
|||
Therefore, please do not place your own content in this folder. |
|||
|
|||
In addition, `generate-proxy.json` works like a lock file. |
|||
It includes information used by the proxy generator, so please do not delete or modify it. |
|||
|
|||
Finally, the name of the files and folders should not be changed for two reasons: |
|||
- Proxy generator will keep creating them at those paths and you will have multiple copies of the same content. |
|||
- ABP Suite generates files which include imports from this folder. |
|||
|
|||
> **Important Notice:** If you are building a module and are planning to publish to npm, |
|||
> some of the generated proxies are likely to be exported from public-api.ts file. In such a case, |
|||
> please make sure you export files directly and not from barrel exports. In other words, |
|||
> do not include index.ts exports in your public-api.ts exports. |
|||
File diff suppressed because it is too large
@ -0,0 +1,2 @@ |
|||
import * as Products from './products'; |
|||
export { Products }; |
|||
@ -0,0 +1,3 @@ |
|||
export * from './models'; |
|||
export * from './product.service'; |
|||
export * from './public-product.service'; |
|||
@ -0,0 +1,24 @@ |
|||
import type { AuditedEntityDto } from '@abp/ng.core'; |
|||
|
|||
export interface CreateProductDto { |
|||
code: string; |
|||
name: string; |
|||
imageName?: string; |
|||
price: number; |
|||
stockCount: number; |
|||
} |
|||
|
|||
export interface ProductDto extends AuditedEntityDto<string> { |
|||
code?: string; |
|||
name?: string; |
|||
imageName?: string; |
|||
price: number; |
|||
stockCount: number; |
|||
} |
|||
|
|||
export interface UpdateProductDto { |
|||
name: string; |
|||
imageName?: string; |
|||
price: number; |
|||
stockCount: number; |
|||
} |
|||
@ -0,0 +1,58 @@ |
|||
import type { CreateProductDto, ProductDto, UpdateProductDto } from './models'; |
|||
import { RestService } from '@abp/ng.core'; |
|||
import type { ListResultDto, PagedAndSortedResultRequestDto, PagedResultDto } from '@abp/ng.core'; |
|||
import { Injectable } from '@angular/core'; |
|||
|
|||
@Injectable({ |
|||
providedIn: 'root', |
|||
}) |
|||
export class ProductService { |
|||
apiName = 'Catalog'; |
|||
|
|||
create = (input: CreateProductDto) => |
|||
this.restService.request<any, ProductDto>({ |
|||
method: 'POST', |
|||
url: '/api/catalog/product', |
|||
body: input, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
delete = (id: string) => |
|||
this.restService.request<any, void>({ |
|||
method: 'DELETE', |
|||
url: `/api/catalog/product/${id}`, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
get = (id: string) => |
|||
this.restService.request<any, ProductDto>({ |
|||
method: 'GET', |
|||
url: `/api/catalog/product/${id}`, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
getList = () => |
|||
this.restService.request<any, ListResultDto<ProductDto>>({ |
|||
method: 'GET', |
|||
url: '/api/catalog/product', |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
getListPaged = (input: PagedAndSortedResultRequestDto) => |
|||
this.restService.request<any, PagedResultDto<ProductDto>>({ |
|||
method: 'GET', |
|||
url: '/api/catalog/product/paged', |
|||
params: { sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount }, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
update = (id: string, input: UpdateProductDto) => |
|||
this.restService.request<any, ProductDto>({ |
|||
method: 'PUT', |
|||
url: `/api/catalog/product/${id}`, |
|||
body: input, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
constructor(private restService: RestService) {} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
import type { ProductDto } from './models'; |
|||
import { RestService } from '@abp/ng.core'; |
|||
import type { ListResultDto } from '@abp/ng.core'; |
|||
import { Injectable } from '@angular/core'; |
|||
|
|||
@Injectable({ |
|||
providedIn: 'root', |
|||
}) |
|||
export class PublicProductService { |
|||
apiName = 'Catalog'; |
|||
|
|||
get = (id: string) => |
|||
this.restService.request<any, ProductDto>({ |
|||
method: 'GET', |
|||
url: `/api/catalog/public-product/${id}`, |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
getList = () => |
|||
this.restService.request<any, ListResultDto<ProductDto>>({ |
|||
method: 'GET', |
|||
url: '/api/catalog/public-product', |
|||
}, |
|||
{ apiName: this.apiName }); |
|||
|
|||
constructor(private restService: RestService) {} |
|||
} |
|||
@ -1 +1,5 @@ |
|||
<p>product works!</p> |
|||
<ul *ngIf="list$ | async; let list"> |
|||
<li *ngFor="let item of list"> |
|||
{{ item | json }} |
|||
</li> |
|||
</ul> |
|||
|
|||
@ -1,25 +0,0 @@ |
|||
import { ComponentFixture, TestBed } from '@angular/core/testing'; |
|||
|
|||
import { ProductComponent } from './product.component'; |
|||
|
|||
describe('ProductComponent', () => { |
|||
let component: ProductComponent; |
|||
let fixture: ComponentFixture<ProductComponent>; |
|||
|
|||
beforeEach(async () => { |
|||
await TestBed.configureTestingModule({ |
|||
declarations: [ ProductComponent ] |
|||
}) |
|||
.compileComponents(); |
|||
}); |
|||
|
|||
beforeEach(() => { |
|||
fixture = TestBed.createComponent(ProductComponent); |
|||
component = fixture.componentInstance; |
|||
fixture.detectChanges(); |
|||
}); |
|||
|
|||
it('should create', () => { |
|||
expect(component).toBeTruthy(); |
|||
}); |
|||
}); |
|||
@ -1,15 +1,14 @@ |
|||
import { Component, OnInit } from '@angular/core'; |
|||
|
|||
import { ProductService } from '@catalog/proxy/products'; |
|||
import { map } from 'rxjs/operators'; |
|||
@Component({ |
|||
selector: 'lib-product', |
|||
templateUrl: './product.component.html', |
|||
styleUrls: ['./product.component.css'] |
|||
styleUrls: ['./product.component.css'], |
|||
}) |
|||
export class ProductComponent implements OnInit { |
|||
list$ = this.productService.getList().pipe(map(res => res.items)); |
|||
constructor(public readonly productService: ProductService) {} |
|||
|
|||
constructor() { } |
|||
|
|||
ngOnInit(): void { |
|||
} |
|||
|
|||
ngOnInit(): void {} |
|||
} |
|||
|
|||
@ -1,5 +0,0 @@ |
|||
/* |
|||
* Public API Surface of catalog |
|||
*/ |
|||
export * from './catalog.module'; |
|||
export * from './pages'; |
|||
Loading…
Reference in new issue