Skip to content

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 ​

ParameterType
manager?EntityManager

Returns ​

ProductCategoryService

Inherited from ​

WithManager.constructor

Properties ​

PropertyModifierTypeInherited from
managerprotectedEntityManagerWithManager.manager

Methods ​

asProductCategoryResponse() ​

ts
static asProductCategoryResponse(productCategory): ProductCategoryResponse;

Creates a productCategoryResponse from a productCategory

Parameters ​

ParameterTypeDescription
productCategoryProductCategoryproductCategory

Returns ​

ProductCategoryResponse

  • a productCategoryResponse created with the productCategory

deleteProductCategory() ​

ts
static deleteProductCategory(id): Promise<ProductCategory>;

Deletes a ProductCategory from the database.

Parameters ​

ParameterTypeDescription
idnumberThe 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 ​

ParameterType
filtersProductCategoryFilterParameters
paginationPaginationParameters

Returns ​

Promise<[ProductCategory[], number]>


patchProductCategory() ​

ts
static patchProductCategory(id, request): Promise<ProductCategory>;

Updates a ProductCategory in the database.

Parameters ​

ParameterTypeDescription
idnumberThe id of the productCategory that needs to be updated.
requestProductCategoryRequestThe ProductCategoryRequest with updated values.

Returns ​

Promise<ProductCategory>


postProductCategory() ​

ts
static postProductCategory(request): Promise<ProductCategory>;

Saves a ProductCategory to the database.

Parameters ​

ParameterTypeDescription
requestProductCategoryRequestThe ProductCategoryRequest with values.

Returns ​

Promise<ProductCategory>


verifyProductCategory() ​

ts
static verifyProductCategory(request): Promise<boolean>;

Verifies whether the productCategory request translates to a valid productCategory

Parameters ​

ParameterTypeDescription
requestProductCategoryRequestthe productCategory request to verify

Returns ​

Promise<boolean>

  • whether productCategory is ok or not