FacetValueService

FacetValueService

Contains methods relating to FacetValue entities.

Signature

class FacetValueService {
  constructor(connection: TransactionalConnection, translatableSaver: TranslatableSaver, configService: ConfigService, customFieldRelationService: CustomFieldRelationService, channelService: ChannelService)
  findAll(lang: LanguageCode) => Promise<Array<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[]) => Promise<{ productCount: number; variantCount: number }>;
}

Members

constructor

method
type:
(connection: TransactionalConnection, translatableSaver: TranslatableSaver, configService: ConfigService, customFieldRelationService: CustomFieldRelationService, channelService: ChannelService) => FacetValueService

findAll

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

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[]) => Promise<{ productCount: number; variantCount: number }>
Checks for usage of the given FacetValues in any Products or Variants, and returns the counts.