🚨 Announcing Vendure v2 Beta

CustomerGroupService

CustomerGroupService

Contains methods relating to CustomerGroup entities.

Signature

class CustomerGroupService {
  constructor(connection: TransactionalConnection, listQueryBuilder: ListQueryBuilder, historyService: HistoryService, eventBus: EventBus, customFieldRelationService: CustomFieldRelationService)
  findAll(ctx: RequestContext, options?: CustomerGroupListOptions, relations: RelationPaths<CustomerGroup> = []) => Promise<PaginatedList<CustomerGroup>>;
  findOne(ctx: RequestContext, customerGroupId: ID, relations: RelationPaths<CustomerGroup> = []) => Promise<CustomerGroup | undefined>;
  getGroupCustomers(ctx: RequestContext, customerGroupId: ID, options?: CustomerListOptions) => Promise<PaginatedList<Customer>>;
  async create(ctx: RequestContext, input: CreateCustomerGroupInput) => Promise<CustomerGroup>;
  async update(ctx: RequestContext, input: UpdateCustomerGroupInput) => Promise<CustomerGroup>;
  async delete(ctx: RequestContext, id: ID) => Promise<DeletionResponse>;
  async addCustomersToGroup(ctx: RequestContext, input: MutationAddCustomersToGroupArgs) => Promise<CustomerGroup>;
  async removeCustomersFromGroup(ctx: RequestContext, input: MutationRemoveCustomersFromGroupArgs) => Promise<CustomerGroup>;
}

Members

constructor

method
type:
(connection: TransactionalConnection, listQueryBuilder: ListQueryBuilder, historyService: HistoryService, eventBus: EventBus, customFieldRelationService: CustomFieldRelationService) => CustomerGroupService

findAll

method
type:
(ctx: RequestContext, options?: CustomerGroupListOptions, relations: RelationPaths<CustomerGroup> = []) => Promise<PaginatedList<CustomerGroup>>

findOne

method
type:
(ctx: RequestContext, customerGroupId: ID, relations: RelationPaths<CustomerGroup> = []) => Promise<CustomerGroup | undefined>

getGroupCustomers

method
type:
(ctx: RequestContext, customerGroupId: ID, options?: CustomerListOptions) => Promise<PaginatedList<Customer>>
Returns a PaginatedList of all the Customers in the group.

create

async method
type:
(ctx: RequestContext, input: CreateCustomerGroupInput) => Promise<CustomerGroup>

update

async method
type:
(ctx: RequestContext, input: UpdateCustomerGroupInput) => Promise<CustomerGroup>

delete

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

addCustomersToGroup

async method
type:
(ctx: RequestContext, input: MutationAddCustomersToGroupArgs) => Promise<CustomerGroup>

removeCustomersFromGroup

async method
type:
(ctx: RequestContext, input: MutationRemoveCustomersFromGroupArgs) => Promise<CustomerGroup>