CountryService

CountryService

Contains methods relating to Country entities.

Signature

class CountryService {
  constructor(connection: TransactionalConnection, listQueryBuilder: ListQueryBuilder, translatableSaver: TranslatableSaver, zoneService: ZoneService)
  findAll(ctx: RequestContext, options?: ListQueryOptions<Country>) => Promise<PaginatedList<Translated<Country>>>;
  findOne(ctx: RequestContext, countryId: ID) => Promise<Translated<Country> | undefined>;
  findAllAvailable(ctx: RequestContext) => Promise<Array<Translated<Country>>>;
  async findOneByCode(ctx: RequestContext, countryCode: string) => Promise<Translated<Country>>;
  async create(ctx: RequestContext, input: CreateCountryInput) => Promise<Translated<Country>>;
  async update(ctx: RequestContext, input: UpdateCountryInput) => Promise<Translated<Country>>;
  async delete(ctx: RequestContext, id: ID) => Promise<DeletionResponse>;
}

Members

constructor

method
type:
(connection: TransactionalConnection, listQueryBuilder: ListQueryBuilder, translatableSaver: TranslatableSaver, zoneService: ZoneService) => CountryService

findAll

method
type:
(ctx: RequestContext, options?: ListQueryOptions<Country>) => Promise<PaginatedList<Translated<Country>>>

findOne

method
type:
(ctx: RequestContext, countryId: ID) => Promise<Translated<Country> | undefined>

findAllAvailable

method
type:
(ctx: RequestContext) => Promise<Array<Translated<Country>>>
Returns an array of enabled Countries, intended for use in a public-facing (ie. Shop) API.

findOneByCode

async method
type:
(ctx: RequestContext, countryCode: string) => Promise<Translated<Country>>
Returns a Country based on its ISO country code.

create

async method
type:
(ctx: RequestContext, input: CreateCountryInput) => Promise<Translated<Country>>

update

async method
type:
(ctx: RequestContext, input: UpdateCountryInput) => Promise<Translated<Country>>

delete

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