2.2 KiB
package
This document is auto-generated from the JSDoc comments in src/store by running npm run api-doc.
package.create
Source: src/store/package/create.js
Creates a package for a shipping. The number is allocated from the package numbers sequence (own prefix + counter). The package must target an entity address.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
input |
object |
Package input. |
input.shippingId |
number |
The shipping id. |
input.entityaddressId |
number |
The target entity address id (required). |
input.type |
string |
Package type. |
input.state |
string |
Package state. |
[input.details] |
string |
Optional details. |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<{id: number, shippingId: number, entityaddressId: number, number: string, type: string, state: string, details: string|null}>
Throws
Error — If shipping or entity address is not found, or input is invalid.
Example
await store.package.create(googleAuthId, { shippingId: 9, entityaddressId: 3, type: 'box', state: 'packed' });
package.delete
Source: src/store/package/delete.js
Deletes a package of the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
id |
number |
The package id. |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<void>
Example
await store.package.delete(googleAuthId, 12);
package.listByShippingId
Source: src/store/package/listByShippingId.js
Lists packages of a shipping in the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
shippingId |
number |
The shipping id. |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<Array<{id: number, shippingId: number, entityaddressId: number, number: string, type: string, state: string, details: string|null}>>
Example
const packages = await store.package.listByShippingId(googleAuthId, 9);