u
This commit is contained in:
@@ -15,6 +15,7 @@ Appends a new append-only entry to the ledger table.
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `input` | `object` | Ledger entry payload. |
|
||||
| `input.manifestarticle_id` | `number` | ID of the referenced manifest line (can also pass manifestarticleId). |
|
||||
| `[input.warehouse_id]` | `number|null` | Optional warehouse ID (can also pass warehouseId). |
|
||||
| `input.transaction_type` | `string` | Transaction type (can also pass transactionType). |
|
||||
| `input.amount` | `number` | Movement amount. |
|
||||
| `input.transaction_text` | `string` | Transaction memo/details (can also pass transactionText). |
|
||||
@@ -22,7 +23,7 @@ Appends a new append-only entry to the ledger table.
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, manifestarticle_id: number, transaction_type: string, amount: number, transaction_text: string, hash_version: number, prev_hash: string, created_at: string}>` — The created ledger row.
|
||||
`Promise<{id: number, manifestarticle_id: number, warehouse_id: number|null, transaction_type: string, amount: number, transaction_text: string, hash_version: number, prev_hash: string, created_at: string}>` — The created ledger row.
|
||||
|
||||
**Throws**
|
||||
|
||||
@@ -33,7 +34,8 @@ Appends a new append-only entry to the ledger table.
|
||||
```js
|
||||
const entry = await store.ledger.add(googleAuthId, {
|
||||
manifestarticle_id: 1,
|
||||
transaction_type: 'PAYMENT',
|
||||
warehouse_id: 1,
|
||||
transaction_type: 'DELIVERY',
|
||||
amount: 100.5,
|
||||
transaction_text: 'Invoice paid',
|
||||
});
|
||||
@@ -43,7 +45,7 @@ const entry = await store.ledger.add(googleAuthId, {
|
||||
|
||||
*Source: `src/store/ledger/listByManifestarticleId.js`*
|
||||
|
||||
Lists ledger entries for a specific manifest article line, optionally filtered by transaction type.
|
||||
Lists ledger entries for a specific manifest article line, optionally filtered by transaction type and/or warehouse.
|
||||
|
||||
**Parameters**
|
||||
|
||||
@@ -51,12 +53,12 @@ Lists ledger entries for a specific manifest article line, optionally filtered b
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `manifestarticleId` | `number` | The id of the manifest article line. |
|
||||
| `[optionsOrType]` | `string|object` | Transaction type string or options object { transaction_type?: string, transactionType?: string }. |
|
||||
| `[optionsOrType]` | `string|object` | Transaction type string or options object { transaction_type?: string, transactionType?: string, warehouse_id?: number, warehouseId?: number }. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<Array<{id: number, manifestarticle_id: number, sku: string|null, transaction_type: string, amount: number, transaction_text: string, hash_version: number, prev_hash: string, created_at: string}>>`
|
||||
`Promise<Array<{id: number, manifestarticle_id: number, warehouse_id: number|null, sku: string|null, transaction_type: string, amount: number, transaction_text: string, hash_version: number, prev_hash: string, created_at: string}>>`
|
||||
|
||||
**Throws**
|
||||
|
||||
@@ -65,15 +67,15 @@ Lists ledger entries for a specific manifest article line, optionally filtered b
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const entries = await store.ledger.listByManifestarticleId(googleAuthId, 42, 'PAYMENT');
|
||||
// => [{ id, manifestarticle_id, sku, transaction_type, amount, transaction_text, hash_version, prev_hash, created_at }]
|
||||
const entries = await store.ledger.listByManifestarticleId(googleAuthId, 42, 'DELIVERY');
|
||||
// => [{ id, manifestarticle_id, warehouse_id, sku, transaction_type, amount, transaction_text, hash_version, prev_hash, created_at }]
|
||||
```
|
||||
|
||||
## `ledger.listBySku`
|
||||
|
||||
*Source: `src/store/ledger/listBySku.js`*
|
||||
|
||||
Lists ledger entries for a given article SKU, optionally filtered by transaction type.
|
||||
Lists ledger entries for a given article SKU, optionally filtered by transaction type and/or warehouse.
|
||||
|
||||
**Parameters**
|
||||
|
||||
@@ -81,12 +83,12 @@ Lists ledger entries for a given article SKU, optionally filtered by transaction
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `sku` | `string` | The article SKU. |
|
||||
| `[optionsOrType]` | `string|object` | Transaction type string or options object { transaction_type?: string, transactionType?: string }. |
|
||||
| `[optionsOrType]` | `string|object` | Transaction type string or options object { transaction_type?: string, transactionType?: string, warehouse_id?: number, warehouseId?: number }. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<Array<{id: number, manifestarticle_id: number, sku: string|null, transaction_type: string, amount: number, transaction_text: string, hash_version: number, prev_hash: string, created_at: string}>>`
|
||||
`Promise<Array<{id: number, manifestarticle_id: number, warehouse_id: number|null, sku: string|null, transaction_type: string, amount: number, transaction_text: string, hash_version: number, prev_hash: string, created_at: string}>>`
|
||||
|
||||
**Throws**
|
||||
|
||||
@@ -96,5 +98,5 @@ Lists ledger entries for a given article SKU, optionally filtered by transaction
|
||||
|
||||
```js
|
||||
const entries = await store.ledger.listBySku(googleAuthId, 'SKU-001', 'DELIVERY');
|
||||
// => [{ id, manifestarticle_id, sku, transaction_type, amount, transaction_text, hash_version, prev_hash, created_at }]
|
||||
// => [{ id, manifestarticle_id, warehouse_id, sku, transaction_type, amount, transaction_text, hash_version, prev_hash, created_at }]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user