Rewrite store JSDoc, split quote/order into modules, and generate typed API docs
- Rewrite JSDoc across all store methods to document the actual async methods (real params, returns, throws) instead of the internal wrappers - Split quote/order into individual module files backed by shared manifestDoc helpers; remove the createStore factory and thin wrappers - Deduplicate manifest line helpers into src/store/manifestLines.js - Extend generate-api-doc.js to render parameter/return/throws types and emit per-namespace API.<module>.md files with an API.md index - Regenerate all API docs
This commit is contained in:
@@ -8,6 +8,27 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
|
||||
|
||||
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. |
|
||||
|
||||
**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**
|
||||
|
||||
```js
|
||||
const company = await store.company.create({
|
||||
iso639: 'de',
|
||||
@@ -25,6 +46,18 @@ const company = await store.company.create({
|
||||
|
||||
Deletes a company by its id.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `companyId` | `number` | The id of the company to delete. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<void>`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
await store.company.delete(1);
|
||||
```
|
||||
@@ -35,6 +68,19 @@ await store.company.delete(1);
|
||||
|
||||
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**
|
||||
|
||||
```js
|
||||
const company = await store.company.getById(1);
|
||||
// => { id, name, ... }
|
||||
@@ -46,6 +92,19 @@ const company = await store.company.getById(1);
|
||||
|
||||
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**
|
||||
|
||||
```js
|
||||
const company = await store.company.getByName('Acme');
|
||||
// => { id, name, ... }
|
||||
@@ -57,6 +116,18 @@ const company = await store.company.getByName('Acme');
|
||||
|
||||
Lists the companies accessible to the given Google auth user.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<Array<object>>` — The accessible company rows.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const companies = await store.company.list(42);
|
||||
// => [{ id, name, ... }]
|
||||
@@ -68,6 +139,27 @@ const companies = await store.company.list(42);
|
||||
|
||||
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. |
|
||||
|
||||
**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**
|
||||
|
||||
```js
|
||||
const result = await store.company.update(1, { iso639: 'de', name: 'Acme', taxrate: 19, reducedtaxrate: 7 });
|
||||
// => { id, rootCategoryId, languageId, taxrateId, reducedtaxrateId, taxfreerateId }
|
||||
|
||||
Reference in New Issue
Block a user