Skip to main content

Class: ProductRepository

backend.ProductRepository

Hierarchy#

Table of contents#

Constructors#

Properties#

Methods#

Constructors#

constructor#

• new ProductRepository()

Overrides#

BaseRepository.constructor

Defined in#

system/core/backend/src/repositories/product.repository.ts:54

Properties#

dbType#

• dbType: "mysql" | "mariadb" | "postgres" | "cockroachdb" | "sqlite" | "mssql" | "sap" | "oracle" | "cordova" | "nativescript" | "react-native" | "sqljs" | "mongodb" | "aurora-data-api" | "aurora-data-api-pg" | "expo" | "better-sqlite3" | "capacitor"

Inherited from#

BaseRepository.dbType

Defined in#

system/core/backend/src/repositories/base.repository.ts:24

Methods#

applyAndGetPagedProducts#

â–¸ applyAndGetPagedProducts(qb, params?): Promise<TPagedList<TProduct>>

Parameters#

NameType
qbSelectQueryBuilder<TProduct>
params?TPagedParams<TProduct>

Returns#

Promise<TPagedList<TProduct>>

Defined in#

system/core/backend/src/repositories/product.repository.ts:69


applyBaseFilter#

â–¸ applyBaseFilter<EntityType>(qb, filter?): SelectQueryBuilder<EntityType>

Type parameters#

NameType
EntityTypeTBasePageEntity

Parameters#

NameType
qbSelectQueryBuilder<EntityType>
filter?BaseFilterInput

Returns#

SelectQueryBuilder<EntityType>

Inherited from#

BaseRepository.applyBaseFilter

Defined in#

system/core/backend/src/repositories/base.repository.ts:155


applyDeleteMany#

â–¸ applyDeleteMany(qb, input): Promise<void>

Parameters#

NameType
qbSelectQueryBuilder<Product> | DeleteQueryBuilder<Product>
inputTDeleteManyInput

Returns#

Promise<void>

Inherited from#

BaseRepository.applyDeleteMany

Defined in#

system/core/backend/src/repositories/base.repository.ts:108


applyGetEntityViews#

â–¸ applyGetEntityViews(qb, entityType): SelectQueryBuilder<TBasePageEntity>

Parameters#

NameType
qbSelectQueryBuilder<TBasePageEntity>
entityTypeEDBEntity

Returns#

SelectQueryBuilder<TBasePageEntity>

Inherited from#

BaseRepository.applyGetEntityViews

Defined in#

system/core/backend/src/repositories/base.repository.ts:133


applyGetProductRating#

â–¸ applyGetProductRating(qb): void

Parameters#

NameType
qbSelectQueryBuilder<TProduct>

Returns#

void

Defined in#

system/core/backend/src/repositories/product.repository.ts:58


applyProductFilter#

â–¸ applyProductFilter(qb, filterParams?): void

Parameters#

NameType
qbSelectQueryBuilder<Product>
filterParams?ProductFilterInput

Returns#

void

Defined in#

system/core/backend/src/repositories/product.repository.ts:302


attributeRecordsToProductAttributeInstances#

â–¸ attributeRecordsToProductAttributeInstances(records?): undefined | AttributeInstance[]

Parameters#

NameType
records?null | AttributeToProduct[]

Returns#

undefined | AttributeInstance[]

Defined in#

system/core/backend/src/repositories/product.repository.ts:438


createEntity#

â–¸ createEntity(input, id?): Promise<Product>

Parameters#

NameType
inputProduct
id?null | number

Returns#

Promise<Product>

Inherited from#

BaseRepository.createEntity

Defined in#

system/core/backend/src/repositories/base.repository.ts:70


createProduct#

â–¸ createProduct(createProduct, id?): Promise<Product>

Parameters#

NameType
createProductTProductInput
id?null | number

Returns#

Promise<Product>

Defined in#

system/core/backend/src/repositories/product.repository.ts:235


deleteEntity#

â–¸ deleteEntity(id): Promise<boolean>

Parameters#

NameType
idnumber

Returns#

Promise<boolean>

Inherited from#

BaseRepository.deleteEntity

Defined in#

system/core/backend/src/repositories/base.repository.ts:97


deleteMany#

â–¸ deleteMany(input): Promise<boolean>

Parameters#

NameType
inputTDeleteManyInput

Returns#

Promise<boolean>

Inherited from#

BaseRepository.deleteMany

Defined in#

system/core/backend/src/repositories/base.repository.ts:125


deleteManyFilteredProducts#

â–¸ deleteManyFilteredProducts(input, filterParams?): Promise<undefined | boolean>

Parameters#

NameType
inputTDeleteManyInput
filterParams?ProductFilterInput

Returns#

Promise<undefined | boolean>

Defined in#

system/core/backend/src/repositories/product.repository.ts:425


deleteProduct#

â–¸ deleteProduct(id): Promise<boolean>

Parameters#

NameType
idnumber

Returns#

Promise<boolean>

Defined in#

system/core/backend/src/repositories/product.repository.ts:258


getAll#

â–¸ getAll(): Promise<Product[]>

Returns#

Promise<Product[]>

Inherited from#

BaseRepository.getAll

Defined in#

system/core/backend/src/repositories/base.repository.ts:44


getById#

â–¸ getById(id, relations?): Promise<Product>

Parameters#

NameType
idnumber
relations?string[]

Returns#

Promise<Product>

Inherited from#

BaseRepository.getById

Defined in#

system/core/backend/src/repositories/base.repository.ts:49


getBySlug#

â–¸ getBySlug(slug, relations?): Promise<Product>

