feat(articlesupplier): add sort column, reorder method, and update queries and schema

This commit is contained in:
seb
2026-09-17 12:00:41 +02:00
parent 4c196c7209
commit af52ff595f
16 changed files with 264 additions and 78 deletions

View File

@@ -123,7 +123,7 @@ Returns the full detail of an article by its SKU, including unit, brand, categor
**Returns** **Returns**
`Promise<{article: {id: number, sku: string, name: string, slug: string, unitamount: number|null, weight: number|null, unit: {si: string|null, basesi: string|null, basesifactor: number|null, symbol: string|null, name: string|null}, brand: {name: string, thumbW: number, thumbH: number, thumbHash: string}|null, categoryIds: number[], photos: Array<{sort: number, fullHash: string, fullW: number, fullH: number, fullSize: number, thumbW: number, thumbH: number, thumbHash: string}>, eans: string[], prices: Array<{minmultiplier: number, net: number, taxRate: number, customergroupId: number}>, suppliers: Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>, optionsCount: number, articleListCount: number, childCount: number, fatherArticleId: number|null, fatherSku: string|null}}>` — The full article detail. `Promise<{article: {id: number, sku: string, name: string, slug: string, unitamount: number|null, weight: number|null, unit: {si: string|null, basesi: string|null, basesifactor: number|null, symbol: string|null, name: string|null}, brand: {name: string, thumbW: number, thumbH: number, thumbHash: string}|null, categoryIds: number[], photos: Array<{sort: number, fullHash: string, fullW: number, fullH: number, fullSize: number, thumbW: number, thumbH: number, thumbHash: string}>, eans: string[], prices: Array<{minmultiplier: number, net: number, taxRate: number, customergroupId: number}>, suppliers: Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>, optionsCount: number, articleListCount: number, childCount: number, fatherArticleId: number|null, fatherSku: string|null}}>` — The full article detail.
**Throws** **Throws**

View File

@@ -19,13 +19,14 @@ Assigns a supplier to an article, optionally creating a purchase price.
| `[input.sku]` | `string` | The supplier's item number/SKU. | | `[input.sku]` | `string` | The supplier's item number/SKU. |
| `[input.pu]` | `number` | Packaging unit (defaults to 1). | | `[input.pu]` | `number` | Packaging unit (defaults to 1). |
| `[input.stock]` | `number|null` | Current stock at the supplier. | | `[input.stock]` | `number|null` | Current stock at the supplier. |
| `[input.sort]` | `number` | Display sort order (defaults to next sort). |
| `[input.netPrice]` | `number|null` | Net purchase price. | | `[input.netPrice]` | `number|null` | Net purchase price. |
| `[input.taxId]` | `number` | The tax id for the purchase price. | | `[input.taxId]` | `number` | The tax id for the purchase price. |
| `[input.taxRate]` | `number` | The tax rate in percent (used if taxId is not provided). | | `[input.taxRate]` | `number` | The tax rate in percent (used if taxId is not provided). |
**Returns** **Returns**
`Promise<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>` — The created assignment. `Promise<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>` — The created assignment.
**Throws** **Throws**
@@ -40,7 +41,7 @@ const created = await store.articlesupplier.create(42, 'SKU-1', {
pu: 1, pu: 1,
netPrice: 4.20, netPrice: 4.20,
}); });
// => { id, articleId, entityId, supplierName, sku, pu, stock, priceId, price } // => { id, articleId, entityId, supplierName, sku, pu, stock, sort, priceId, price }
``` ```
## `articlesupplier.delete` ## `articlesupplier.delete`
@@ -86,7 +87,7 @@ Lists the supplier assignments for an article by its SKU.
**Returns** **Returns**
`Promise<Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>>` — The supplier assignments. `Promise<Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>>` — The supplier assignments.
**Throws** **Throws**
@@ -99,6 +100,36 @@ const suppliers = await store.articlesupplier.listByArticleSku(42, 'SKU-1');
// => [{ id, articleId, entityId, supplierName, sku, pu, stock, priceId, price }] // => [{ id, articleId, entityId, supplierName, sku, pu, stock, priceId, price }]
``` ```
## `articlesupplier.order`
*Source: `src/store/articlesupplier/order.js`*
Reorders the supplier assignments of an article by its SKU.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `sku` | `string` | The article SKU. |
| `input` | `object` | The reorder input. |
| `input.ids` | `Array<number>` | The articlesupplier ids in their new order. |
**Returns**
`Promise<{ids: Array<number>}>` — The applied order.
**Throws**
`Error` — If the order is invalid.
**Example**
```js
const result = await store.articlesupplier.order(42, 'SKU-1', { ids: [12, 10, 15] });
// => { ids: [12, 10, 15] }
```
## `articlesupplier.update` ## `articlesupplier.update`
*Source: `src/store/articlesupplier/update.js`* *Source: `src/store/articlesupplier/update.js`*
@@ -116,13 +147,14 @@ Updates an existing supplier assignment and its associated purchase price.
| `[patch.sku]` | `string|null` | The supplier's item number/SKU. | | `[patch.sku]` | `string|null` | The supplier's item number/SKU. |
| `[patch.pu]` | `number` | Packaging unit (> 0). | | `[patch.pu]` | `number` | Packaging unit (> 0). |
| `[patch.stock]` | `number|null` | Current stock at the supplier. | | `[patch.stock]` | `number|null` | Current stock at the supplier. |
| `[patch.sort]` | `number` | Display sort order. |
| `[patch.netPrice]` | `number|null` | Net purchase price. | | `[patch.netPrice]` | `number|null` | Net purchase price. |
| `[patch.taxId]` | `number` | The tax id for the purchase price. | | `[patch.taxId]` | `number` | The tax id for the purchase price. |
| `[patch.taxRate]` | `number` | The tax rate in percent. | | `[patch.taxRate]` | `number` | The tax rate in percent. |
**Returns** **Returns**
`Promise<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>` — The updated assignment. `Promise<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>` — The updated assignment.
**Throws** **Throws**
@@ -136,5 +168,5 @@ const updated = await store.articlesupplier.update(42, 'SKU-1', 12, {
pu: 6, pu: 6,
netPrice: 22.50, netPrice: 22.50,
}); });
// => { id, articleId, entityId, supplierName, sku, pu, stock, priceId, price } // => { id, articleId, entityId, supplierName, sku, pu, stock, sort, priceId, price }
``` ```

9
API.md
View File

