Files
dashlibstorage/API.company.md
2026-09-24 23:26:25 +02:00

4.2 KiB

company

This document is auto-generated from the JSDoc comments in src/store by running npm run api-doc.

company.create

Source: src/store/company/create.js

Creates a new company together with its root category, POS customer group, default language and tax rates, and links it to the given Google auth user.

Parameters

Name Type Description
input object The company creation input.
input.iso639 string The ISO 639 language code for the company.
input.name string The company name (must be unique).
input.taxrate number The standard tax rate in percent.
input.reducedtaxrate number The reduced tax rate in percent.
input.googleAuthId number The id of the Google auth user to link.
[tx] object Optional transaction to run within.

Returns

Promise<{id: number, rootCategoryId: number, languageId: number, taxrateId: number, reducedtaxrateId: number, taxfreerateId: number, posCustomerGroupId: number}> — The created company ids.

Throws

Error — If the company name is already taken.

Example

const company = await store.company.create({
  iso639: 'de',
  name: 'Acme',
  taxrate: 19,
  reducedtaxrate: 7,
  googleAuthId: 42,
});
// => { id, rootCategoryId, languageId, taxrateId, reducedtaxrateId, taxfreerateId, posCustomerGroupId }

company.delete

Source: src/store/company/delete.js

Deletes a company by its id.

Parameters

Name Type Description
companyId number The id of the company to delete.
[tx] object Optional transaction to run within.

Returns

Promise<void>

Example

await store.company.delete(1);

company.getById

Source: src/store/company/getById.js

Returns a single company by its id.

Parameters

Name Type Description
id number The id of the company.
[tx] object Optional transaction to run within.

Returns

Promise<object|undefined> — The company row, or undefined if not found.

Example

const company = await store.company.getById(1);
// => { id, name, ... }

company.getByName

Source: src/store/company/getByName.js

Returns a single company by its name.

Parameters

Name Type Description
name string The company name.
[tx] object Optional transaction to run within.

Returns

Promise<object|undefined> — The company row, or undefined if not found.

Example

const company = await store.company.getByName('Acme');
// => { id, name, ... }

company.list

Source: src/store/company/list.js

Lists the companies accessible to the given Google auth user.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.
[tx] object Optional transaction to run within.

Returns

Promise<Array<object>> — The accessible company rows.

Example

const companies = await store.company.list(42);
// => [{ id, name, ... }]

company.update

Source: src/store/company/update.js

Updates an existing company's name, language and tax rates.

Parameters

Name Type Description
id number The id of the company to update.
input object The update input.
input.iso639 string The ISO 639 language code.
input.name string The new company name (must be unique).
input.taxrate number The standard tax rate in percent.
input.reducedtaxrate number The reduced tax rate in percent.
[tx] object Optional transaction to run within.

Returns

Promise<{id: number, rootCategoryId: number, languageId: number, taxrateId: number, reducedtaxrateId: number, taxfreerateId: number}> — The updated company ids.

Throws

Error — If the company is not found or the name is taken.

Example

const result = await store.company.update(1, { iso639: 'de', name: 'Acme', taxrate: 19, reducedtaxrate: 7 });
// => { id, rootCategoryId, languageId, taxrateId, reducedtaxrateId, taxfreerateId }