Parameters#

NameType
slugstring
relations?string[]

Returns#

Promise<Product>

Inherited from#

BaseRepository.getBySlug

Defined in#

system/core/backend/src/repositories/base.repository.ts:60


getEntityViews#

â–¸ getEntityViews(entityId, entityType): Promise<any>

Parameters#

NameType
entityIdnumber
entityTypeEDBEntity

Returns#

Promise<any>

Inherited from#

BaseRepository.getEntityViews

Defined in#

system/core/backend/src/repositories/base.repository.ts:144


getFilteredEntities#

â–¸ getFilteredEntities(pagedParams?, filterParams?): Promise<TPagedList<Product>>

Parameters#

NameType
pagedParams?PagedParamsInput<Product>
filterParams?BaseFilterInput

Returns#

Promise<TPagedList<Product>>

Inherited from#

BaseRepository.getFilteredEntities

Defined in#

system/core/backend/src/repositories/base.repository.ts:164


getFilteredProducts#

â–¸ getFilteredProducts(pagedParams?, filterParams?): Promise<TFilteredProductList>

Parameters#

NameType
pagedParams?PagedParamsInput<TProduct>
filterParams?ProductFilterInput

Returns#

Promise<TFilteredProductList>

Defined in#

system/core/backend/src/repositories/product.repository.ts:372


getPaged#

â–¸ getPaged(params?): Promise<TPagedList<Product>>

Parameters#

NameType
params?TPagedParams<Product>

Returns#

Promise<TPagedList<Product>>

Inherited from#

BaseRepository.getPaged

Defined in#

system/core/backend/src/repositories/base.repository.ts:38


getProductAttributes#

â–¸ getProductAttributes(productId): Promise<undefined | AttributeInstance[]>

Parameters#

NameType
productIdnumber

Returns#

Promise<undefined | AttributeInstance[]>

Defined in#

system/core/backend/src/repositories/product.repository.ts:456


getProductById#

â–¸ getProductById(id, options?): Promise<undefined | Product>

Parameters#

NameType
idnumber
options?TGetProductOptions

Returns#

Promise<undefined | Product>

Defined in#

system/core/backend/src/repositories/product.repository.ts:90


getProductBySlug#

â–¸ getProductBySlug(slug, options?): Promise<undefined | Product>

Parameters#

NameType
slugstring
options?TGetProductOptions

Returns#

Promise<undefined | Product>

Defined in#

system/core/backend/src/repositories/product.repository.ts:105


getProductRating#

â–¸ getProductRating(productId): Promise<TProductRating>

Parameters#

NameType
productIdnumber

Returns#

Promise<TProductRating>

Defined in#

system/core/backend/src/repositories/product.repository.ts:286


getProductVariantsOfProduct#

â–¸ getProductVariantsOfProduct(productId): Promise<undefined | null | ProductVariant[]>

Parameters#

NameType
productIdnumber

Returns#

Promise<undefined | null | ProductVariant[]>

Defined in#

system/core/backend/src/repositories/product.repository.ts:462


getProducts#

â–¸ getProducts(params?): Promise<TPagedList<TProduct>>

Parameters#

NameType
params?TPagedParams<TProduct>

Returns#

Promise<TPagedList<TProduct>>

Defined in#

system/core/backend/src/repositories/product.repository.ts:84


getProductsFromCategory#

â–¸ getProductsFromCategory(categoryId, params?): Promise<TPagedList<TProduct>>

Parameters#

NameType
categoryIdnumber
params?TPagedParams<TProduct>

Returns#

Promise<TPagedList<TProduct>>

Defined in#

system/core/backend/src/repositories/product.repository.ts:269


getReviewsOfProduct#

â–¸ getReviewsOfProduct(productId, params?): Promise<TPagedList<TProductReview>>

Parameters#

NameType
productIdnumber
params?TPagedParams<TProductReview>

Returns#

Promise<TPagedList<TProductReview>>

Defined in#

system/core/backend/src/repositories/product.repository.ts:277


getSqlBoolStr#

â–¸ getSqlBoolStr(b): "true" | "false" | "1" | "0"

Parameters#

NameType
bboolean

Returns#

"true" | "false" | "1" | "0"

Inherited from#

BaseRepository.getSqlBoolStr

Defined in#

system/core/backend/src/repositories/base.repository.ts:34


getSqlLike#

â–¸ getSqlLike(): "ILIKE" | "LIKE"

Returns#

"ILIKE" | "LIKE"

Inherited from#

BaseRepository.getSqlLike

Defined in#

system/core/backend/src/repositories/base.repository.ts:35


handleProductInput#

â–¸ handleProductInput(product, input, action): Promise<void>

Parameters#

NameType
productProduct
inputTProductInput
action"update" | "create"

Returns#

Promise<void>

Defined in#

system/core/backend/src/repositories/product.repository.ts:133


quote#

â–¸ quote(str): string

Parameters#

NameType
strstring

Returns#

string

Inherited from#

BaseRepository.quote

Defined in#

system/core/backend/src/repositories/base.repository.ts:36


updateEntity#

â–¸ updateEntity(id, input): Promise<Product>

Parameters#

NameType
idnumber
inputProduct

Returns#

Promise<Product>

Inherited from#

BaseRepository.updateEntity

Defined in#

system/core/backend/src/repositories/base.repository.ts:82


updateProduct#

â–¸ updateProduct(id, updateProduct): Promise<Product>

Parameters#

NameType
idnumber
updateProductTProductInput

Returns#

Promise<Product>

Defined in#

system/core/backend/src/repositories/product.repository.ts:245