@@ -33,7 +33,7 @@ The store is exposed as a `LibDashStore` instance (see `src/index.js`). Each met
- `createUnderParent(input: {googleAuthId: number, parentId: number, name: string}): Promise<{id: number, parentId: number, name: string, sku: string}>` - `createUnderParent(input: {googleAuthId: number, parentId: number, name: string}): Promise<{id: number, parentId: number, name: string, sku: string}>`
- `delete(googleAuthId: number, sku: string): Promise<void>` - `delete(googleAuthId: number, sku: string): Promise<void>`
- `deleteImage(googleAuthId: number, sku: string, fullHash: string): Promise<void>` - `deleteImage(googleAuthId: number, sku: string, fullHash: string): Promise<void>`
- `getBySku(googleAuthId: number, sku: string): Promise<{article: {id: number, sku: string, name: string, slug: string, unitamount: number|null, weight: number|null, unit: {si: string|null, basesi: string|null, basesifactor: number|null, symbol: string|null, name: string|null}, brand: {name: string, thumbW: number, thumbH: number, thumbHash: string}|null, categoryIds: number[], photos: Array<{sort: number, fullHash: string, fullW: number, fullH: number, fullSize: number, thumbW: number, thumbH: number, thumbHash: string}>, eans: string[], prices: Array<{minmultiplier: number, net: number, taxRate: number, customergroupId: number}>, suppliers: Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>, optionsCount: number, articleListCount: number, childCount: number, fatherArticleId: number|null, fatherSku: string|null}}>` - `getBySku(googleAuthId: number, sku: string): Promise<{article: {id: number, sku: string, name: string, slug: string, unitamount: number|null, weight: number|null, unit: {si: string|null, basesi: string|null, basesifactor: number|null, symbol: string|null, name: string|null}, brand: {name: string, thumbW: number, thumbH: number, thumbHash: string}|null, categoryIds: number[], photos: Array<{sort: number, fullHash: string, fullW: number, fullH: number, fullSize: number, thumbW: number, thumbH: number, thumbHash: string}>, eans: string[], prices: Array<{minmultiplier: number, net: number, taxRate: number, customergroupId: number}>, suppliers: Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>, optionsCount: number, articleListCount: number, childCount: number, fatherArticleId: number|null, fatherSku: string|null}}>`
- `getHistoryBySku(googleAuthId: number, sku: string): Promise<Array<{id: number, companyuserId: number|null, date: string, text: string}>>` - `getHistoryBySku(googleAuthId: number, sku: string): Promise<Array<{id: number, companyuserId: number|null, date: string, text: string}>>`
- `importRows(input: {googleAuthId: number, rows: Array<object>}): Promise<{imported: Array<object>, skipped: Array<object>, errors: Array<object>}>` - `importRows(input: {googleAuthId: number, rows: Array<object>}): Promise<{imported: Array<object>, skipped: Array<object>, errors: Array<object>}>`
- `listExport(googleAuthId: number, categoryId?: number|null): Promise<Array<object>>` - `listExport(googleAuthId: number, categoryId?: number|null): Promise<Array<object>>`
@@ -99,10 +99,11 @@ The store is exposed as a `LibDashStore` instance (see `src/index.js`). Each met
- `list(googleAuthId: number): Promise<Array<{id: number, name: string, createdAt: string, updatedAt: string}>>` - `list(googleAuthId: number): Promise<Array<{id: number, name: string, createdAt: string, updatedAt: string}>>`
- `update(googleAuthId: number, id: number, input: {name: string}): Promise<{id: number, name: string, createdAt: string, updatedAt: string}>` - `update(googleAuthId: number, id: number, input: {name: string}): Promise<{id: number, name: string, createdAt: string, updatedAt: string}>`
- [articlesupplier](API.articlesupplier.md) - [articlesupplier](API.articlesupplier.md)
- `create(googleAuthId: number, sku: string, input: {entityId: number, sku?: string, pu?: number, stock?: number|null, netPrice?: number|null, taxId?: number, taxRate?: number}): Promise<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>` - `create(googleAuthId: number, sku: string, input: {entityId: number, sku?: string, pu?: number, stock?: number|null, sort?: number, netPrice?: number|null, taxId?: number, taxRate?: number}): Promise<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>`
- `delete(googleAuthId: number, sku: string, id: number): Promise<void>` - `delete(googleAuthId: number, sku: string, id: number): Promise<void>`
- `listByArticleSku(googleAuthId: number, sku: string): Promise<Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>>` - `listByArticleSku(googleAuthId: number, sku: string): Promise<Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>>`
- `update(googleAuthId: number, sku: string, id: number, patch: {sku?: string|null, pu?: number, stock?: number|null, netPrice?: number|null, taxId?: number, taxRate?: number}): Promise<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>` - `order(googleAuthId: number, sku: string, input: {ids: Array<number>}): Promise<{ids: Array<number>}>`
- `update(googleAuthId: number, sku: string, id: number, patch: {sku?: string|null, pu?: number, stock?: number|null, sort?: number, netPrice?: number|null, taxId?: number, taxRate?: number}): Promise<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>`
- [delivery](API.delivery.md) - [delivery](API.delivery.md)
- `create(googleAuthId: number, body: {date: string, supplierId: number, externalNumber?: string, lines?: Array<{sku?: string, name?: string, pu?: number, amount: number, net: number, rebate?: number, taxrate: number, comment?: string|null}>}): Promise<{id: number, number: string, type: string, entityId: number, 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}>}>` - `create(googleAuthId: number, body: {date: string, supplierId: number, externalNumber?: string, lines?: Array<{sku?: string, name?: string, pu?: number, amount: number, net: number, rebate?: number, taxrate: number, comment?: string|null}>}): Promise<{id: number, number: string, type: string, entityId: number, 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}>}>`
- `delete(googleAuthId: number, id: number): Promise<void>` - `delete(googleAuthId: number, id: number): Promise<void>`

View File

