u
This commit is contained in:
@@ -14,16 +14,16 @@ Params: path values first, then `query:` and `body:` (`body?` = optional body).
|
|||||||
- `T3` = `{ article: T4 }`
|
- `T3` = `{ article: T4 }`
|
||||||
- `T4` = `{ id: int, sku: str, name: str, slug: str, desc: str|null, seo: str|null, track_stock: bool, unitamount: num|null, weight: num|null, unit: T39, brand: T37|null, categoryIds: int[], photos: T34[], eans: str[], prices: T46[], suppliers: T16[] }`
|
- `T4` = `{ id: int, sku: str, name: str, slug: str, desc: str|null, seo: str|null, track_stock: bool, unitamount: num|null, weight: num|null, unit: T39, brand: T37|null, categoryIds: int[], photos: T34[], eans: str[], prices: T46[], suppliers: T16[] }`
|
||||||
- `T5` = `{ delivery: T6 }`
|
- `T5` = `{ delivery: T6 }`
|
||||||
- `T6` = `{ id: int, number: str, type: str, supplierId: int|null, date: str, lines: T28[], files: T13[], externalNumber?: str|null, createdAt?: str, ledger?: T50 }`
|
- `T6` = `{ id: int, number: str, type: str, supplierId: int|null, date: str, lines: T28[], files: T14[], externalNumber?: str|null, createdAt?: str, ledger?: T50 }`
|
||||||
- `T7` = `{ id: int, number: str, type: str, date: str, lines: T28[], shippings: T36[], entityId?: int|null, externalNumber?: str|null, createdAt?: str|null, lineCount?: int, packageCount?: int }`
|
- `T7` = `{ id: int, number: str, type: str, date: str, lines: T28[], shippings: T36[], entityId?: int|null, externalNumber?: str|null, createdAt?: str|null, lineCount?: int, packageCount?: int }`
|
||||||
- `T8` = `{ name: str, path: str, totalSizeBytes: int, timestamp: str|null, manifest?: T9|null }`
|
- `T8` = `{ name: str, path: str, totalSizeBytes: int, timestamp: str|null, manifest?: T9|null }`
|
||||||
- `T9` = `{ id: str, timestamp: str, dateKey: str, monthKey: str, dbProvider: str, files: T17, totalSizeBytes: int, durationMs: int }`
|
- `T9` = `{ id: str, timestamp: str, dateKey: str, monthKey: str, dbProvider: str, files: T17, totalSizeBytes: int, durationMs: int }`
|
||||||
- `T10` = `{ labeltemplate: T11 }`
|
- `T10` = `{ quote: T11 }`
|
||||||
- `T11` = `{ id: int, name: str, width: num, height: num, dpi: int, type: str, content: T24, thumb?: str|null }`
|
- `T11` = `{ id: int, number: str, type: str, entityId: int|null, date: str, lines: T28[], createdAt?: str, positions?: int, grossTotal?: num, totalQuantity?: num, customerName?: str|null }`
|
||||||
- `T12` = `{ quote: T15 }`
|
- `T12` = `{ labeltemplate: T13 }`
|
||||||
- `T13` = `{ id: int, manifestId: int, fileId: int, sort: int, hash: str, mimetype: str, name: str, size: int, created?: str, modified?: str, thumbavif?: str|null, thumbx?: int|null, thumby?: int|null, meta?: { [k]: str }|null }`
|
- `T13` = `{ id: int, name: str, width: num, height: num, dpi: int, type: str, content: T24, thumb?: str|null }`
|
||||||
- `T14` = `{ id: int, name: str, pairingpin?: str|null, token?: str|null, pairedAt?: str|null, clientserial?: str|null, rootCategoryId?: int|null, syncRootArticles?: bool, lastseenAt?: str|null, updatedAt?: str|null, categoryIds?: int[] }`
|
- `T14` = `{ id: int, manifestId: int, fileId: int, sort: int, hash: str, mimetype: str, name: str, size: int, created?: str, modified?: str, thumbavif?: str|null, thumbx?: int|null, thumby?: int|null, meta?: { [k]: str }|null }`
|
||||||
- `T15` = `{ id: int, number: str, type: str, entityId: int|null, date: str, lines: T28[], createdAt?: str }`
|
- `T15` = `{ id: int, name: str, pairingpin?: str|null, token?: str|null, pairedAt?: str|null, clientserial?: str|null, rootCategoryId?: int|null, syncRootArticles?: bool, lastseenAt?: str|null, updatedAt?: str|null, categoryIds?: int[] }`
|
||||||
- `T16` = `{ id: int, articleId: int, entityId: int, pu: num, sort: int, supplierName?: str|null, sku?: str|null, stock?: num|null, priceId?: int|null, price?: T53|null }`
|
- `T16` = `{ id: int, articleId: int, entityId: int, pu: num, sort: int, supplierName?: str|null, sku?: str|null, stock?: num|null, priceId?: int|null, price?: T53|null }`
|
||||||
- `T17` = `{ vfs: T51, storage: T51, database: T44 }`
|
- `T17` = `{ vfs: T51, storage: T51, database: T44 }`
|
||||||
- `T18` = `{ id: int, entityId: int, addressType: str, firstName?: str|null, name?: str|null, street?: str|null, streetNumber?: str|null, zip?: str|null, city?: str|null, county?: str|null }`
|
- `T18` = `{ id: int, entityId: int, addressType: str, firstName?: str|null, name?: str|null, street?: str|null, streetNumber?: str|null, zip?: str|null, city?: str|null, county?: str|null }`
|
||||||
@@ -504,19 +504,19 @@ _none_
|
|||||||
- Returns: `200 { labeltemplates: { id: int, name: str, width: num, height: num, dpi: int, type: str, thumb?: str|null }[] }`
|
- Returns: `200 { labeltemplates: { id: int, name: str, width: num, height: num, dpi: int, type: str, thumb?: str|null }[] }`
|
||||||
#### Create label template — `POST /labeltemplate`
|
#### Create label template — `POST /labeltemplate`
|
||||||
- Params: `body: { name: str, width: num, height: num, dpi: int, type: str, content: T25 }`
|
- Params: `body: { name: str, width: num, height: num, dpi: int, type: str, content: T25 }`
|
||||||
- Returns: `201 T10`
|
- Returns: `201 T12`
|
||||||
#### Delete label template — `DELETE /labeltemplate/{id}`
|
#### Delete label template — `DELETE /labeltemplate/{id}`
|
||||||
- Params: `id: int`
|
- Params: `id: int`
|
||||||
- Returns: `204 void`
|
- Returns: `204 void`
|
||||||
#### Get label template by ID — `GET /labeltemplate/{id}`
|
#### Get label template by ID — `GET /labeltemplate/{id}`
|
||||||
- Params: `id: int`
|
- Params: `id: int`
|
||||||
- Returns: `200 T10`
|
- Returns: `200 T12`
|
||||||
#### Update label template (partial) — `PATCH /labeltemplate/{id}`
|
#### Update label template (partial) — `PATCH /labeltemplate/{id}`
|
||||||
- Params: `id: int, body: { name?: str, width?: num, height?: num, dpi?: int, type?: str, content?: T25 }`
|
- Params: `id: int, body: { name?: str, width?: num, height?: num, dpi?: int, type?: str, content?: T25 }`
|
||||||
- Returns: `200 T10`
|
- Returns: `200 T12`
|
||||||
#### Update label template — `PUT /labeltemplate/{id}`
|
#### Update label template — `PUT /labeltemplate/{id}`
|
||||||
- Params: `id: int, body: { name?: str, width?: num, height?: num, dpi?: int, type?: str, content?: T25 }`
|
- Params: `id: int, body: { name?: str, width?: num, height?: num, dpi?: int, type?: str, content?: T25 }`
|
||||||
- Returns: `200 T10`
|
- Returns: `200 T12`
|
||||||
|
|
||||||
### Section: /ledger
|
### Section: /ledger
|
||||||
|
|
||||||
@@ -657,16 +657,16 @@ _none_
|
|||||||
|
|
||||||
#### List POS terminals — `GET /posterminal`
|
#### List POS terminals — `GET /posterminal`
|
||||||
_none_
|
_none_
|
||||||
- Returns: `200 { posterminals: T14[] }`
|
- Returns: `200 { posterminals: T15[] }`
|
||||||
#### Create POS terminal — `PUT /posterminal`
|
#### Create POS terminal — `PUT /posterminal`
|
||||||
- Params: `body: { name: str, rootCategoryId?: int|null, syncRootArticles?: bool }`
|
- Params: `body: { name: str, rootCategoryId?: int|null, syncRootArticles?: bool }`
|
||||||
- Returns: `200 { posterminal: T14 }`
|
- Returns: `200 { posterminal: T15 }`
|
||||||
#### Delete POS terminal — `DELETE /posterminal/{id}`
|
#### Delete POS terminal — `DELETE /posterminal/{id}`
|
||||||
- Params: `id: int`
|
- Params: `id: int`
|
||||||
- Returns: `204 void`
|
- Returns: `204 void`
|
||||||
#### Update POS terminal — `PATCH /posterminal/{id}`
|
#### Update POS terminal — `PATCH /posterminal/{id}`
|
||||||
- Params: `id: int, body: { name?: str, rootCategoryId?: int|null, syncRootArticles?: bool, pairingpin?: str|null }`
|
- Params: `id: int, body: { name?: str, rootCategoryId?: int|null, syncRootArticles?: bool, pairingpin?: str|null }`
|
||||||
- Returns: `200 { posterminal: T14 }`
|
- Returns: `200 { posterminal: T15 }`
|
||||||
#### Disable all categories on terminal — `DELETE /posterminal/{id}/all`
|
#### Disable all categories on terminal — `DELETE /posterminal/{id}/all`
|
||||||
- Params: `id: int`
|
- Params: `id: int`
|
||||||
- Returns: `200 T55`
|
- Returns: `200 T55`
|
||||||
@@ -740,20 +740,20 @@ _none_
|
|||||||
### Section: /quote
|
### Section: /quote
|
||||||
|
|
||||||
#### List quotes — `GET /quote`
|
#### List quotes — `GET /quote`
|
||||||
_none_
|
- Params: `query: offset?: int, limit?: int, search?: str, seekMonths?: int`
|
||||||
- Returns: `200 { quotes: { id: int, number: str, type: str, entityId: int|null, date: str, createdAt?: str }[] }`
|
- Returns: `200 { quotes: T11[], total: int, unfilteredTotal: int, offset: int, limit: int }`
|
||||||
#### Create quote — `POST /quote`
|
#### Create quote — `POST /quote`
|
||||||
- Params: `body: { number: str, date: str, lines: T33[], entityId?: int|null }`
|
- Params: `body: { number: str, date: str, lines: T33[], entityId?: int|null }`
|
||||||
- Returns: `201 T12`
|
- Returns: `201 T10`
|
||||||
#### Delete quote — `DELETE /quote/{id}`
|
#### Delete quote — `DELETE /quote/{id}`
|
||||||
- Params: `id: int`
|
- Params: `id: int`
|
||||||
- Returns: `204 void`
|
- Returns: `204 void`
|
||||||
#### Get quote — `GET /quote/{id}`
|
#### Get quote — `GET /quote/{id}`
|
||||||
- Params: `id: int`
|
- Params: `id: int`
|
||||||
- Returns: `200 T12`
|
- Returns: `200 T10`
|
||||||
#### Update quote — `PATCH /quote/{id}`
|
#### Update quote — `PATCH /quote/{id}`
|
||||||
- Params: `id: int, body: { number?: str, date?: str, entityId?: int|null, lines?: T33[] }`
|
- Params: `id: int, body: { number?: str, date?: str, entityId?: int|null, lines?: T33[] }`
|
||||||
- Returns: `200 T12`
|
- Returns: `200 T10`
|
||||||
|
|
||||||
### Section: /serper
|
### Section: /serper
|
||||||
|
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ Params: path values first, then `query:` and `body:` (`body?` = optional body).
|
|||||||
- `T3` = `{ article: T4 }`
|
- `T3` = `{ article: T4 }`
|
||||||
- `T4` = `{ id: int, sku: str, name: str, slug: str, desc: str|null, seo: str|null, track_stock: bool, unitamount: num|null, weight: num|null, unit: T33, brand: T31|null, categoryIds: int[], photos: T28[], eans: str[], prices: T38[], suppliers: T13[] }`
|
- `T4` = `{ id: int, sku: str, name: str, slug: str, desc: str|null, seo: str|null, track_stock: bool, unitamount: num|null, weight: num|null, unit: T33, brand: T31|null, categoryIds: int[], photos: T28[], eans: str[], prices: T38[], suppliers: T13[] }`
|
||||||
- `T5` = `{ delivery: T6 }`
|
- `T5` = `{ delivery: T6 }`
|
||||||
- `T6` = `{ id: int, number: str, type: str, supplierId: int|null, date: str, lines: T22[], files: T11[], externalNumber?: str|null, createdAt?: str, ledger?: T42 }`
|
- `T6` = `{ id: int, number: str, type: str, supplierId: int|null, date: str, lines: T22[], files: T12[], externalNumber?: str|null, createdAt?: str, ledger?: T42 }`
|
||||||
- `T7` = `{ id: int, number: str, type: str, date: str, lines: T22[], shippings: T30[], entityId?: int|null, externalNumber?: str|null, createdAt?: str|null, lineCount?: int, packageCount?: int }`
|
- `T7` = `{ id: int, number: str, type: str, date: str, lines: T22[], shippings: T30[], entityId?: int|null, externalNumber?: str|null, createdAt?: str|null, lineCount?: int, packageCount?: int }`
|
||||||
- `T8` = `{ labeltemplate: T9 }`
|
- `T8` = `{ quote: T9 }`
|
||||||
- `T9` = `{ id: int, name: str, width: num, height: num, dpi: int, type: str, content: T18, thumb?: str|null }`
|
- `T9` = `{ id: int, number: str, type: str, entityId: int|null, date: str, lines: T22[], createdAt?: str, positions?: int, grossTotal?: num, totalQuantity?: num, customerName?: str|null }`
|
||||||
- `T10` = `{ quote: T12 }`
|
- `T10` = `{ labeltemplate: T11 }`
|
||||||
- `T11` = `{ id: int, manifestId: int, fileId: int, sort: int, hash: str, mimetype: str, name: str, size: int, created?: str, modified?: str, thumbavif?: str|null, thumbx?: int|null, thumby?: int|null, meta?: { [k]: str }|null }`
|
- `T11` = `{ id: int, name: str, width: num, height: num, dpi: int, type: str, content: T18, thumb?: str|null }`
|
||||||
- `T12` = `{ id: int, number: str, type: str, entityId: int|null, date: str, lines: T22[], createdAt?: str }`
|
- `T12` = `{ id: int, manifestId: int, fileId: int, sort: int, hash: str, mimetype: str, name: str, size: int, created?: str, modified?: str, thumbavif?: str|null, thumbx?: int|null, thumby?: int|null, meta?: { [k]: str }|null }`
|
||||||
- `T13` = `{ id: int, articleId: int, entityId: int, pu: num, sort: int, supplierName?: str|null, sku?: str|null, stock?: num|null, priceId?: int|null, price?: T44|null }`
|
- `T13` = `{ id: int, articleId: int, entityId: int, pu: num, sort: int, supplierName?: str|null, sku?: str|null, stock?: num|null, priceId?: int|null, price?: T44|null }`
|
||||||
- `T14` = `{ id: int, entityId: int, addressType: str, firstName?: str|null, name?: str|null, street?: str|null, streetNumber?: str|null, zip?: str|null, city?: str|null, county?: str|null }`
|
- `T14` = `{ id: int, entityId: int, addressType: str, firstName?: str|null, name?: str|null, street?: str|null, streetNumber?: str|null, zip?: str|null, city?: str|null, county?: str|null }`
|
||||||
- `T15` = `{ ledger: T16[] }`
|
- `T15` = `{ ledger: T16[] }`
|
||||||
@@ -380,19 +380,19 @@ _none_
|
|||||||
- Returns: `200 { labeltemplates: { id: int, name: str, width: num, height: num, dpi: int, type: str, thumb?: str|null }[] }`
|
- Returns: `200 { labeltemplates: { id: int, name: str, width: num, height: num, dpi: int, type: str, thumb?: str|null }[] }`
|
||||||
#### Create label template — `POST /labeltemplate`
|
#### Create label template — `POST /labeltemplate`
|
||||||
- Params: `body: { name: str, width: num, height: num, dpi: int, type: str, content: T19 }`
|
- Params: `body: { name: str, width: num, height: num, dpi: int, type: str, content: T19 }`
|
||||||
- Returns: `201 T8`
|
- Returns: `201 T10`
|
||||||
#### Delete label template — `DELETE /labeltemplate/{id}`
|
#### Delete label template — `DELETE /labeltemplate/{id}`
|
||||||
- Params: `id: int`
|
- Params: `id: int`
|
||||||
- Returns: `204 void`
|
- Returns: `204 void`
|
||||||
#### Get label template by ID — `GET /labeltemplate/{id}`
|
#### Get label template by ID — `GET /labeltemplate/{id}`
|
||||||
- Params: `id: int`
|
- Params: `id: int`
|
||||||
- Returns: `200 T8`
|
- Returns: `200 T10`
|
||||||
#### Update label template (partial) — `PATCH /labeltemplate/{id}`
|
#### Update label template (partial) — `PATCH /labeltemplate/{id}`
|
||||||
- Params: `id: int, body: { name?: str, width?: num, height?: num, dpi?: int, type?: str, content?: T19 }`
|
- Params: `id: int, body: { name?: str, width?: num, height?: num, dpi?: int, type?: str, content?: T19 }`
|
||||||
- Returns: `200 T8`
|
- Returns: `200 T10`
|
||||||
#### Update label template — `PUT /labeltemplate/{id}`
|
#### Update label template — `PUT /labeltemplate/{id}`
|
||||||
- Params: `id: int, body: { name?: str, width?: num, height?: num, dpi?: int, type?: str, content?: T19 }`
|
- Params: `id: int, body: { name?: str, width?: num, height?: num, dpi?: int, type?: str, content?: T19 }`
|
||||||
- Returns: `200 T8`
|
- Returns: `200 T10`
|
||||||
|
|
||||||
### Section: /ledger
|
### Section: /ledger
|
||||||
|
|
||||||
@@ -511,20 +511,20 @@ _none_
|
|||||||
### Section: /quote
|
### Section: /quote
|
||||||
|
|
||||||
#### List quotes — `GET /quote`
|
#### List quotes — `GET /quote`
|
||||||
_none_
|
- Params: `query: offset?: int, limit?: int, search?: str, seekMonths?: int`
|
||||||
- Returns: `200 { quotes: { id: int, number: str, type: str, entityId: int|null, date: str, createdAt?: str }[] }`
|
- Returns: `200 { quotes: T9[], total: int, unfilteredTotal: int, offset: int, limit: int }`
|
||||||
#### Create quote — `POST /quote`
|
#### Create quote — `POST /quote`
|
||||||
- Params: `body: { number: str, date: str, lines: T27[], entityId?: int|null }`
|
- Params: `body: { number: str, date: str, lines: T27[], entityId?: int|null }`
|
||||||
- Returns: `201 T10`
|
- Returns: `201 T8`
|
||||||
#### Delete quote — `DELETE /quote/{id}`
|
#### Delete quote — `DELETE /quote/{id}`
|
||||||
- Params: `id: int`
|
- Params: `id: int`
|
||||||
- Returns: `204 void`
|
- Returns: `204 void`
|
||||||
#### Get quote — `GET /quote/{id}`
|
#### Get quote — `GET /quote/{id}`
|
||||||
- Params: `id: int`
|
- Params: `id: int`
|
||||||
- Returns: `200 T10`
|
- Returns: `200 T8`
|
||||||
#### Update quote — `PATCH /quote/{id}`
|
#### Update quote — `PATCH /quote/{id}`
|
||||||
- Params: `id: int, body: { number?: str, date?: str, entityId?: int|null, lines?: T27[] }`
|
- Params: `id: int, body: { number?: str, date?: str, entityId?: int|null, lines?: T27[] }`
|
||||||
- Returns: `200 T10`
|
- Returns: `200 T8`
|
||||||
|
|
||||||
### Section: /shipment
|
### Section: /shipment
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ Created quote
|
|||||||
"entityId": 1,
|
"entityId": 1,
|
||||||
"date": "2026-08-10T00:00:00.000Z",
|
"date": "2026-08-10T00:00:00.000Z",
|
||||||
"createdAt": "2026-08-10T00:00:00.000Z",
|
"createdAt": "2026-08-10T00:00:00.000Z",
|
||||||
|
"positions": 1,
|
||||||
|
"grossTotal": 1,
|
||||||
|
"totalQuantity": 1,
|
||||||
|
"customerName": "…",
|
||||||
"lines": [
|
"lines": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ Quote
|
|||||||
"entityId": 1,
|
"entityId": 1,
|
||||||
"date": "2026-08-10T00:00:00.000Z",
|
"date": "2026-08-10T00:00:00.000Z",
|
||||||
"createdAt": "2026-08-10T00:00:00.000Z",
|
"createdAt": "2026-08-10T00:00:00.000Z",
|
||||||
|
"positions": 1,
|
||||||
|
"grossTotal": 1,
|
||||||
|
"totalQuantity": 1,
|
||||||
|
"customerName": "…",
|
||||||
"lines": [
|
"lines": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
|
|||||||
@@ -8,6 +8,15 @@ Lists quotes (`manifest` rows with `type = 'quote'`)
|
|||||||
for the authenticated user's selected company.
|
for the authenticated user's selected company.
|
||||||
|
|
||||||
|
|
||||||
|
## Query parameters
|
||||||
|
|
||||||
|
| Param | Required | Type | Description |
|
||||||
|
|-------|----------|------|-------------|
|
||||||
|
| `offset` | no | integer | Number of quotes to skip |
|
||||||
|
| `limit` | no | integer | Number of quotes to return |
|
||||||
|
| `search` | no | string | Free-text search matching quote number, external number, or customer name |
|
||||||
|
| `seekMonths` | no | integer | Negative integer for cutoff months ago (e.g. -1 for quotes older than 1 month) |
|
||||||
|
|
||||||
## Response `200`
|
## Response `200`
|
||||||
|
|
||||||
Quote list
|
Quote list
|
||||||
@@ -21,9 +30,30 @@ Quote list
|
|||||||
"type": "quote",
|
"type": "quote",
|
||||||
"entityId": 1,
|
"entityId": 1,
|
||||||
"date": "2026-08-10T00:00:00.000Z",
|
"date": "2026-08-10T00:00:00.000Z",
|
||||||
"createdAt": "2026-08-10T00:00:00.000Z"
|
"createdAt": "2026-08-10T00:00:00.000Z",
|
||||||
|
"positions": 1,
|
||||||
|
"grossTotal": 1,
|
||||||
|
"totalQuantity": 1,
|
||||||
|
"customerName": "…",
|
||||||
|
"lines": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"sku": "…",
|
||||||
|
"name": "…",
|
||||||
|
"pu": 1,
|
||||||
|
"amount": 1,
|
||||||
|
"net": 1,
|
||||||
|
"rebate": 1,
|
||||||
|
"taxrate": 1,
|
||||||
|
"comment": "…"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"total": 1,
|
||||||
|
"unfilteredTotal": 1,
|
||||||
|
"offset": 1,
|
||||||
|
"limit": 1
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -31,7 +61,7 @@ Quote list
|
|||||||
|
|
||||||
| Status | Description |
|
| Status | Description |
|
||||||
|--------|-------------|
|
|--------|-------------|
|
||||||
| 400 | No company selected — `{"error":"…"}` |
|
| 400 | Invalid query parameters, invalid offset, invalid limit, or no company selected — `{"error":"…"}` |
|
||||||
| 401 | Unauthorized — `{"error":"…"}` |
|
| 401 | Unauthorized — `{"error":"…"}` |
|
||||||
| 403 | Not authorized — `{"error":"…"}` |
|
| 403 | Not authorized — `{"error":"…"}` |
|
||||||
| 404 | Company not found — `{"error":"…"}` |
|
| 404 | Company not found — `{"error":"…"}` |
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ Updated quote
|
|||||||
"entityId": 1,
|
"entityId": 1,
|
||||||
"date": "2026-08-10T00:00:00.000Z",
|
"date": "2026-08-10T00:00:00.000Z",
|
||||||
"createdAt": "2026-08-10T00:00:00.000Z",
|
"createdAt": "2026-08-10T00:00:00.000Z",
|
||||||
|
"positions": 1,
|
||||||
|
"grossTotal": 1,
|
||||||
|
"totalQuantity": 1,
|
||||||
|
"customerName": "…",
|
||||||
"lines": [
|
"lines": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
|
|||||||
@@ -965,6 +965,18 @@
|
|||||||
* createdAt:
|
* createdAt:
|
||||||
* type: string
|
* type: string
|
||||||
* format: date-time
|
* format: date-time
|
||||||
|
* positions:
|
||||||
|
* type: integer
|
||||||
|
* description: Number of line items
|
||||||
|
* grossTotal:
|
||||||
|
* type: number
|
||||||
|
* description: Gross sum across quote positions
|
||||||
|
* totalQuantity:
|
||||||
|
* type: number
|
||||||
|
* description: Total quantity across quote positions
|
||||||
|
* customerName:
|
||||||
|
* type: string
|
||||||
|
* nullable: true
|
||||||
* Quote:
|
* Quote:
|
||||||
* allOf:
|
* allOf:
|
||||||
* - $ref: '#/components/schemas/QuoteSummary'
|
* - $ref: '#/components/schemas/QuoteSummary'
|
||||||
|
|||||||
@@ -43,6 +43,32 @@ export function register(app, basePath = '') {
|
|||||||
* for the authenticated user's selected company.
|
* for the authenticated user's selected company.
|
||||||
* security:
|
* security:
|
||||||
* - cookieAuth: []
|
* - cookieAuth: []
|
||||||
|
* parameters:
|
||||||
|
* - in: query
|
||||||
|
* name: offset
|
||||||
|
* schema:
|
||||||
|
* type: integer
|
||||||
|
* default: 0
|
||||||
|
* minimum: 0
|
||||||
|
* description: Number of quotes to skip
|
||||||
|
* - in: query
|
||||||
|
* name: limit
|
||||||
|
* schema:
|
||||||
|
* type: integer
|
||||||
|
* default: 50
|
||||||
|
* minimum: 1
|
||||||
|
* maximum: 100
|
||||||
|
* description: Number of quotes to return
|
||||||
|
* - in: query
|
||||||
|
* name: search
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* description: Free-text search matching quote number, external number, or customer name
|
||||||
|
* - in: query
|
||||||
|
* name: seekMonths
|
||||||
|
* schema:
|
||||||
|
* type: integer
|
||||||
|
* description: Negative integer for cutoff months ago (e.g. -1 for quotes older than 1 month)
|
||||||
* x-markdown: quote/list.md
|
* x-markdown: quote/list.md
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
@@ -51,13 +77,26 @@ export function register(app, basePath = '') {
|
|||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
* type: object
|
* type: object
|
||||||
|
* required: [quotes, total, unfilteredTotal, offset, limit]
|
||||||
* properties:
|
* properties:
|
||||||
* quotes:
|
* quotes:
|
||||||
* type: array
|
* type: array
|
||||||
* items:
|
* items:
|
||||||
* $ref: '#/components/schemas/QuoteSummary'
|
* $ref: '#/components/schemas/Quote'
|
||||||
|
* total:
|
||||||
|
* type: integer
|
||||||
|
* description: Total number of filtered quotes
|
||||||
|
* unfilteredTotal:
|
||||||
|
* type: integer
|
||||||
|
* description: Total number of quotes without any filters applied
|
||||||
|
* offset:
|
||||||
|
* type: integer
|
||||||
|
* description: Number of quotes skipped
|
||||||
|
* limit:
|
||||||
|
* type: integer
|
||||||
|
* description: Number of quotes returned
|
||||||
* 400:
|
* 400:
|
||||||
* description: No company selected
|
* description: Invalid query parameters, invalid offset, invalid limit, or no company selected
|
||||||
* content:
|
* content:
|
||||||
* application/json:
|
* application/json:
|
||||||
* schema:
|
* schema:
|
||||||
@@ -167,9 +206,47 @@ export function register(app, basePath = '') {
|
|||||||
return res.status(400).json({ error: selected.error });
|
return res.status(400).json({ error: selected.error });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const rawOffset = req.query.offset;
|
||||||
|
const rawLimit = req.query.limit;
|
||||||
|
|
||||||
|
let offset = 0;
|
||||||
|
let limit = 50;
|
||||||
|
|
||||||
|
if (rawOffset !== undefined) {
|
||||||
|
offset = parseInt(rawOffset, 10);
|
||||||
|
if (!Number.isInteger(offset) || offset < 0) {
|
||||||
|
return res.status(400).json({ error: 'offset must be an integer >= 0' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawLimit !== undefined) {
|
||||||
|
limit = parseInt(rawLimit, 10);
|
||||||
|
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
||||||
|
return res.status(400).json({ error: 'limit must be an integer between 1 and 100' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const search = typeof req.query.search === 'string' && req.query.search.trim() !== ''
|
||||||
|
? req.query.search.trim()
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
let seekMonths = undefined;
|
||||||
|
if (req.query.seekMonths !== undefined && req.query.seekMonths !== '') {
|
||||||
|
const parsedSeek = parseInt(req.query.seekMonths, 10);
|
||||||
|
if (!Number.isInteger(parsedSeek)) {
|
||||||
|
return res.status(400).json({ error: 'seekMonths must be an integer' });
|
||||||
|
}
|
||||||
|
seekMonths = parsedSeek;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const quotes = await db.list(req.user.id);
|
const result = await db.list(req.user.id, {
|
||||||
res.status(200).json({ quotes });
|
offset,
|
||||||
|
limit,
|
||||||
|
search,
|
||||||
|
seekMonths,
|
||||||
|
});
|
||||||
|
res.status(200).json(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const status = quoteErrorStatus(error);
|
const status = quoteErrorStatus(error);
|
||||||
if (status === 500) console.error('List quotes failed:', error);
|
if (status === 500) console.error('List quotes failed:', error);
|
||||||
|
|||||||
@@ -1,26 +1,85 @@
|
|||||||
import { getStore } from './store.js';
|
import { getStore } from './store.js';
|
||||||
|
|
||||||
export async function list(googleAuthId) {
|
function round2(num) {
|
||||||
|
return Math.round((Number(num) || 0) * 100) / 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateQuoteGrossTotal(lines = []) {
|
||||||
|
let total = 0;
|
||||||
|
for (const line of lines) {
|
||||||
|
const amount = Number(line.amount || 0);
|
||||||
|
const net = Number(line.net || 0);
|
||||||
|
const rebate = Number(line.rebate || 0);
|
||||||
|
const taxrate = Number(line.taxrate || 0);
|
||||||
|
const netAfterRebate = net * (1 - rebate / 100);
|
||||||
|
const gross = netAfterRebate * (1 + taxrate / 100);
|
||||||
|
total += amount * gross;
|
||||||
|
}
|
||||||
|
return round2(total);
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateTotalQuantity(lines = []) {
|
||||||
|
let qty = 0;
|
||||||
|
for (const line of lines) {
|
||||||
|
qty += Number(line.amount || 0);
|
||||||
|
}
|
||||||
|
return Math.round(qty * 1000) / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
function enrichQuote(quote) {
|
||||||
|
if (!quote) return quote;
|
||||||
|
const lines = Array.isArray(quote.lines) ? quote.lines : [];
|
||||||
|
const positions = quote.positions !== undefined ? quote.positions : lines.length;
|
||||||
|
const grossTotal = quote.grossTotal !== undefined ? quote.grossTotal : calculateQuoteGrossTotal(lines);
|
||||||
|
const totalQuantity = quote.totalQuantity !== undefined ? quote.totalQuantity : calculateTotalQuantity(lines);
|
||||||
|
|
||||||
|
return {
|
||||||
|
...quote,
|
||||||
|
positions,
|
||||||
|
grossTotal,
|
||||||
|
totalQuantity,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function list(googleAuthId, opts) {
|
||||||
const store = await getStore();
|
const store = await getStore();
|
||||||
return store.quote.list(googleAuthId);
|
const result = await store.quote.list(googleAuthId, opts);
|
||||||
|
if (Array.isArray(result)) {
|
||||||
|
return result.map(enrichQuote);
|
||||||
|
}
|
||||||
|
if (result && Array.isArray(result.quotes)) {
|
||||||
|
return {
|
||||||
|
...result,
|
||||||
|
quotes: result.quotes.map(enrichQuote),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getById(googleAuthId, id) {
|
export async function getById(googleAuthId, id) {
|
||||||
const store = await getStore();
|
const store = await getStore();
|
||||||
return store.quote.getById(googleAuthId, id);
|
const quote = await store.quote.getById(googleAuthId, id);
|
||||||
|
return enrichQuote(quote);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function create(googleAuthId, data) {
|
export async function create(googleAuthId, data) {
|
||||||
const store = await getStore();
|
const store = await getStore();
|
||||||
return store.quote.create(googleAuthId, data);
|
const quote = await store.quote.create(googleAuthId, data);
|
||||||
|
return enrichQuote(quote);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function update(googleAuthId, id, data) {
|
export async function update(googleAuthId, id, data) {
|
||||||
const store = await getStore();
|
const store = await getStore();
|
||||||
return store.quote.update(googleAuthId, id, data);
|
const quote = await store.quote.update(googleAuthId, id, data);
|
||||||
|
return enrichQuote(quote);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function remove(googleAuthId, id) {
|
export async function remove(googleAuthId, id) {
|
||||||
const store = await getStore();
|
const store = await getStore();
|
||||||
return store.quote.delete(googleAuthId, id);
|
return store.quote.delete(googleAuthId, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function rebuildSummaries(googleAuthId) {
|
||||||
|
const store = await getStore();
|
||||||
|
return store.quote.rebuildSummaries(googleAuthId);
|
||||||
|
}
|
||||||
|
|||||||
@@ -261,7 +261,6 @@ export const TOOL_PARAMETER_DESCRIPTIONS = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const PATCH_PARAMETER_DESCRIPTIONS = TOOL_PARAMETER_DESCRIPTIONS.patch;
|
export const PATCH_PARAMETER_DESCRIPTIONS = TOOL_PARAMETER_DESCRIPTIONS.patch;
|
||||||
export const PATCH_PARAM_DESCRIPTIONS = TOOL_PARAMETER_DESCRIPTIONS.patch;
|
|
||||||
export const ANALYZE_IMAGE_VISION_COMPARE_PROMPT =
|
export const ANALYZE_IMAGE_VISION_COMPARE_PROMPT =
|
||||||
'Compare these images, evaluate visual quality, flag watermarks/overlays/defects, and state the best candidate with rationale.';
|
'Compare these images, evaluate visual quality, flag watermarks/overlays/defects, and state the best candidate with rationale.';
|
||||||
export const ANALYZE_IMAGE_VISION_DESCRIBE_PROMPT =
|
export const ANALYZE_IMAGE_VISION_DESCRIBE_PROMPT =
|
||||||
@@ -335,28 +334,23 @@ export async function buildSystemPrompt(vfsRoot, googleAuthId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const today = new Date().toISOString().split('T')[0];
|
const today = new Date().toISOString().split('T')[0];
|
||||||
|
const basePrompt = [
|
||||||
// 1. STATIC CORE FIRST (100% cacheable across all users, days, and VFS changes)
|
|
||||||
const staticCore = [
|
|
||||||
'QuixPOS Article Management System API Assistant',
|
'QuixPOS Article Management System API Assistant',
|
||||||
'[TESTSYSTEM: destructive commands allowed; primary goal is finding bugs]',
|
'[TESTSYSTEM: destructive commands allowed; primary goal is finding bugs]',
|
||||||
'',
|
'',
|
||||||
SYSTEM_PROMPT_RULES,
|
SYSTEM_PROMPT_RULES,
|
||||||
'',
|
'',
|
||||||
SYSTEM_PROMPT_ROUTE_MATRIX,
|
SYSTEM_PROMPT_ROUTE_MATRIX,
|
||||||
].join('\n');
|
'',
|
||||||
|
|
||||||
// 2. DYNAMIC / PER-TENANT STATE LAST (ordered from least-volatile to most-volatile)
|
|
||||||
const dynamicContext = [
|
|
||||||
`Date: ${today}`,
|
`Date: ${today}`,
|
||||||
'',
|
'',
|
||||||
buildSkillIndex(vfsRoot),
|
buildSkillIndex(vfsRoot),
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
const sections = [staticCore, dynamicContext];
|
const sections = [];
|
||||||
if (prefix) sections.push(prefix);
|
if (prefix) sections.push(prefix);
|
||||||
|
sections.push(basePrompt);
|
||||||
if (suffix) sections.push(suffix);
|
if (suffix) sections.push(suffix);
|
||||||
|
|
||||||
return sections.join('\n\n');
|
return sections.join('\n\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user