SudoSOS Back-end API / catalogue/product-categories / ProductCategoryService
Class: ProductCategoryService ​
Wrapper for all Product related logic.
Extends ​
Constructors ​
Constructor ​
ts
new ProductCategoryService(manager?): ProductCategoryService;Parameters ​
| Parameter | Type |
|---|---|
manager? | EntityManager |
Returns ​
ProductCategoryService
Inherited from ​
Properties ​
| Property | Modifier | Type | Inherited from |
|---|---|---|---|
manager | protected | EntityManager | WithManager.manager |
Methods ​
asProductCategoryResponse() ​
ts
static asProductCategoryResponse(productCategory): ProductCategoryResponse;Creates a productCategoryResponse from a productCategory
Parameters ​
| Parameter | Type | Description |
|---|---|---|
productCategory | ProductCategory | productCategory |
Returns ​
- a productCategoryResponse created with the productCategory
deleteProductCategory() ​
ts
static deleteProductCategory(id): Promise<ProductCategory>;Deletes a ProductCategory from the database.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
id | number | The id of the productCategory that needs to be deleted. |
Returns ​
Promise<ProductCategory>
getProductCategories() ​
ts
static getProductCategories(filters?, pagination?): Promise<[ProductCategory[], number]>;Query for getting the productCategories.
Parameters ​
| Parameter | Type |
|---|---|
filters | ProductCategoryFilterParameters |
pagination | PaginationParameters |
Returns ​
Promise<[ProductCategory[], number]>
patchProductCategory() ​
ts
static patchProductCategory(id, request): Promise<ProductCategory>;Updates a ProductCategory in the database.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
id | number | The id of the productCategory that needs to be updated. |
request | ProductCategoryRequest | The ProductCategoryRequest with updated values. |
Returns ​
Promise<ProductCategory>
postProductCategory() ​
ts
static postProductCategory(request): Promise<ProductCategory>;Saves a ProductCategory to the database.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
request | ProductCategoryRequest | The ProductCategoryRequest with values. |
Returns ​
Promise<ProductCategory>
verifyProductCategory() ​
ts
static verifyProductCategory(request): Promise<boolean>;Verifies whether the productCategory request translates to a valid productCategory
Parameters ​
| Parameter | Type | Description |
|---|---|---|
request | ProductCategoryRequest | the productCategory request to verify |
Returns ​
Promise<boolean>
- whether productCategory is ok or not