docs
This commit is contained in:
80
API.company.md
Normal file
80
API.company.md
Normal file
@@ -0,0 +1,80 @@
|
||||
# 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.
|
||||
|
||||
```js
|
||||
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.
|
||||
|
||||
```js
|
||||
const fn = del(pool);
|
||||
await fn(1);
|
||||
```
|
||||
|
||||
## `company.getById`
|
||||
|
||||
*Source: `src/store/company/getById.js`*
|
||||
|
||||
Returns a single company by its id.
|
||||
|
||||
```js
|
||||
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.
|
||||
|
||||
```js
|
||||
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.
|
||||
|
||||
```js
|
||||
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.
|
||||
|
||||
```js
|
||||
const fn = update(pool);
|
||||
const result = await fn(1, { iso639: 'de', name: 'Acme', taxrate: 19, reducedtaxrate: 7 });
|
||||
// => { id, rootCategoryId, languageId, taxrateId, reducedtaxrateId, taxfreerateId }
|
||||
```
|
||||
Reference in New Issue
Block a user