Skip to main content

ProductOptionGroupService

ProductOptionGroupService

Contains methods relating to ProductOptionGroup entities.

Signature
class ProductOptionGroupService {
constructor(connection: TransactionalConnection, translatableSaver: TranslatableSaver, customFieldRelationService: CustomFieldRelationService, productOptionService: ProductOptionService, eventBus: EventBus, translator: TranslatorService)
findAll(ctx: RequestContext, filterTerm?: string, relations?: RelationPaths<ProductOptionGroup>) => Promise<Array<Translated<ProductOptionGroup>>>;
findOne(ctx: RequestContext, id: ID, relations?: RelationPaths<ProductOptionGroup>) => Promise<Translated<ProductOptionGroup> | undefined>;
getOptionGroupsByProductId(ctx: RequestContext, id: ID) => Promise<Array<Translated<ProductOptionGroup>>>;
create(ctx: RequestContext, input: Omit<CreateProductOptionGroupInput, 'options'>) => Promise<Translated<ProductOptionGroup>>;
update(ctx: RequestContext, input: UpdateProductOptionGroupInput) => Promise<Translated<ProductOptionGroup>>;
deleteGroupAndOptionsFromProduct(ctx: RequestContext, id: ID, productId: ID) => ;
}

constructor

method
(connection: TransactionalConnection, translatableSaver: TranslatableSaver, customFieldRelationService: CustomFieldRelationService, productOptionService: ProductOptionService, eventBus: EventBus, translator: TranslatorService) => ProductOptionGroupService

findAll

method
(ctx: RequestContext, filterTerm?: string, relations?: RelationPaths<ProductOptionGroup>) => Promise<Array<Translated<ProductOptionGroup>>>

findOne

method
(ctx: RequestContext, id: ID, relations?: RelationPaths<ProductOptionGroup>) => Promise<Translated<ProductOptionGroup> | undefined>

getOptionGroupsByProductId

method
(ctx: RequestContext, id: ID) => Promise<Array<Translated<ProductOptionGroup>>>

create

method
(ctx: RequestContext, input: Omit<CreateProductOptionGroupInput, 'options'>) => Promise<Translated<ProductOptionGroup>>

update

method
(ctx: RequestContext, input: UpdateProductOptionGroupInput) => Promise<Translated<ProductOptionGroup>>

deleteGroupAndOptionsFromProduct

method
(ctx: RequestContext, id: ID, productId: ID) =>

Deletes the ProductOptionGroup and any associated ProductOptions. If the ProductOptionGroup is still referenced by a soft-deleted Product, then a soft-delete will be used to preserve referential integrity. Otherwise a hard-delete will be performed.