1.6 KiB
1.6 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.
const fn = create(pool);
const company = await fn({
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.
const fn = del(pool);
await fn(1);
company.getById
Source: src/store/company/getById.js
Returns a single company by its id.
const fn = getById(pool);
const company = await fn(1);
// => { id, name, ... }
company.getByName
Source: src/store/company/getByName.js
Returns a single company by its name.
const fn = getByName(pool);
const company = await fn('Acme');
// => { id, name, ... }
company.list
Source: src/store/company/list.js
Lists the companies accessible to the given Google auth user.
const fn = list(pool);
const companies = await fn(42);
// => [{ id, name, ... }]
company.update
Source: src/store/company/update.js
Updates an existing company's name, language and tax rates.
const fn = update(pool);
const result = await fn(1, { iso639: 'de', name: 'Acme', taxrate: 19, reducedtaxrate: 7 });
// => { id, rootCategoryId, languageId, taxrateId, reducedtaxrateId, taxfreerateId }