4.6 KiB
retoure
This document is auto-generated from the JSDoc comments in src/store by running npm run api-doc.
retoure.create
Source: src/store/retoure/create.js
Creates a new retoure for the user's selected company with its lines.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
body |
object |
The retoure input. |
[body.number] |
string |
The retoure number. |
body.date |
string |
The retoure date. |
[body.entityId] |
number |
The id of the customer entity. |
[body.externalNumber] |
string |
An external reference number. |
[body.lines] |
Array<object> |
The retoure lines. |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<object> — The created retoure.
retoure.createShipment
Source: src/store/retoure/createShipment.js
Creates a shipment manifest for a retoure.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
retoureId |
number |
The parent retoure manifest id. |
input |
object |
Shipment input. |
[tx] |
object |
Optional transaction. |
Returns
Promise<object> — The created shipment.
retoure.delete
Source: src/store/retoure/delete.js
Deletes a retoure 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 retoure to delete. |
[tx] |
object |
Optional transaction. |
Returns
Promise<void>
Throws
Error — If the retoure is not found.
retoure.getById
Source: src/store/retoure/getById.js
Returns a single retoure 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 retoure. |
[tx] |
object |
Optional transaction. |
Returns
Promise<{id: number, number: string, type: string, entityId: number|null, externalNumber: string|null, date: string, lines: Array<{id: number, sku: string|null, name: string|null, pu: number, amount: number, net: number, rebate: number, taxrate: number, comment: string|null}>}> — The retoure with its lines.
Throws
Error — If the retoure is not found.
retoure.list
Source: src/store/retoure/list.js
Lists the retoures of the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
[opts] |
object |
Optional pagination and filter options. |
[opts.offset=0] |
number |
Number of retoures to skip. |
[opts.limit=50] |
number |
Number of retoures to return. |
[opts.search] |
string |
Free-text search matching retoure number, external number, or customer name. |
[opts.onlyUnpaid=false] |
boolean |
When true, returns only unpaid retoures. |
[opts.onlyUndelivered=false] |
boolean |
When true, returns only undelivered retoures. |
[opts.seekMonths] |
number |
Negative integer for cutoff months ago (e.g. -1). |
[tx] |
object |
Optional transaction. |
Returns
Promise<{retoures: Array<object>, total: number, unfilteredTotal: number, offset: number, limit: number}|Array<object>>
retoure.rebuildSummaries
Source: src/store/retoure/rebuildSummaries.js
Rebuilds the retouresummary table for the user's selected company.
Parameters
| Name | Type | Description |
|---|---|---|
provider |
import('../../providers/provider.js').DatabaseProvider |
retoure.syncSummary
Source: src/store/retoure/syncSummary.js
Centralized sync and rebuild logic for the materialized retouresummary table.
retoure.update
Source: src/store/retoure/update.js
Updates a retoure's header and/or lines.
Parameters
| Name | Type | Description |
|---|---|---|
googleAuthId |
number |
The id of the Google auth user. |
id |
number |
The id of the retoure to update. |
patch |
object |
The update patch. |
[patch.number] |
string |
The new retoure number. |
[patch.date] |
string |
The new retoure date. |
[patch.entityId] |
number |
The new customer entity id. |
[patch.externalNumber] |
string |
The new external reference number. |
[patch.lines] |
Array<object> |
The new retoure lines. |
[tx] |
object |
Optional transaction to run within. |
Returns
Promise<object> — The updated retoure.