🚨 Announcing Vendure v2 Beta

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>>>;
  async create(ctx: RequestContext, facet: Facet, input: CreateFacetValueInput | CreateFacetValueWithFacetInput) => Promise<Translated<FacetValue>>;
  async update(ctx: RequestContext, input: UpdateFacetValueInput) => Promise<Translated<FacetValue>>;
  async delete(ctx: RequestContext, id: ID, force: boolean = false) => Promise<DeletionResponse>;
  async checkFacetValueUsage(ctx: RequestContext, facetValueIds: ID[], channelId?: ID) => Promise<{ productCount: number; variantCount: number }>;
}

Members

constructor

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

findAll

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

findAll

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

findAll

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

findAllList

method
type:
(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
type:
(ctx: RequestContext, id: ID) => Promise<Translated<FacetValue> | undefined>

findByIds

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

findByFacetId

method
type:
(ctx: RequestContext, id: ID) => Promise<Array<Translated<FacetValue>>>
Returns all FacetValues belonging to the Facet with the given id.

create

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

update

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

delete

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

checkFacetValueUsage

async method
type:
(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.