Skip to main content

FacetValueService

FacetValueService

Contains methods relating to FacetValue entities.

Signature
class FacetValueService {
constructor(connection: TransactionalConnection, translatableSaver: TranslatableSaver, configService: ConfigService, customFieldRelationService: CustomFieldRelationService, channelService: ChannelService, eventBus: EventBus, translator: TranslatorService, listQueryBuilder: ListQueryBuilder)
findAll(lang: LanguageCode) => Promise<Array<Translated<FacetValue>>>;
findAll(ctx: RequestContext, lang: LanguageCode) => Promise<Array<Translated<FacetValue>>>;
findAll(ctxOrLang: RequestContext | LanguageCode, lang?: LanguageCode) => Promise<Array<Translated<FacetValue>>>;
findAllList(ctx: RequestContext, options?: ListQueryOptions<FacetValue>, relations?: RelationPaths<FacetValue>) => Promise<PaginatedList<Translated<FacetValue>>>;
findOne(ctx: RequestContext, id: ID) => Promise<Translated<FacetValue> | undefined>;
findByIds(ctx: RequestContext, ids: ID[]) => Promise<Array<Translated<FacetValue>>>;
findByFacetId(ctx: RequestContext, id: ID) => Promise<Array<Translated<FacetValue>>>;
findByFacetIdList(ctx: RequestContext, id: ID, options?: ListQueryOptions<FacetValue>, relations?: RelationPaths<FacetValue>) => Promise<PaginatedList<Translated<FacetValue>>>;
create(ctx: RequestContext, facet: Facet, input: CreateFacetValueInput | CreateFacetValueWithFacetInput) => Promise<Translated<FacetValue>>;
update(ctx: RequestContext, input: UpdateFacetValueInput) => Promise<Translated<FacetValue>>;
delete(ctx: RequestContext, id: ID, force: boolean = false) => Promise<DeletionResponse>;
checkFacetValueUsage(ctx: RequestContext, facetValueIds: ID[], channelId?: ID) => Promise<{ productCount: number; variantCount: number }>;
}

constructor

method
(connection: TransactionalConnection, translatableSaver: TranslatableSaver, configService: ConfigService, customFieldRelationService: CustomFieldRelationService, channelService: ChannelService, eventBus: EventBus, translator: TranslatorService, listQueryBuilder: ListQueryBuilder) => FacetValueService

findAll

method
(lang: LanguageCode) => Promise<Array<Translated<FacetValue>>>

findAll

method
(ctx: RequestContext, lang: LanguageCode) => Promise<Array<Translated<FacetValue>>>

findAll

method
(ctxOrLang: RequestContext | LanguageCode, lang?: LanguageCode) => Promise<Array<Translated<FacetValue>>>

findAllList

method
(ctx: RequestContext, options?: ListQueryOptions<FacetValue>, relations?: RelationPaths<FacetValue>) => Promise<PaginatedList<Translated<FacetValue>>>

Returns a PaginatedList of FacetValues.

TODO: in v2 this should replace the findAll() method. A separate method was created just to avoid a breaking change in v1.9.

findOne

method
(ctx: RequestContext, id: ID) => Promise<Translated<FacetValue> | undefined>

findByIds

method
(ctx: RequestContext, ids: ID[]) => Promise<Array<Translated<FacetValue>>>

findByFacetId

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

Returns all FacetValues belonging to the Facet with the given id.

findByFacetIdList

method
(ctx: RequestContext, id: ID, options?: ListQueryOptions<FacetValue>, relations?: RelationPaths<FacetValue>) => Promise<PaginatedList<Translated<FacetValue>>>

Returns all FacetValues belonging to the Facet with the given id.

create

method
(ctx: RequestContext, facet: Facet, input: CreateFacetValueInput | CreateFacetValueWithFacetInput) => Promise<Translated<FacetValue>>

update

method
(ctx: RequestContext, input: UpdateFacetValueInput) => Promise<Translated<FacetValue>>

delete

method
(ctx: RequestContext, id: ID, force: boolean = false) => Promise<DeletionResponse>

checkFacetValueUsage

method
(ctx: RequestContext, facetValueIds: ID[], channelId?: ID) => Promise<{ productCount: number; variantCount: number }>

Checks for usage of the given FacetValues in any Products or Variants, and returns the counts.