u
This commit is contained in:
82
API.shipping.md
Normal file
82
API.shipping.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# shipping
|
||||
|
||||
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
||||
|
||||
## `shipping.create`
|
||||
|
||||
*Source: `src/store/shipping/create.js`*
|
||||
|
||||
Creates a shipping for a manifest (order). The number is allocated from the `shipping` numbers sequence (own prefix + counter).
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `input` | `object` | Shipping input. |
|
||||
| `input.manifestId` | `number` | The manifest (order) id. |
|
||||
| `input.type` | `string` | Shipping type. |
|
||||
| `input.state` | `string` | Shipping state. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, manifestId: number, number: string, type: string, state: string}>`
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If manifest is not found or input is invalid.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
await store.shipping.create(googleAuthId, { manifestId: 42, type: 'parcel', state: 'open' });
|
||||
```
|
||||
|
||||
## `shipping.delete`
|
||||
|
||||
*Source: `src/store/shipping/delete.js`*
|
||||
|
||||
Deletes a shipping of the user's selected company. Its packages are removed by cascade.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `id` | `number` | The shipping id. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<void>`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
await store.shipping.delete(googleAuthId, 9);
|
||||
```
|
||||
|
||||
## `shipping.listByManifestId`
|
||||
|
||||
*Source: `src/store/shipping/listByManifestId.js`*
|
||||
|
||||
Lists shippings of a manifest (order) in the user's selected company.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `manifestId` | `number` | The manifest id. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<Array<{id: number, manifestId: number, number: string, type: string, state: string}>>`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const shippings = await store.shipping.listByManifestId(googleAuthId, 42);
|
||||
```
|
||||
Reference in New Issue
Block a user