@@ -300,17 +300,19 @@ Maps articles to suppliers (`entity`) with purchase pricing, stock, packaging un
| `sku` | `NVARCHAR(100)` | Supplier's SKU code, nullable | | `sku` | `NVARCHAR(100)` | Supplier's SKU code, nullable |
| `stock` | `FLOAT` | Stock available at supplier, nullable | | `stock` | `FLOAT` | Stock available at supplier, nullable |
| `pu` | `FLOAT` | Packaging unit (Verpackungseinheit), default `1` | | `pu` | `FLOAT` | Packaging unit (Verpackungseinheit), default `1` |
| `sort` | `INT` | Display sort order (default `0`) |
Unique constraint: `UQ_articlesupplier_article_entity (article_id, entity_id)` Unique constraints: `UQ_articlesupplier_article_entity (article_id, entity_id)`, `UQ_articlesupplier_article_sort (article_id, sort)`
| Method | Signature | Returns | | Method | Signature | Returns |
| --- | --- | --- | | --- | --- | --- |
| `listByArticleSku` | `(googleAuthId, sku)` | `ArticleSupplierSummary[]` | | `listByArticleSku` | `(googleAuthId, sku)` | `ArticleSupplierSummary[]` |
| `create` | `(googleAuthId, sku, { entityId, sku?, pu?, stock?, netPrice?, taxId?, taxRate? })` | `ArticleSupplierSummary` | | `create` | `(googleAuthId, sku, { entityId, sku?, pu?, stock?, sort?, netPrice?, taxId?, taxRate? })` | `ArticleSupplierSummary` |
| `update` | `(googleAuthId, sku, id, { sku?, pu?, stock?, netPrice?, taxId?, taxRate? })` | `ArticleSupplierSummary` | | `update` | `(googleAuthId, sku, id, { sku?, pu?, stock?, sort?, netPrice?, taxId?, taxRate? })` | `ArticleSupplierSummary` |
| `order` | `(googleAuthId, sku, { ids })` | `{ ids: number[] }` |
| `delete` | `(googleAuthId, sku, id)` | `void` | | `delete` | `(googleAuthId, sku, id)` | `void` |
Errors: `Not authorized`, `Article not found`, `Supplier required`, `Supplier not found`, `Supplier assignment not found`, `Supplier already assigned`, `Invalid pu`, `Invalid stock`, `Invalid price`. Errors: `Not authorized`, `Article not found`, `Supplier required`, `Supplier not found`, `Supplier assignment not found`, `Supplier already assigned`, `Invalid pu`, `Invalid stock`, `Invalid sort`, `Invalid supplier order`, `Invalid price`.
--- ---
@@ -760,6 +762,7 @@ Company-scoped number sequences (`numbers` table). Auth via selected company (`g
| `GET /api/article/:sku/supplier` | `articlesupplier.listByArticleSku(googleAuthId, sku)` | | `GET /api/article/:sku/supplier` | `articlesupplier.listByArticleSku(googleAuthId, sku)` |
| `POST /api/article/:sku/supplier` | `articlesupplier.create(googleAuthId, sku, { entityId, sku?, pu?, stock?, netPrice?, taxId?, taxRate? })` | | `POST /api/article/:sku/supplier` | `articlesupplier.create(googleAuthId, sku, { entityId, sku?, pu?, stock?, netPrice?, taxId?, taxRate? })` |
| `PATCH /api/article/:sku/supplier/:id` | `articlesupplier.update(googleAuthId, sku, id, patch)` | | `PATCH /api/article/:sku/supplier/:id` | `articlesupplier.update(googleAuthId, sku, id, patch)` |
| `PUT /api/article/:sku/supplier/order` | `articlesupplier.order(googleAuthId, sku, { ids })` |
| `DELETE /api/article/:sku/supplier/:id` | `articlesupplier.delete(googleAuthId, sku, id)` | | `DELETE /api/article/:sku/supplier/:id` | `articlesupplier.delete(googleAuthId, sku, id)` |
| `GET /api/delivery` | `delivery.list(googleAuthId)` | | `GET /api/delivery` | `delivery.list(googleAuthId)` |
| `GET /api/delivery/:id` | `delivery.getById(googleAuthId, id)` | | `GET /api/delivery/:id` | `delivery.getById(googleAuthId, id)` |

View File

@@ -42,7 +42,7 @@ digraph schema {
articleean [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="4" BORDER="1"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>articleean</B></FONT></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="article_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>article_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="ean" COLSPAN="2" BGCOLOR="#2a3242" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">ean</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">NVARCHAR(50)</FONT></TD></TR></TABLE></TD></TR></TABLE>>]; articleean [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="4" BORDER="1"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>articleean</B></FONT></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="article_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>article_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="ean" COLSPAN="2" BGCOLOR="#2a3242" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">ean</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">NVARCHAR(50)</FONT></TD></TR></TABLE></TD></TR></TABLE>>];
articlelist [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="1" BORDER="1"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD PORT="in0" BGCOLOR="#33415c" BORDER="0" WIDTH="10" HEIGHT="4" CELLPADDING="0"></TD><TD PORT="in1" BGCOLOR="#33415c" BORDER="0" WIDTH="10" HEIGHT="4" CELLPADDING="0"></TD></TR><TR><TD COLSPAN="2" ALIGN="CENTER" CELLPADDING="3"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>articlelist</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR></TABLE>>]; articlelist [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="1" BORDER="1"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD PORT="in0" BGCOLOR="#33415c" BORDER="0" WIDTH="10" HEIGHT="4" CELLPADDING="0"></TD><TD PORT="in1" BGCOLOR="#33415c" BORDER="0" WIDTH="10" HEIGHT="4" CELLPADDING="0"></TD></TR><TR><TD COLSPAN="2" ALIGN="CENTER" CELLPADDING="3"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>articlelist</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR></TABLE>>];
articlelistarticle [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="4" BORDER="1"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>articlelistarticle</B></FONT></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="article_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>article_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="articlelist_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>articlelist_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="count" COLSPAN="2" BGCOLOR="#272e3d" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">count</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="sort" COLSPAN="2" BGCOLOR="#2a3242" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">sort</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT</FONT></TD></TR></TABLE></TD></TR></TABLE>>]; articlelistarticle [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="4" BORDER="1"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>articlelistarticle</B></FONT></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="article_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>article_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="articlelist_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>articlelist_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="count" COLSPAN="2" BGCOLOR="#272e3d" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">count</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="sort" COLSPAN="2" BGCOLOR="#2a3242" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">sort</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT</FONT></TD></TR></TABLE></TD></TR></TABLE>>];
articlesupplier [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="4" BORDER="1"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>articlesupplier</B></FONT></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="entity_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>entity_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="price_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>price_id</B>?</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="article_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>article_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="sku" COLSPAN="2" BGCOLOR="#2a3242" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">sku?</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">NVARCHAR(100)</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="stock" COLSPAN="2" BGCOLOR="#272e3d" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">stock?</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">FLOAT</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="pu" COLSPAN="2" BGCOLOR="#2a3242" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">pu</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">FLOAT</FONT></TD></TR></TABLE></TD></TR></TABLE>>]; articlesupplier [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="4" BORDER="1"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>articlesupplier</B></FONT></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="entity_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>entity_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="price_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>price_id</B>?</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="article_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>article_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="sku" COLSPAN="2" BGCOLOR="#2a3242" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">sku?</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">NVARCHAR(100)</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="stock" COLSPAN="2" BGCOLOR="#272e3d" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">stock?</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">FLOAT</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="pu" COLSPAN="2" BGCOLOR="#2a3242" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">pu</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">FLOAT</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="sort" COLSPAN="2" BGCOLOR="#272e3d" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">sort</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT</FONT></TD></TR></TABLE></TD></TR></TABLE>>];
brand [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="1" BORDER="1"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD PORT="in0" BGCOLOR="#33415c" BORDER="0" WIDTH="10" HEIGHT="4" CELLPADDING="0"></TD><TD PORT="in1" BGCOLOR="#33415c" BORDER="0" WIDTH="10" HEIGHT="4" CELLPADDING="0"></TD></TR><TR><TD COLSPAN="2" ALIGN="CENTER" CELLPADDING="3"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>brand</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="company_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>company_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="name" COLSPAN="2" BGCOLOR="#2a3242" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">name</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">NVARCHAR(255)</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="gsprpinfo" COLSPAN="2" BGCOLOR="#272e3d" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">gsprpinfo?</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">NVARCHAR(MAX)</FONT></TD></TR></TABLE></TD></TR></TABLE>>]; brand [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="1" BORDER="1"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD PORT="in0" BGCOLOR="#33415c" BORDER="0" WIDTH="10" HEIGHT="4" CELLPADDING="0"></TD><TD PORT="in1" BGCOLOR="#33415c" BORDER="0" WIDTH="10" HEIGHT="4" CELLPADDING="0"></TD></TR><TR><TD COLSPAN="2" ALIGN="CENTER" CELLPADDING="3"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>brand</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="company_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>company_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="name" COLSPAN="2" BGCOLOR="#2a3242" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">name</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">NVARCHAR(255)</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="gsprpinfo" COLSPAN="2" BGCOLOR="#272e3d" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">gsprpinfo?</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">NVARCHAR(MAX)</FONT></TD></TR></TABLE></TD></TR></TABLE>>];
optionslist [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="1" BORDER="1"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD PORT="in0" BGCOLOR="#33415c" BORDER="0" WIDTH="10" HEIGHT="4" CELLPADDING="0"></TD><TD PORT="in1" BGCOLOR="#33415c" BORDER="0" WIDTH="10" HEIGHT="4" CELLPADDING="0"></TD></TR><TR><TD COLSPAN="2" ALIGN="CENTER" CELLPADDING="3"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>optionslist</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR></TABLE>>]; optionslist [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="1" BORDER="1"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD PORT="in0" BGCOLOR="#33415c" BORDER="0" WIDTH="10" HEIGHT="4" CELLPADDING="0"></TD><TD PORT="in1" BGCOLOR="#33415c" BORDER="0" WIDTH="10" HEIGHT="4" CELLPADDING="0"></TD></TR><TR><TD COLSPAN="2" ALIGN="CENTER" CELLPADDING="3"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>optionslist</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR></TABLE>>];
optionslistarticle [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="4" BORDER="1"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>optionslistarticle</B></FONT></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="article_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>article_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="optionslist_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>optionslist_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="count" COLSPAN="2" BGCOLOR="#272e3d" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">count</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="sort" COLSPAN="2" BGCOLOR="#2a3242" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">sort</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="mandated" COLSPAN="2" BGCOLOR="#272e3d" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">mandated</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">BIT</FONT></TD></TR></TABLE></TD></TR></TABLE>>]; optionslistarticle [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" CELLPADDING="4" COLOR="#3f4c5f"><TR><TD COLSPAN="2" BGCOLOR="#33415c" ALIGN="CENTER" CELLPADDING="4" BORDER="1"><FONT COLOR="#e2e8f0" POINT-SIZE="12"><B>optionslistarticle</B></FONT></TD></TR><TR><TD PORT="id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>PK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="article_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>article_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="optionslist_id" COLSPAN="2" BGCOLOR="#2b3a52" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9"><B>optionslist_id</B></FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT <B>FK</B></FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="count" COLSPAN="2" BGCOLOR="#272e3d" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">count</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="sort" COLSPAN="2" BGCOLOR="#2a3242" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">sort</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">INT</FONT></TD></TR></TABLE></TD></TR><TR><TD PORT="mandated" COLSPAN="2" BGCOLOR="#272e3d" BORDER="1" CELLPADDING="0"><TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0" FIXEDSIZE="FALSE"><TR><TD ALIGN="LEFT" CELLPADDING="4"><FONT COLOR="#d8dee9">mandated</FONT></TD><TD ALIGN="RIGHT" CELLPADDING="4"><FONT COLOR="#8b95a7" POINT-SIZE="9">BIT</FONT></TD></TR></TABLE></TD></TR></TABLE>>];
@@ -133,9 +133,9 @@ digraph schema {
price:tax_id:w -> tax:in3:n [color="#56c8c8", fontcolor="#56c8c8", tooltip="FK_price_tax", constraint=false, weight=1]; price:tax_id:w -> tax:in3:n [color="#56c8c8", fontcolor="#56c8c8", tooltip="FK_price_tax", constraint=false, weight=1];
price:article_id:sw -> article:in2:n [color="#ff5f9e", fontcolor="#ff5f9e", tooltip="FK_price_article", weight=3]; price:article_id:sw -> article:in2:n [color="#ff5f9e", fontcolor="#ff5f9e", tooltip="FK_price_article", weight=3];
price:customergroup_id:e -> customergroup:in1:n [color="#ffb25a", fontcolor="#ffb25a", tooltip="FK_price_customergroup", constraint=false, weight=1]; price:customergroup_id:e -> customergroup:in1:n [color="#ffb25a", fontcolor="#ffb25a", tooltip="FK_price_customergroup", constraint=false, weight=1];
articlesupplier:article_id:se -> article:in7:n [color="#56d68a", fontcolor="#56d68a", tooltip="FK_articlesupplier_article", weight=3]; articlesupplier:article_id:sw -> article:in7:n [color="#56d68a", fontcolor="#56d68a", tooltip="FK_articlesupplier_article", weight=3];
articlesupplier:entity_id:w -> entity:in4:n [color="#66b3ff", fontcolor="#66b3ff", tooltip="FK_articlesupplier_entity", constraint=false, weight=1]; articlesupplier:entity_id:w -> entity:in4:n [color="#66b3ff", fontcolor="#66b3ff", tooltip="FK_articlesupplier_entity", constraint=false, weight=1];
articlesupplier:price_id:w -> price:in0:n [color="#c79bff", fontcolor="#c79bff", tooltip="FK_articlesupplier_price", constraint=false, weight=1]; articlesupplier:price_id:e -> price:in0:n [color="#c79bff", fontcolor="#c79bff", tooltip="FK_articlesupplier_price", constraint=false, weight=1];
manifest:company_id:e -> company:in1:n [color="#ff6b6b", fontcolor="#ff6b6b", tooltip="FK_manifest_company", weight=3]; manifest:company_id:e -> company:in1:n [color="#ff6b6b", fontcolor="#ff6b6b", tooltip="FK_manifest_company", weight=3];
manifest:entity_id:e -> entity:in0:n [color="#6bdf9a", fontcolor="#6bdf9a", tooltip="FK_manifest_entity", constraint=false, weight=1]; manifest:entity_id:e -> entity:in0:n [color="#6bdf9a", fontcolor="#6bdf9a", tooltip="FK_manifest_entity", constraint=false, weight=1];
manifestarticle:manifest_id:ne -> manifest:in0:n [color="#5aa7ff", fontcolor="#5aa7ff", tooltip="FK_manifestarticle_manifest", weight=3]; manifestarticle:manifest_id:ne -> manifest:in0:n [color="#5aa7ff", fontcolor="#5aa7ff", tooltip="FK_manifestarticle_manifest", weight=3];

View File

@@ -4,11 +4,11 @@
<!-- Generated by graphviz version 16.1.0 (0) <!-- Generated by graphviz version 16.1.0 (0)
--> -->
<!-- Title: schema Pages: 1 --> <!-- Title: schema Pages: 1 -->
<svg width="5281pt" height="1789pt" <svg width="5281pt" height="1785pt"
viewBox="0.00 0.00 5281.00 1789.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="background-color:#1e2430;"> viewBox="0.00 0.00 5281.00 1785.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="background-color:#1e2430;">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(36 1753.03)"> <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(36 1749.49)">
<title>schema</title> <title>schema</title>
<polygon fill="#1e2430" stroke="none" points="-36,36 -36,-1753.03 5245.27,-1753.03 5245.27,36 -36,36"/> <polygon fill="#1e2430" stroke="none" points="-36,36 -36,-1749.49 5245.27,-1749.49 5245.27,36 -36,36"/>
<g id="clust1" class="cluster"> <g id="clust1" class="cluster">
<title>cluster_identity</title> <title>cluster_identity</title>
<path fill="#202a3a" stroke="#3f4c5f" d="M670,-196.8C670,-196.8 1976,-196.8 1976,-196.8 1982,-196.8 1988,-202.8 1988,-208.8 1988,-208.8 1988,-1643.6 1988,-1643.6 1988,-1649.6 1982,-1655.6 1976,-1655.6 1976,-1655.6 670,-1655.6 670,-1655.6 664,-1655.6 658,-1649.6 658,-1643.6 658,-1643.6 658,-208.8 658,-208.8 658,-202.8 664,-196.8 670,-196.8"/> <path fill="#202a3a" stroke="#3f4c5f" d="M670,-196.8C670,-196.8 1976,-196.8 1976,-196.8 1982,-196.8 1988,-202.8 1988,-208.8 1988,-208.8 1988,-1643.6 1988,-1643.6 1988,-1649.6 1982,-1655.6 1976,-1655.6 1976,-1655.6 670,-1655.6 670,-1655.6 664,-1655.6 658,-1649.6 658,-1643.6 658,-1643.6 658,-208.8 658,-208.8 658,-202.8 664,-196.8 670,-196.8"/>
@@ -21,8 +21,8 @@
</g> </g>
<g id="clust3" class="cluster"> <g id="clust3" class="cluster">
<title>cluster_catalog</title> <title>cluster_catalog</title>
<path fill="#202a3a" stroke="#3f4c5f" d="M3090,-8C3090,-8 3894,-8 3894,-8 3900,-8 3906,-14 3906,-20 3906,-20 3906,-1590 3906,-1590 3906,-1596 3900,-1602 3894,-1602 3894,-1602 3090,-1602 3090,-1602 3084,-1602 3078,-1596 3078,-1590 3078,-1590 3078,-20 3078,-20 3078,-14 3084,-8 3090,-8"/> <path fill="#202a3a" stroke="#3f4c5f" d="M3090,-8C3090,-8 3894,-8 3894,-8 3900,-8 3906,-14 3906,-20 3906,-20 3906,-1603.4 3906,-1603.4 3906,-1609.4 3900,-1615.4 3894,-1615.4 3894,-1615.4 3090,-1615.4 3090,-1615.4 3084,-1615.4 3078,-1609.4 3078,-1603.4 3078,-1603.4 3078,-20 3078,-20 3078,-14 3084,-8 3090,-8"/>
<text xml:space="preserve" text-anchor="middle" x="3111.85" y="-1584.5" font-family="Helvetica,sans-Serif" font-size="15.00" fill="#e2e8f0">Catalog</text> <text xml:space="preserve" text-anchor="middle" x="3111.85" y="-1597.9" font-family="Helvetica,sans-Serif" font-size="15.00" fill="#e2e8f0">Catalog</text>
</g> </g>
<g id="clust4" class="cluster"> <g id="clust4" class="cluster">
<title>cluster_media</title> <title>cluster_media</title>
@@ -1242,58 +1242,62 @@
<!-- articlesupplier --> <!-- articlesupplier -->
<g id="node24" class="node"> <g id="node24" class="node">
<title>articlesupplier</title> <title>articlesupplier</title>
<polygon fill="#33415c" stroke="none" points="3542.46,-1533.6 3542.46,-1558 3661.54,-1558 3661.54,-1533.6 3542.46,-1533.6"/> <polygon fill="#33415c" stroke="none" points="3542.46,-1547 3542.46,-1571.4 3661.54,-1571.4 3661.54,-1547 3542.46,-1547"/>
<polygon fill="none" stroke="#3f4c5f" points="3542.46,-1533.6 3542.46,-1558 3661.54,-1558 3661.54,-1533.6 3542.46,-1533.6"/> <polygon fill="none" stroke="#3f4c5f" points="3542.46,-1547 3542.46,-1571.4 3661.54,-1571.4 3661.54,-1547 3542.46,-1547"/>
<text xml:space="preserve" text-anchor="start" x="3560.98" y="-1543.2" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00" fill="#e2e8f0">articlesupplier</text> <text xml:space="preserve" text-anchor="start" x="3560.98" y="-1556.6" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="12.00" fill="#e2e8f0">articlesupplier</text>
<polygon fill="#2b3a52" stroke="none" points="3542.46,-1506.8 3542.46,-1533.6 3661.54,-1533.6 3661.54,-1506.8 3542.46,-1506.8"/> <polygon fill="#2b3a52" stroke="none" points="3542.46,-1520.2 3542.46,-1547 3661.54,-1547 3661.54,-1520.2 3542.46,-1520.2"/>
<polygon fill="none" stroke="#3f4c5f" points="3542.46,-1506.8 3542.46,-1533.6 3661.54,-1533.6 3661.54,-1506.8 3542.46,-1506.8"/> <polygon fill="none" stroke="#3f4c5f" points="3542.46,-1520.2 3542.46,-1547 3661.54,-1547 3661.54,-1520.2 3542.46,-1520.2"/>
<text xml:space="preserve" text-anchor="start" x="3547.46" y="-1517" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="14.00" fill="#d8dee9">id</text> <text xml:space="preserve" text-anchor="start" x="3547.46" y="-1530.4" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="14.00" fill="#d8dee9">id</text>
<text xml:space="preserve" text-anchor="start" x="3627.04" y="-1518.5" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">INT </text> <text xml:space="preserve" text-anchor="start" x="3627.04" y="-1531.9" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">INT </text>
<text xml:space="preserve" text-anchor="start" x="3644.04" y="-1518.5" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="9.00" fill="#8b95a7">PK</text> <text xml:space="preserve" text-anchor="start" x="3644.04" y="-1531.9" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="9.00" fill="#8b95a7">PK</text>
<polygon fill="#2b3a52" stroke="none" points="3542.46,-1480 3542.46,-1506.8 3661.54,-1506.8 3661.54,-1480 3542.46,-1480"/> <polygon fill="#2b3a52" stroke="none" points="3542.46,-1493.4 3542.46,-1520.2 3661.54,-1520.2 3661.54,-1493.4 3542.46,-1493.4"/>
<polygon fill="none" stroke="#3f4c5f" points="3542.46,-1480 3542.46,-1506.8 3661.54,-1506.8 3661.54,-1480 3542.46,-1480"/> <polygon fill="none" stroke="#3f4c5f" points="3542.46,-1493.4 3542.46,-1520.2 3661.54,-1520.2 3661.54,-1493.4 3542.46,-1493.4"/>
<text xml:space="preserve" text-anchor="start" x="3547.46" y="-1490.2" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="14.00" fill="#d8dee9">entity_id</text> <text xml:space="preserve" text-anchor="start" x="3547.46" y="-1503.6" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="14.00" fill="#d8dee9">entity_id</text>
<text xml:space="preserve" text-anchor="start" x="3627.55" y="-1491.7" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">INT </text> <text xml:space="preserve" text-anchor="start" x="3627.55" y="-1505.1" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">INT </text>
<text xml:space="preserve" text-anchor="start" x="3644.55" y="-1491.7" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="9.00" fill="#8b95a7">FK</text> <text xml:space="preserve" text-anchor="start" x="3644.55" y="-1505.1" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="9.00" fill="#8b95a7">FK</text>
<polygon fill="#2b3a52" stroke="none" points="3542.46,-1453.2 3542.46,-1480 3661.54,-1480 3661.54,-1453.2 3542.46,-1453.2"/> <polygon fill="#2b3a52" stroke="none" points="3542.46,-1466.6 3542.46,-1493.4 3661.54,-1493.4 3661.54,-1466.6 3542.46,-1466.6"/>
<polygon fill="none" stroke="#3f4c5f" points="3542.46,-1453.2 3542.46,-1480 3661.54,-1480 3661.54,-1453.2 3542.46,-1453.2"/> <polygon fill="none" stroke="#3f4c5f" points="3542.46,-1466.6 3542.46,-1493.4 3661.54,-1493.4 3661.54,-1466.6 3542.46,-1466.6"/>
<text xml:space="preserve" text-anchor="start" x="3547.46" y="-1463.4" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="14.00" fill="#d8dee9">price_id</text> <text xml:space="preserve" text-anchor="start" x="3547.46" y="-1476.8" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="14.00" fill="#d8dee9">price_id</text>
<text xml:space="preserve" text-anchor="start" x="3601.15" y="-1463.4" font-family="Helvetica,sans-Serif" font-size="14.00" fill="#d8dee9">?</text> <text xml:space="preserve" text-anchor="start" x="3601.15" y="-1476.8" font-family="Helvetica,sans-Serif" font-size="14.00" fill="#d8dee9">?</text>
<text xml:space="preserve" text-anchor="start" x="3627.55" y="-1464.9" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">INT </text> <text xml:space="preserve" text-anchor="start" x="3627.55" y="-1478.3" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">INT </text>
<text xml:space="preserve" text-anchor="start" x="3644.55" y="-1464.9" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="9.00" fill="#8b95a7">FK</text> <text xml:space="preserve" text-anchor="start" x="3644.55" y="-1478.3" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="9.00" fill="#8b95a7">FK</text>
<polygon fill="#2b3a52" stroke="none" points="3542.46,-1426.4 3542.46,-1453.2 3661.54,-1453.2 3661.54,-1426.4 3542.46,-1426.4"/> <polygon fill="#2b3a52" stroke="none" points="3542.46,-1439.8 3542.46,-1466.6 3661.54,-1466.6 3661.54,-1439.8 3542.46,-1439.8"/>
<polygon fill="none" stroke="#3f4c5f" points="3542.46,-1426.4 3542.46,-1453.2 3661.54,-1453.2 3661.54,-1426.4 3542.46,-1426.4"/> <polygon fill="none" stroke="#3f4c5f" points="3542.46,-1439.8 3542.46,-1466.6 3661.54,-1466.6 3661.54,-1439.8 3542.46,-1439.8"/>
<text xml:space="preserve" text-anchor="start" x="3547.46" y="-1436.6" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="14.00" fill="#d8dee9">article_id</text> <text xml:space="preserve" text-anchor="start" x="3547.46" y="-1450" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="14.00" fill="#d8dee9">article_id</text>
<text xml:space="preserve" text-anchor="start" x="3627.55" y="-1438.1" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">INT </text> <text xml:space="preserve" text-anchor="start" x="3627.55" y="-1451.5" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">INT </text>
<text xml:space="preserve" text-anchor="start" x="3644.55" y="-1438.1" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="9.00" fill="#8b95a7">FK</text> <text xml:space="preserve" text-anchor="start" x="3644.55" y="-1451.5" font-family="Helvetica,sans-Serif" font-weight="bold" font-size="9.00" fill="#8b95a7">FK</text>
<polygon fill="#2a3242" stroke="none" points="3542.46,-1399.6 3542.46,-1426.4 3661.54,-1426.4 3661.54,-1399.6 3542.46,-1399.6"/> <polygon fill="#2a3242" stroke="none" points="3542.46,-1413 3542.46,-1439.8 3661.54,-1439.8 3661.54,-1413 3542.46,-1413"/>
<polygon fill="none" stroke="#3f4c5f" points="3542.46,-1399.6 3542.46,-1426.4 3661.54,-1426.4 3661.54,-1399.6 3542.46,-1399.6"/> <polygon fill="none" stroke="#3f4c5f" points="3542.46,-1413 3542.46,-1439.8 3661.54,-1439.8 3661.54,-1413 3542.46,-1413"/>
<text xml:space="preserve" text-anchor="start" x="3547.46" y="-1407.4" font-family="Helvetica,sans-Serif" font-size="14.00" fill="#d8dee9">sku?</text> <text xml:space="preserve" text-anchor="start" x="3547.46" y="-1420.8" font-family="Helvetica,sans-Serif" font-size="14.00" fill="#d8dee9">sku?</text>
<text xml:space="preserve" text-anchor="start" x="3585.03" y="-1409.4" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">NVARCHAR(100)</text> <text xml:space="preserve" text-anchor="start" x="3585.03" y="-1422.8" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">NVARCHAR(100)</text>
<polygon fill="#272e3d" stroke="none" points="3542.46,-1372.8 3542.46,-1399.6 3661.54,-1399.6 3661.54,-1372.8 3542.46,-1372.8"/> <polygon fill="#272e3d" stroke="none" points="3542.46,-1386.2 3542.46,-1413 3661.54,-1413 3661.54,-1386.2 3542.46,-1386.2"/>
<polygon fill="none" stroke="#3f4c5f" points="3542.46,-1372.8 3542.46,-1399.6 3661.54,-1399.6 3661.54,-1372.8 3542.46,-1372.8"/> <polygon fill="none" stroke="#3f4c5f" points="3542.46,-1386.2 3542.46,-1413 3661.54,-1413 3661.54,-1386.2 3542.46,-1386.2"/>
<text xml:space="preserve" text-anchor="start" x="3547.46" y="-1380.6" font-family="Helvetica,sans-Serif" font-size="14.00" fill="#d8dee9">stock?</text> <text xml:space="preserve" text-anchor="start" x="3547.46" y="-1394" font-family="Helvetica,sans-Serif" font-size="14.00" fill="#d8dee9">stock?</text>
<text xml:space="preserve" text-anchor="start" x="3627.54" y="-1382.6" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">FLOAT</text> <text xml:space="preserve" text-anchor="start" x="3627.54" y="-1396" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">FLOAT</text>
<polygon fill="#2a3242" stroke="none" points="3542.46,-1346 3542.46,-1372.8 3661.54,-1372.8 3661.54,-1346 3542.46,-1346"/> <polygon fill="#2a3242" stroke="none" points="3542.46,-1359.4 3542.46,-1386.2 3661.54,-1386.2 3661.54,-1359.4 3542.46,-1359.4"/>
<polygon fill="none" stroke="#3f4c5f" points="3542.46,-1346 3542.46,-1372.8 3661.54,-1372.8 3661.54,-1346 3542.46,-1346"/> <polygon fill="none" stroke="#3f4c5f" points="3542.46,-1359.4 3542.46,-1386.2 3661.54,-1386.2 3661.54,-1359.4 3542.46,-1359.4"/>
<text xml:space="preserve" text-anchor="start" x="3547.46" y="-1353.8" font-family="Helvetica,sans-Serif" font-size="14.00" fill="#d8dee9">pu</text> <text xml:space="preserve" text-anchor="start" x="3547.46" y="-1367.2" font-family="Helvetica,sans-Serif" font-size="14.00" fill="#d8dee9">pu</text>
<text xml:space="preserve" text-anchor="start" x="3627.54" y="-1355.8" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">FLOAT</text> <text xml:space="preserve" text-anchor="start" x="3627.54" y="-1369.2" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">FLOAT</text>
<polygon fill="#272e3d" stroke="none" points="3542.46,-1332.6 3542.46,-1359.4 3661.54,-1359.4 3661.54,-1332.6 3542.46,-1332.6"/>
<polygon fill="none" stroke="#3f4c5f" points="3542.46,-1332.6 3542.46,-1359.4 3661.54,-1359.4 3661.54,-1332.6 3542.46,-1332.6"/>
<text xml:space="preserve" text-anchor="start" x="3547.46" y="-1340.4" font-family="Helvetica,sans-Serif" font-size="14.00" fill="#d8dee9">sort</text>
<text xml:space="preserve" text-anchor="start" x="3642.05" y="-1342.4" font-family="Helvetica,sans-Serif" font-size="9.00" fill="#8b95a7">INT</text>
</g> </g>
<!-- articlesupplier&#45;&gt;entity --> <!-- articlesupplier&#45;&gt;entity -->
<g id="edge47" class="edge"> <g id="edge47" class="edge">
<title>articlesupplier:w&#45;&gt;entity:n</title> <title>articlesupplier:w&#45;&gt;entity:n</title>
<g id="a_edge47"><a xlink:title="FK_articlesupplier_entity"> <g id="a_edge47"><a xlink:title="FK_articlesupplier_entity">
<path fill="none" stroke="#66b3ff" stroke-width="1.4" d="M3541.46,-1493.4C3447.63,-1493.4 3570.91,-1347.85 3500,-1286.4 3389.92,-1191 2336.31,-1224.59 2191,-1214.4 1971.42,-1198.99 1211.53,-1348.01 1190.79,-1137.94"/> <path fill="none" stroke="#66b3ff" stroke-width="1.4" d="M3541.46,-1506.8C3441.78,-1506.8 3574.94,-1352.12 3500,-1286.4 3390.48,-1190.36 2336.31,-1224.59 2191,-1214.4 1971.42,-1198.99 1211.53,-1348.01 1190.79,-1137.94"/>
<polygon fill="#66b3ff" stroke="#66b3ff" stroke-width="1.4" points="1193.25,-1137.99 1190.46,-1131.12 1188.35,-1138.23 1193.25,-1137.99"/> <polygon fill="#66b3ff" stroke="#66b3ff" stroke-width="1.4" points="1193.25,-1137.99 1190.46,-1131.12 1188.35,-1138.23 1193.25,-1137.99"/>
</a> </a>
</g> </g>
</g> </g>
<!-- articlesupplier&#45;&gt;article --> <!-- articlesupplier&#45;&gt;article -->
<g id="edge46" class="edge"> <g id="edge46" class="edge">
<title>articlesupplier:se&#45;&gt;article:n</title> <title>articlesupplier:sw&#45;&gt;article:n</title>
<g id="a_edge46"><a xlink:title="FK_articlesupplier_article"> <g id="a_edge46"><a xlink:title="FK_articlesupplier_article">
<path fill="none" stroke="#56d68a" stroke-width="1.4" d="M3662.54,-1426.4C3689.07,-1399.87 3680.62,-1374.3 3661.54,-1342 3602.42,-1241.86 3436.83,-1324.25 3428.14,-1218.42"/> <path fill="none" stroke="#56d68a" stroke-width="1.4" d="M3541.46,-1439.8C3491.52,-1389.86 3534.39,-1348.08 3500,-1286.4 3478.76,-1248.3 3434.6,-1255.04 3428.49,-1218.48"/>
<polygon fill="#56d68a" stroke="#56d68a" stroke-width="1.4" points="3430.6,-1218.42 3427.87,-1211.52 3425.7,-1218.61 3430.6,-1218.42"/> <polygon fill="#56d68a" stroke="#56d68a" stroke-width="1.4" points="3430.94,-1218.3 3427.95,-1211.51 3426.05,-1218.68 3430.94,-1218.3"/>
</a> </a>
</g> </g>
</g> </g>
@@ -1335,9 +1339,9 @@
</g> </g>
<!-- articlesupplier&#45;&gt;price --> <!-- articlesupplier&#45;&gt;price -->
<g id="edge48" class="edge"> <g id="edge48" class="edge">
<title>articlesupplier:w&#45;&gt;price:n</title> <title>articlesupplier:e&#45;&gt;price:n</title>
<g id="a_edge48"><a xlink:title="FK_articlesupplier_price"> <g id="a_edge48"><a xlink:title="FK_articlesupplier_price">
<path fill="none" stroke="#c79bff" stroke-width="1.4" d="M3541.46,-1466.6C3454.59,-1466.6 3540.52,-1580.76 3500,-1657.6 3489.73,-1677.07 3486.21,-1684.89 3466,-1693.6 3390.29,-1726.23 3171.95,-1723.19 3095,-1693.6 3006.22,-1659.46 2935.54,-1644.71 2931.21,-1554.56"/> <path fill="none" stroke="#c79bff" stroke-width="1.4" d="M3662.54,-1480C3704.95,-1480 3681.72,-1538.66 3660.54,-1575.4 3610.02,-1663.05 3563.43,-1666.32 3466,-1693.6 3386.61,-1715.83 3171.95,-1723.19 3095,-1693.6 3006.22,-1659.46 2935.54,-1644.71 2931.21,-1554.56"/>
<polygon fill="#c79bff" stroke="#c79bff" stroke-width="1.4" points="2933.66,-1554.66 2931.05,-1547.72 2928.76,-1554.77 2933.66,-1554.66"/> <polygon fill="#c79bff" stroke="#c79bff" stroke-width="1.4" points="2933.66,-1554.66 2931.05,-1547.72 2928.76,-1554.77 2933.66,-1554.66"/>
</a> </a>
</g> </g>

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 201 KiB

View File

@@ -69,6 +69,7 @@ import articlesupplierListByArticleSku from './store/articlesupplier/listByArtic
import articlesupplierCreate from './store/articlesupplier/create.js'; import articlesupplierCreate from './store/articlesupplier/create.js';
import articlesupplierUpdate from './store/articlesupplier/update.js'; import articlesupplierUpdate from './store/articlesupplier/update.js';
import articlesupplierDelete from './store/articlesupplier/delete.js'; import articlesupplierDelete from './store/articlesupplier/delete.js';
import articlesupplierOrder from './store/articlesupplier/order.js';
import deliveryList from './store/delivery/list.js'; import deliveryList from './store/delivery/list.js';
import deliveryGetById from './store/delivery/getById.js'; import deliveryGetById from './store/delivery/getById.js';
import deliveryCreate from './store/delivery/create.js'; import deliveryCreate from './store/delivery/create.js';
@@ -245,6 +246,7 @@ export default class LibDashStore {
listByArticleSku: articlesupplierListByArticleSku(pool), listByArticleSku: articlesupplierListByArticleSku(pool),
create: articlesupplierCreate(pool), create: articlesupplierCreate(pool),
update: articlesupplierUpdate(pool), update: articlesupplierUpdate(pool),
order: articlesupplierOrder(pool),
delete: articlesupplierDelete(pool), delete: articlesupplierDelete(pool),
}; };

View File

@@ -539,10 +539,12 @@ BEGIN
sku NVARCHAR(100) NULL, sku NVARCHAR(100) NULL,
stock FLOAT NULL, stock FLOAT NULL,
pu FLOAT NOT NULL CONSTRAINT DF_articlesupplier_pu DEFAULT 1, pu FLOAT NOT NULL CONSTRAINT DF_articlesupplier_pu DEFAULT 1,
sort INT NOT NULL CONSTRAINT DF_articlesupplier_sort DEFAULT 0,
CONSTRAINT FK_articlesupplier_article FOREIGN KEY (article_id) REFERENCES article(id) ON DELETE CASCADE, CONSTRAINT FK_articlesupplier_article FOREIGN KEY (article_id) REFERENCES article(id) ON DELETE CASCADE,
CONSTRAINT FK_articlesupplier_entity FOREIGN KEY (entity_id) REFERENCES entity(id) ON DELETE CASCADE, CONSTRAINT FK_articlesupplier_entity FOREIGN KEY (entity_id) REFERENCES entity(id) ON DELETE CASCADE,
CONSTRAINT FK_articlesupplier_price FOREIGN KEY (price_id) REFERENCES price(id) ON DELETE SET NULL, CONSTRAINT FK_articlesupplier_price FOREIGN KEY (price_id) REFERENCES price(id) ON DELETE NO ACTION,
CONSTRAINT UQ_articlesupplier_article_entity UNIQUE (article_id, entity_id) CONSTRAINT UQ_articlesupplier_article_entity UNIQUE (article_id, entity_id),
CONSTRAINT UQ_articlesupplier_article_sort UNIQUE (article_id, sort)
); );
CREATE INDEX IX_articlesupplier_article_entity CREATE INDEX IX_articlesupplier_article_entity

View File

@@ -471,6 +471,7 @@ SELECT
asup.sku, asup.sku,
asup.pu, asup.pu,
asup.stock, asup.stock,
asup.sort,
asup.price_id AS priceId, asup.price_id AS priceId,
p.net AS [price.net], p.net AS [price.net],
p.tax_id AS [price.taxId], p.tax_id AS [price.taxId],
@@ -480,7 +481,7 @@ SELECT
LEFT JOIN price p ON p.id = asup.price_id LEFT JOIN price p ON p.id = asup.price_id
LEFT JOIN tax t ON t.id = p.tax_id LEFT JOIN tax t ON t.id = p.tax_id
WHERE asup.article_id = a.id WHERE asup.article_id = a.id
ORDER BY e.name, asup.id ORDER BY asup.sort ASC, asup.id ASC
FOR JSON PATH FOR JSON PATH
) AS suppliersJson ) AS suppliersJson
FROM article a FROM article a

View File

@@ -7,6 +7,7 @@ SELECT
asup.sku, asup.sku,
asup.pu, asup.pu,
asup.stock, asup.stock,
asup.sort,
asup.price_id AS priceId, asup.price_id AS priceId,
p.net AS priceNet, p.net AS priceNet,
p.tax_id AS priceTaxId, p.tax_id AS priceTaxId,
@@ -18,7 +19,7 @@ LEFT JOIN price p ON p.id = asup.price_id
LEFT JOIN tax t ON t.id = p.tax_id LEFT JOIN tax t ON t.id = p.tax_id
WHERE asup.article_id = @articleId WHERE asup.article_id = @articleId
AND cg.company_id = @companyId AND cg.company_id = @companyId
ORDER BY e.name, asup.id; ORDER BY asup.sort ASC, asup.id ASC;
`; `;
export const GET_BY_ID_AND_ARTICLE_ID = ` export const GET_BY_ID_AND_ARTICLE_ID = `
@@ -30,6 +31,7 @@ SELECT
asup.sku, asup.sku,
asup.pu, asup.pu,
asup.stock, asup.stock,
asup.sort,
asup.price_id AS priceId, asup.price_id AS priceId,
p.net AS priceNet, p.net AS priceNet,
p.tax_id AS priceTaxId, p.tax_id AS priceTaxId,
@@ -50,10 +52,16 @@ FROM articlesupplier
WHERE article_id = @articleId AND entity_id = @entityId; WHERE article_id = @articleId AND entity_id = @entityId;
`; `;
export const GET_NEXT_SORT = `
SELECT ISNULL(MAX(sort), -1) + 1 AS sort
FROM articlesupplier
WHERE article_id = @articleId;
`;
export const CREATE = ` export const CREATE = `
INSERT INTO articlesupplier (article_id, entity_id, price_id, sku, stock, pu) INSERT INTO articlesupplier (article_id, entity_id, price_id, sku, stock, pu, sort)
OUTPUT INSERTED.id OUTPUT INSERTED.id
VALUES (@articleId, @entityId, @priceId, @sku, @stock, @pu); VALUES (@articleId, @entityId, @priceId, @sku, @stock, @pu, @sort);
`; `;
export const UPDATE = ` export const UPDATE = `
@@ -62,7 +70,8 @@ SET
sku = @sku, sku = @sku,
stock = @stock, stock = @stock,
pu = @pu, pu = @pu,
price_id = @priceId price_id = @priceId,
sort = @sort
WHERE id = @id AND article_id = @articleId; WHERE id = @id AND article_id = @articleId;
`; `;
@@ -71,6 +80,25 @@ DELETE FROM articlesupplier
WHERE id = @id AND article_id = @articleId; WHERE id = @id AND article_id = @articleId;
`; `;
export const LIST_IDS_BY_ARTICLE = `
SELECT id
FROM articlesupplier
WHERE article_id = @articleId
ORDER BY sort ASC, id ASC;
`;
export const SET_TEMP_SORTS = `
UPDATE articlesupplier
SET sort = -id
WHERE article_id = @articleId;
`;
export const UPDATE_SORT = `
UPDATE articlesupplier
SET sort = @sort
WHERE id = @id AND article_id = @articleId;
`;
export const UPDATE_PRICE = ` export const UPDATE_PRICE = `
UPDATE price UPDATE price
SET SET

View File

@@ -13,7 +13,7 @@ export default function getBySku(pool) {
* *
* @param {number} googleAuthId - The id of the Google auth user. * @param {number} googleAuthId - The id of the Google auth user.
* @param {string} sku - The article SKU. * @param {string} sku - The article SKU.
* @returns {Promise<{article: {id: number, sku: string, name: string, slug: string, unitamount: number|null, weight: number|null, unit: {si: string|null, basesi: string|null, basesifactor: number|null, symbol: string|null, name: string|null}, brand: {name: string, thumbW: number, thumbH: number, thumbHash: string}|null, categoryIds: number[], photos: Array<{sort: number, fullHash: string, fullW: number, fullH: number, fullSize: number, thumbW: number, thumbH: number, thumbHash: string}>, eans: string[], prices: Array<{minmultiplier: number, net: number, taxRate: number, customergroupId: number}>, suppliers: Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>, optionsCount: number, articleListCount: number, childCount: number, fatherArticleId: number|null, fatherSku: string|null}}>} The full article detail. * @returns {Promise<{article: {id: number, sku: string, name: string, slug: string, unitamount: number|null, weight: number|null, unit: {si: string|null, basesi: string|null, basesifactor: number|null, symbol: string|null, name: string|null}, brand: {name: string, thumbW: number, thumbH: number, thumbHash: string}|null, categoryIds: number[], photos: Array<{sort: number, fullHash: string, fullW: number, fullH: number, fullSize: number, thumbW: number, thumbH: number, thumbHash: string}>, eans: string[], prices: Array<{minmultiplier: number, net: number, taxRate: number, customergroupId: number}>, suppliers: Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>, optionsCount: number, articleListCount: number, childCount: number, fatherArticleId: number|null, fatherSku: string|null}}>} The full article detail.
* @throws {Error} If the article is not found or the user is not authorized. * @throws {Error} If the article is not found or the user is not authorized.
* *
* @example * @example
@@ -80,6 +80,7 @@ export default function getBySku(pool) {
sku: s.sku ?? null, sku: s.sku ?? null,
pu: s.pu, pu: s.pu,
stock: s.stock ?? null, stock: s.stock ?? null,
sort: s.sort,
priceId: s.priceId ?? null, priceId: s.priceId ?? null,
price: s.priceId != null && s.price?.net != null ? s.price : null, price: s.priceId != null && s.price?.net != null ? s.price : null,
})), })),

View File

@@ -2,6 +2,7 @@ import {
CHECK_EXISTS, CHECK_EXISTS,
CREATE as CREATE_ARTICLE_SUPPLIER, CREATE as CREATE_ARTICLE_SUPPLIER,
GET_BY_ID_AND_ARTICLE_ID, GET_BY_ID_AND_ARTICLE_ID,
GET_NEXT_SORT,
} from '../../sql/articlesupplier.js'; } from '../../sql/articlesupplier.js';
import { CREATE as CREATE_PRICE } from '../../sql/price.js'; import { CREATE as CREATE_PRICE } from '../../sql/price.js';
import request from '../request.js'; import request from '../request.js';
@@ -29,10 +30,11 @@ export default function create(pool) {
* @param {string} [input.sku] - The supplier's item number/SKU. * @param {string} [input.sku] - The supplier's item number/SKU.
* @param {number} [input.pu] - Packaging unit (defaults to 1). * @param {number} [input.pu] - Packaging unit (defaults to 1).
* @param {number|null} [input.stock] - Current stock at the supplier. * @param {number|null} [input.stock] - Current stock at the supplier.
* @param {number} [input.sort] - Display sort order (defaults to next sort).
* @param {number|null} [input.netPrice] - Net purchase price. * @param {number|null} [input.netPrice] - Net purchase price.
* @param {number} [input.taxId] - The tax id for the purchase price. * @param {number} [input.taxId] - The tax id for the purchase price.
* @param {number} [input.taxRate] - The tax rate in percent (used if taxId is not provided). * @param {number} [input.taxRate] - The tax rate in percent (used if taxId is not provided).
* @returns {Promise<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>} The created assignment. * @returns {Promise<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>} The created assignment.
* @throws {Error} If input is invalid, article or supplier is not found, or supplier is already assigned. * @throws {Error} If input is invalid, article or supplier is not found, or supplier is already assigned.
* *
* @example * @example
@@ -42,7 +44,7 @@ export default function create(pool) {
* pu: 1, * pu: 1,
* netPrice: 4.20, * netPrice: 4.20,
* }); * });
* // => { id, articleId, entityId, supplierName, sku, pu, stock, priceId, price } * // => { id, articleId, entityId, supplierName, sku, pu, stock, sort, priceId, price }
*/ */
return async (googleAuthId, sku, input = {}) => { return async (googleAuthId, sku, input = {}) => {
const entityId = input.entityId; const entityId = input.entityId;
@@ -63,6 +65,12 @@ export default function create(pool) {
throw new Error('Invalid stock'); throw new Error('Invalid stock');
} }
if (input.sort !== undefined && input.sort !== null) {
if (!Number.isFinite(input.sort)) {
throw new Error('Invalid sort');
}
}
const netPrice = const netPrice =
input.netPrice === undefined || input.netPrice === null input.netPrice === undefined || input.netPrice === null
? null ? null
@@ -89,6 +97,14 @@ export default function create(pool) {
await tx.begin(); await tx.begin();
try { try {
let sort = input.sort;
if (sort === undefined || sort === null) {
const sortRes = await request(pool, tx)
.input('articleId', articleId)
.query(GET_NEXT_SORT);
sort = sortRes.recordset[0].sort;
}
let priceId = null; let priceId = null;
if (netPrice !== null) { if (netPrice !== null) {
@@ -130,6 +146,7 @@ export default function create(pool) {
.input('sku', supplierSku) .input('sku', supplierSku)
.input('stock', stock) .input('stock', stock)
.input('pu', pu) .input('pu', pu)
.input('sort', sort)
.query(CREATE_ARTICLE_SUPPLIER); .query(CREATE_ARTICLE_SUPPLIER);
const createdId = createdRes.recordset[0].id; const createdId = createdRes.recordset[0].id;

View File

@@ -17,6 +17,7 @@ export function shapeArticleSupplier(row) {
sku: row.sku ?? null, sku: row.sku ?? null,
pu: row.pu, pu: row.pu,
stock: row.stock ?? null, stock: row.stock ?? null,
sort: row.sort,
priceId: row.priceId ?? null, priceId: row.priceId ?? null,
price: price:
row.priceId != null && row.priceNet != null row.priceId != null && row.priceNet != null

View File

@@ -10,7 +10,7 @@ export default function listByArticleSku(pool) {
* *
* @param {number} googleAuthId - The id of the Google auth user. * @param {number} googleAuthId - The id of the Google auth user.
* @param {string} sku - The article SKU. * @param {string} sku - The article SKU.
* @returns {Promise<Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>>} The supplier assignments. * @returns {Promise<Array<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>>} The supplier assignments.
* @throws {Error} If the article is not found or the user is not authorized. * @throws {Error} If the article is not found or the user is not authorized.
* *
* @example * @example

View File

@@ -0,0 +1,84 @@
import {
LIST_IDS_BY_ARTICLE,
SET_TEMP_SORTS,
UPDATE_SORT,
} from '../../sql/articlesupplier.js';
import request from '../request.js';
import resolveArticleBySku from '../article/resolveArticleBySku.js';
export default function order(pool) {
const resolve = resolveArticleBySku(pool);
/**
* Reorders the supplier assignments of an article by its SKU.
*
* @param {number} googleAuthId - The id of the Google auth user.
* @param {string} sku - The article SKU.
* @param {object} input - The reorder input.
* @param {Array<number>} input.ids - The articlesupplier ids in their new order.
* @returns {Promise<{ids: Array<number>}>} The applied order.
* @throws {Error} If the order is invalid.
*
* @example
* const result = await store.articlesupplier.order(42, 'SKU-1', { ids: [12, 10, 15] });
* // => { ids: [12, 10, 15] }
*/
return async (googleAuthId, sku, { ids } = {}) => {
if (!Array.isArray(ids)) {
throw new Error('Invalid supplier order');
}
const { articleId } = await resolve(googleAuthId, sku);
const current = await pool
.request()
.input('articleId', articleId)
.query(LIST_IDS_BY_ARTICLE);
const existing = new Set(current.recordset.map((r) => r.id));
if (ids.length !== existing.size) {
throw new Error('Invalid supplier order');
}
const seen = new Set();
for (const id of ids) {
if (!Number.isFinite(id) || !existing.has(id) || seen.has(id)) {
throw new Error('Invalid supplier order');
}
seen.add(id);
}
const tx = pool.transaction();
await tx.begin();
try {
await request(pool, tx)
.input('articleId', articleId)
.query(SET_TEMP_SORTS);
for (let sort = 0; sort < ids.length; sort++) {
const updateRes = await request(pool, tx)
.input('id', ids[sort])
.input('articleId', articleId)
.input('sort', sort)
.query(UPDATE_SORT);
if (!updateRes.rowsAffected[0]) {
throw new Error('Invalid supplier order');
}
}
await tx.commit();
return { ids };
} catch (err) {
try {
await tx.rollback();
} catch {
// ignore
}
throw err;
}
};
}

View File

@@ -29,10 +29,11 @@ export default function update(pool) {
* @param {string|null} [patch.sku] - The supplier's item number/SKU. * @param {string|null} [patch.sku] - The supplier's item number/SKU.
* @param {number} [patch.pu] - Packaging unit (> 0). * @param {number} [patch.pu] - Packaging unit (> 0).
* @param {number|null} [patch.stock] - Current stock at the supplier. * @param {number|null} [patch.stock] - Current stock at the supplier.
* @param {number} [patch.sort] - Display sort order.
* @param {number|null} [patch.netPrice] - Net purchase price. * @param {number|null} [patch.netPrice] - Net purchase price.
* @param {number} [patch.taxId] - The tax id for the purchase price. * @param {number} [patch.taxId] - The tax id for the purchase price.
* @param {number} [patch.taxRate] - The tax rate in percent. * @param {number} [patch.taxRate] - The tax rate in percent.
* @returns {Promise<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>} The updated assignment. * @returns {Promise<{id: number, articleId: number, entityId: number, supplierName: string|null, sku: string|null, pu: number, stock: number|null, sort: number, priceId: number|null, price: {net: number, taxId: number, taxRate?: number}|null}>} The updated assignment.
* @throws {Error} If input is invalid or supplier assignment is not found. * @throws {Error} If input is invalid or supplier assignment is not found.
* *
* @example * @example
@@ -41,7 +42,7 @@ export default function update(pool) {
* pu: 6, * pu: 6,
* netPrice: 22.50, * netPrice: 22.50,
* }); * });
* // => { id, articleId, entityId, supplierName, sku, pu, stock, priceId, price } * // => { id, articleId, entityId, supplierName, sku, pu, stock, sort, priceId, price }
*/ */
return async (googleAuthId, sku, id, patch = {}) => { return async (googleAuthId, sku, id, patch = {}) => {
if (id == null || !Number.isFinite(id)) { if (id == null || !Number.isFinite(id)) {
@@ -60,6 +61,12 @@ export default function update(pool) {
} }
} }
if (patch.sort !== undefined && patch.sort !== null) {
if (!Number.isFinite(patch.sort)) {
throw new Error('Invalid sort');
}
}
if (patch.netPrice !== undefined && patch.netPrice !== null) { if (patch.netPrice !== undefined && patch.netPrice !== null) {
if (!Number.isFinite(patch.netPrice)) { if (!Number.isFinite(patch.netPrice)) {
throw new Error('Invalid price'); throw new Error('Invalid price');
@@ -98,6 +105,7 @@ export default function update(pool) {
.input('sku', existing.sku) .input('sku', existing.sku)
.input('stock', existing.stock) .input('stock', existing.stock)
.input('pu', existing.pu) .input('pu', existing.pu)
.input('sort', existing.sort)
.input('priceId', null) .input('priceId', null)
.query(UPDATE_ARTICLE_SUPPLIER); .query(UPDATE_ARTICLE_SUPPLIER);
@@ -168,6 +176,7 @@ export default function update(pool) {
: patch.stock : patch.stock
: existing.stock; : existing.stock;
const nextPu = patch.pu !== undefined ? patch.pu : existing.pu; const nextPu = patch.pu !== undefined ? patch.pu : existing.pu;
const nextSort = patch.sort !== undefined ? patch.sort : existing.sort;
await request(pool, tx) await request(pool, tx)
.input('id', id) .input('id', id)
@@ -175,6 +184,7 @@ export default function update(pool) {
.input('sku', nextSku) .input('sku', nextSku)
.input('stock', nextStock) .input('stock', nextStock)
.input('pu', nextPu) .input('pu', nextPu)
.input('sort', nextSort)
.input('priceId', priceId) .input('priceId', priceId)
.query(UPDATE_ARTICLE_SUPPLIER); .query(UPDATE_ARTICLE_SUPPLIER);