From 3c2b933f934c40ef5bca12aca2c5f63d7456cdcf Mon Sep 17 00:00:00 2001 From: seb Date: Sat, 17 Oct 2026 23:32:42 +0200 Subject: [PATCH] u --- API.articlewarehousesummary.md | 9 +++++++++ API.entity.md | 2 +- API.md | 4 ++++ API.stock.md | 12 ++++++++++++ API.supplier.md | 2 +- 5 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 API.articlewarehousesummary.md diff --git a/API.articlewarehousesummary.md b/API.articlewarehousesummary.md new file mode 100644 index 0000000..c742ec6 --- /dev/null +++ b/API.articlewarehousesummary.md @@ -0,0 +1,9 @@ +# articlewarehousesummary + +This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`. + +## `articlewarehousesummary.syncSummary` + +*Source: `src/store/articlewarehousesummary/syncSummary.js`* + +Centralized sync and rebuild logic for the materialized `articlewarehousesummary` table. Keeps `articlewarehousesummary` in sync with ledger movements, track_stock status, and warehouses. diff --git a/API.entity.md b/API.entity.md index 775948b..a5728fb 100644 --- a/API.entity.md +++ b/API.entity.md @@ -55,7 +55,7 @@ Deletes an entity by its id within the user's selected company. **Throws** -`Error` — If the entity is not found. +`Error` — If the entity is not found or is in use. **Example** diff --git a/API.md b/API.md index 1c97c03..2b2d55d 100644 --- a/API.md +++ b/API.md @@ -36,6 +36,7 @@ The store is exposed as a `LibDashStore` instance (see `src/index.js`). Each met - **companysetting**: `id PK, company_id->company, key:s(255), value:txt, frontend:b=0, writeonly:b=0, UQ(company_id, key)` - **companyuser**: `id PK, google_auth_id->google_auth, company_id->company, UQ(google_auth_id, company_id)` - **customergroup**: `id PK, name:s(255), sort:i=0, company_id?->company` +- **articlewarehousesummary**: `id PK, article_id->article, warehouse_id->warehouse, stock:f=0, UQ(article_id, warehouse_id)` - **deliverysummary**: `id PK, company_id->company, manifest_id->manifest UQ, delivery_number:s(100), external_number?:s(100), delivery_date:dt, created_at:dt, supplier_id?->entity, supplier_name?:s(255), positions:i=0, gross_total:f=0, net_total:f=0, total_quantity:f=0, stock_positions:i=0, booked_positions:i=0, unbooked_positions:i=0, stock_quantity:f=0, booked_quantity:f=0, unbooked_quantity:f=0, is_booked:b=0` - **entity**: `id PK, customergroup_id->customergroup, first_name?:s(255), name:s(255), number?:s(100), created_at:dt, updated_at:dt, UQ(company_id, number)` - **entityaddress**: `id PK, entity_id->entity, first_name?:s(255), name?:s(255), street?:s(255), streetnumber?:s(50), zip?:s(50), city?:s(255), county?:s(255), addresstype:s(50), sort:i=0` @@ -247,6 +248,7 @@ The store is exposed as a `LibDashStore` instance (see `src/index.js`). Each met - [stock](API.stock.md) - `accept(provider: object): Function` - `adjust(googleAuthId: number, input: {sku?: string, warehouseId?: number, amount?: number, text?: string, externalNumber?: string, date?: string|Date, lines?: Array}, tx?: object): Promise<{manifest: {id: number, number: string, type: string, date: string, createdAt: string}, lines: Array, ledger: Array}>` + - `rebuildSummaries(provider: import('../../providers/provider.js').DatabaseProvider): void` - `ship(provider: object): Function` - [posterminal](API.posterminal.md) - `delete(googleAuthId: number, id: number, tx?: object): Promise` @@ -335,6 +337,8 @@ The store is exposed as a `LibDashStore` instance (see `src/index.js`). Each met - [articlelist](API.articlelist.md) - `getItemsByArticleSku(googleAuthId: number, sku: string, tx?: object): Promise>` - `setItemsByArticleSku(googleAuthId: number, sku: string, items?: Array<{articleId?: number, sku?: string, count?: number, sort?: number}>, tx?: object): Promise>` +- [articlewarehousesummary](API.articlewarehousesummary.md) + - `syncSummary(): void` - [carrier](API.carrier.md) - `create(googleAuthId: number, input: {name: string, sort?: number, hasPackages?: boolean, isReverse?: boolean}, tx?: object): Promise<{id: number, name: string, sort: number, hasPackages: boolean, isReverse: boolean}>` - `delete(googleAuthId: number, id: number, tx?: object): Promise` diff --git a/API.stock.md b/API.stock.md index c3c26fb..bf3b000 100644 --- a/API.stock.md +++ b/API.stock.md @@ -43,6 +43,18 @@ Adjusts article stock manually by creating an implicit manifest of type "adjustm `Promise<{manifest: {id: number, number: string, type: string, date: string, createdAt: string}, lines: Array, ledger: Array}>` +## `stock.rebuildSummaries` + +*Source: `src/store/stock/rebuildSummaries.js`* + +Rebuilds the `articlewarehousesummary` table for the user's selected company. + +**Parameters** + +| Name | Type | Description | +| --- | --- | --- | +| `provider` | `import('../../providers/provider.js').DatabaseProvider` | | + ## `stock.ship` *Source: `src/store/stock/ship.js`* diff --git a/API.supplier.md b/API.supplier.md index 23c8006..0075528 100644 --- a/API.supplier.md +++ b/API.supplier.md @@ -52,7 +52,7 @@ Deletes a supplier by its id within the user's selected company. **Throws** -`Error` — If the supplier is not found. +`Error` — If the supplier is not found or is in use. **Example**