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:
@@ -6,22 +6,49 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
|
||||
|
||||
*Source: `src/store/posterminal/delete.js`*
|
||||
|
||||
Deletes a posterminal by its id within a company.
|
||||
Deletes a posterminal by its id within the user's selected company.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `id` | `number` | The id of the posterminal to delete. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<void>`
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the posterminal is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = del(pool);
|
||||
await fn(42, 5);
|
||||
await store.posterminal.delete(42, 5);
|
||||
```
|
||||
|
||||
## `posterminal.list`
|
||||
|
||||
*Source: `src/store/posterminal/list.js`*
|
||||
|
||||
Lists the posterminals of a company.
|
||||
Lists the posterminals of the user's selected company.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<Array<{id: number, name: string, token: string, pairingpin: string}>>` — The posterminals.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = list(pool);
|
||||
const terminals = await fn(42);
|
||||
const terminals = await store.posterminal.list(42);
|
||||
// => [{ id, name, token, pairingpin }]
|
||||
```
|
||||
|
||||
@@ -31,9 +58,26 @@ const terminals = await fn(42);
|
||||
|
||||
Removes a category assignment from a posterminal (turns it off).
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `posterminalId` | `number` | The id of the posterminal. |
|
||||
| `categoryId` | `number` | The id of the category to remove. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, categoryIds: Array<number>}>` — The posterminal with its remaining category ids.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the posterminal is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = setOff(pool);
|
||||
const result = await fn(42, 5, 9);
|
||||
const result = await store.posterminal.setOff(42, 5, 9);
|
||||
// => { id, categoryIds: [...] }
|
||||
```
|
||||
|
||||
@@ -43,9 +87,25 @@ const result = await fn(42, 5, 9);
|
||||
|
||||
Removes all category assignments from a posterminal.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `posterminalId` | `number` | The id of the posterminal. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, categoryIds: Array<number>}>` — The posterminal with an empty category list.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the posterminal is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = setOffAll(pool);
|
||||
const result = await fn(42, 5);
|
||||
const result = await store.posterminal.setOffAll(42, 5);
|
||||
// => { id, categoryIds: [] }
|
||||
```
|
||||
|
||||
@@ -55,9 +115,26 @@ const result = await fn(42, 5);
|
||||
|
||||
Assigns a category to a posterminal (turns it on for that category).
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `posterminalId` | `number` | The id of the posterminal. |
|
||||
| `categoryId` | `number` | The id of the category to assign. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, categoryIds: Array<number>}>` — The posterminal with its category ids.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the posterminal is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = setOn(pool);
|
||||
const result = await fn(42, 5, 9);
|
||||
const result = await store.posterminal.setOn(42, 5, 9);
|
||||
// => { id, categoryIds: [9, ...] }
|
||||
```
|
||||
|
||||
@@ -65,11 +142,27 @@ const result = await fn(42, 5, 9);
|
||||
|
||||
*Source: `src/store/posterminal/setOnAll.js`*
|
||||
|
||||
Assigns all categories of a company to a posterminal.
|
||||
Assigns all categories of the user's selected company to a posterminal.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `posterminalId` | `number` | The id of the posterminal. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, categoryIds: Array<number>}>` — The posterminal with all category ids.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the posterminal is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = setOnAll(pool);
|
||||
const result = await fn(42, 5);
|
||||
const result = await store.posterminal.setOnAll(42, 5);
|
||||
// => { id, categoryIds: [...] }
|
||||
```
|
||||
|
||||
@@ -77,10 +170,30 @@ const result = await fn(42, 5);
|
||||
|
||||
*Source: `src/store/posterminal/upsert.js`*
|
||||
|
||||
Creates or updates a posterminal for a company.
|
||||
Creates or updates a posterminal for the user's selected company.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `input` | `object` | The posterminal input. |
|
||||
| `input.name` | `string` | The posterminal name. |
|
||||
| `input.pairingpin` | `string` | The pairing pin. |
|
||||
| `[input.token]` | `string` | Optional token. |
|
||||
| `[input.id]` | `number` | Optional id to update an existing posterminal. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, name: string, token: string, pairingpin: string}>` — The upserted posterminal.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the posterminal is invalid.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = upsert(pool);
|
||||
const terminal = await fn(42, { name: 'Kasse 1', pairingpin: '1234', token: 'abc' });
|
||||
const terminal = await store.posterminal.upsert(42, { name: 'Kasse 1', pairingpin: '1234', token: 'abc' });
|
||||
// => { id, name, token, pairingpin }
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user