u
This commit is contained in:
13
README.md
13
README.md
@@ -543,14 +543,15 @@ Company-scoped POS terminals. Auth via selected company (`google_auth.selected_c
|
||||
| --- | --- | --- |
|
||||
| `listSearchIndex` | `(googleAuthId: string, companyId: number)` | `SearchIndexEntry[]` (see below) |
|
||||
| `listExport` | `(googleAuthId: string, companyId: number, categoryId?: number)` | `ArticleExportEntry[]` (see below) |
|
||||
| `createUnderParent` | `({ googleAuthId: string, parentId: number, name: string })` | `{ id: number, parentId: number, name: string, sku: string }` |
|
||||
| `createUnderParent` | `({ googleAuthId: string, parentId: number, name: string, track_stock?: boolean })` | `{ id: number, parentId: number, name: string, sku: string, track_stock: boolean }` |
|
||||
| `getBySku` | `(googleAuthId: string, sku: string)` | `ArticleDetail` (see below) |
|
||||
| `getHistoryBySku` | `(googleAuthId: string, sku: string)` | `{ id: number, companyuserId: number \| null, date: Date, text: string }[]` |
|
||||
| `updateBySku` | `(googleAuthId: string, sku: string, { name?: string, unitamount?: number, unitSi?: string })` | `ArticleDetail` |
|
||||
| `updateBySku` | `(googleAuthId: string, sku: string, { name?: string, unitamount?: number, unitSi?: string, track_stock?: boolean })` | `ArticleDetail` |
|
||||
| `setPricesBySku` | `(googleAuthId: string, sku: string, PriceInput[])` | `ArticleDetail` |
|
||||
| `setEansBySku` | `(googleAuthId: string, sku: string, string[])` | `ArticleDetail` |
|
||||
| `setBrandIdBySku` | `(googleAuthId: string, sku: string, number \| null)` | `ArticleDetail` |
|
||||
| `setWeightBySku` | `(googleAuthId: string, sku: string, number)` | `ArticleDetail` |
|
||||
| `setTrackStockBySku` | `(googleAuthId: string, sku: string, boolean)` | `ArticleDetail` |
|
||||
| `setCategoryIdsBySku` | `(googleAuthId: string, sku: string, number[])` | `ArticleDetail` |
|
||||
| `addImage` | `(googleAuthId: string, sku: string, Buffer)` | `ImageResult` (see below) |
|
||||
| `deleteImage` | `(googleAuthId: string, sku: string, fullHash: string)` | `void` |
|
||||
@@ -605,7 +606,7 @@ type ArticleExportEntry = {
|
||||
}
|
||||
```
|
||||
|
||||
`getBySku` / `updateBySku` / `setPricesBySku` / `setEansBySku` / `setBrandIdBySku` / `setWeightBySku` / `setCategoryIdsBySku` all return `ArticleDetail`:
|
||||
`getBySku` / `updateBySku` / `setPricesBySku` / `setEansBySku` / `setBrandIdBySku` / `setWeightBySku` / `setTrackStockBySku` / `setCategoryIdsBySku` all return `ArticleDetail`:
|
||||
|
||||
```ts
|
||||
type ArticleDetail = {
|
||||
@@ -615,6 +616,7 @@ type ArticleDetail = {
|
||||
slug: string | null,
|
||||
unitamount: number,
|
||||
weight: number,
|
||||
track_stock: boolean,
|
||||
unit: {
|
||||
si: string, // e.g. "pc"
|
||||
basesi: string, // e.g. "pc"
|
||||
@@ -671,6 +673,8 @@ Auth via the article's `categoryarticle` category + `resolveCategoryAccess`. Err
|
||||
|
||||
`setWeightBySku` sets the article’s `weight`. Must be finite and `>= 0` (else `Invalid weight`). Errors: `Article not found`, `Not authorized`, `Invalid weight`.
|
||||
|
||||
`setTrackStockBySku` sets the article’s `track_stock` flag. Must be boolean or 0/1 (else `Invalid track_stock`). Errors: `Article not found`, `Not authorized`, `Invalid track_stock`.
|
||||
|
||||
`setCategoryIdsBySku` replaces the article’s category list (`categoryarticle`) in one transaction. Each category must belong to the article’s company and ids must be unique (else `Invalid categoryIds`); empty array is rejected — an article must have at least one category (else `Article must have at least one category`). Returns `ArticleDetail` (whose `categoryIds` reflects the new list). Errors: `Article not found`, `Not authorized`, `Invalid categoryIds`, `Article must have at least one category`.
|
||||
|
||||
`deleteImage` removes `articlepic` and the `pic` row for this article (`fullHash`). Errors: `Article not found`, `Image not found`, `Not authorized`.
|
||||
@@ -801,11 +805,12 @@ Company-scoped number sequences (`numbers` table). Auth via selected company (`g
|
||||
| `GET /api/article/:sku/history` | `article.getHistoryBySku(googleAuthId, sku)` |
|
||||
| `GET /api/articleIndex` | `article.listSearchIndex(googleAuthId)` |
|
||||
| `GET /api/article/export.zip` | `article.listExport(googleAuthId, categoryId?)` |
|
||||
| `PATCH /api/article/:sku` | `article.updateBySku(googleAuthId, sku, { name?, unitamount?, unitSi? })` |
|
||||
| `PATCH /api/article/:sku` | `article.updateBySku(googleAuthId, sku, { name?, unitamount?, unitSi?, track_stock? })` |
|
||||
| `PUT /api/article/:sku/prices` | `article.setPricesBySku(googleAuthId, sku, [{ price, tax, minmultiplier? }])` |
|
||||
| `PUT /api/article/:sku/eans` | `article.setEansBySku(googleAuthId, sku, string[])` |
|
||||
| `PUT /api/article/:sku/brand` | `article.setBrandIdBySku(googleAuthId, sku, brandId \| null)` |
|
||||
| `PUT /api/article/:sku/weight` | `article.setWeightBySku(googleAuthId, sku, weight)` |
|
||||
| `PUT /api/article/:sku/track_stock` | `article.setTrackStockBySku(googleAuthId, sku, track_stock)` |
|
||||
| `PUT /api/article/:sku/categories` | `article.setCategoryIdsBySku(googleAuthId, sku, number[])` |
|
||||
| `DELETE /api/article/:sku` | `article.delete(googleAuthId, sku)` |
|
||||
| `POST /api/article/:sku/image` | `article.addImage(googleAuthId, sku, imageBuffer)` |
|
||||
|
||||
Reference in New Issue
Block a user