- 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
113 lines
2.4 KiB
Markdown
113 lines
2.4 KiB
Markdown
# supplier
|
|
|
|
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
|
|
|
## `supplier.create`
|
|
|
|
*Source: `src/store/supplier/create.js`*
|
|
|
|
Creates a new supplier for the user's selected company, recording history.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `input` | `object` | The supplier input. |
|
|
| `input.name` | `string` | The supplier name. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, name: string, createdAt: string, updatedAt: string}>` — The created supplier.
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the name is empty.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const supplier = await store.supplier.create(42, { name: 'Acme Supplies' });
|
|
// => { id, name, createdAt, updatedAt }
|
|
```
|
|
|
|
## `supplier.delete`
|
|
|
|
*Source: `src/store/supplier/delete.js`*
|
|
|
|
Deletes a supplier 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 supplier to delete. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<void>`
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the supplier is not found.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
await store.supplier.delete(42, 5);
|
|
```
|
|
|
|
## `supplier.list`
|
|
|
|
*Source: `src/store/supplier/list.js`*
|
|
|
|
Lists the suppliers 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, createdAt: string, updatedAt: string}>>` — The suppliers.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const suppliers = await store.supplier.list(42);
|
|
// => [{ id, name, createdAt, updatedAt }]
|
|
```
|
|
|
|
## `supplier.update`
|
|
|
|
*Source: `src/store/supplier/update.js`*
|
|
|
|
Updates the name of a supplier, recording history.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The id of the Google auth user. |
|
|
| `id` | `number` | The id of the supplier to update. |
|
|
| `input` | `object` | The update input. |
|
|
| `input.name` | `string` | The new supplier name. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<{id: number, name: string, createdAt: string, updatedAt: string}>` — The updated supplier.
|
|
|
|
**Throws**
|
|
|
|
`Error` — If the supplier is not found or the name is empty.
|
|
|
|
**Example**
|
|
|
|
```js
|
|
const supplier = await store.supplier.update(42, 5, { name: 'Acme GmbH' });
|
|
// => { id, name, createdAt, updatedAt }
|
|
```
|