export
This commit is contained in:
26
README.md
26
README.md
@@ -264,6 +264,7 @@ Company-scoped POS terminals. Auth via `resolveCompanyAccess`.
|
||||
| Method | Signature | Returns |
|
||||
| --- | --- | --- |
|
||||
| `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 }` |
|
||||
| `getBySku` | `(googleAuthId: string, sku: string)` | `ArticleDetail` (see below) |
|
||||
| `updateBySku` | `(googleAuthId: string, sku: string, { name?: string, unitamount?: number, unitSi?: string })` | `ArticleDetail` |
|
||||
@@ -304,6 +305,27 @@ type SearchIndexEntry = {
|
||||
}
|
||||
```
|
||||
|
||||
`listExport` returns articles in a category subtree (root = company when `categoryId` omitted). `categoryId` must be reachable via the selected company's root category (else `Not authorized`). Auth via `resolveCompanyAccess` + `resolveCategoryAccess`. Errors: `Company not found`, `Parent not found`, `Not authorized`.
|
||||
|
||||
```ts
|
||||
type ArticleExportEntry = {
|
||||
id: number,
|
||||
sku: string,
|
||||
name: string | null, // null when articletext row is missing
|
||||
slug: string | null,
|
||||
unitSi: string | null,
|
||||
unitSymbol: string | null,
|
||||
unitamount: number,
|
||||
brandName: string | null,
|
||||
net: number | null, // null when no POS price
|
||||
taxRate: number | null, // null when no POS price
|
||||
eans: string[], // all EANs, empty array when none
|
||||
categoryIds: number[], // all category ids, at least one
|
||||
categoryBreadcrumbs: string[], // one middot-separated breadcrumb ("Home·Cat·Sub") per category
|
||||
fullHashes: string[], // all photo fullHashes in sort order, empty when none
|
||||
}
|
||||
```
|
||||
|
||||
`getBySku` / `updateBySku` / `setPricesBySku` / `setEansBySku` / `setBrandIdBySku` / `setWeightBySku` / `setCategoryIdsBySku` all return `ArticleDetail`:
|
||||
|
||||
```ts
|
||||
@@ -413,6 +435,7 @@ res.set('Content-Type', thumb.contentType).send(thumb.buffer);
|
||||
| `DELETE /api/company/:id` | `company.delete(id)` |
|
||||
| `PUT /api/auth/selected-company` | `google_auth.setSelectedCompany(googleAuthId, companyId)` |
|
||||
| `GET /api/category/tree` | `category.getTreeForCompany(googleAuthId, companyId)` |
|
||||
| `GET /api/category/export.zip` | `category.getTreeForCompany(googleAuthId, companyId)` + `pic.getImageByHash` |
|
||||
| `POST /api/category` | `category.createUnderParent({ googleAuthId, parentId, name })` |
|
||||
| `PATCH /api/category/:id` | `category.rename({ googleAuthId, id, name })` |
|
||||
| `PUT /api/category/order` | `category.order({ googleAuthId, parentId, categoryIds })` |
|
||||
@@ -438,7 +461,8 @@ res.set('Content-Type', thumb.contentType).send(thumb.buffer);
|
||||
| `DELETE /api/posterminal/:id/categories` | `posterminal.setOffAll(googleAuthId, companyId, id)` |
|
||||
| `POST /api/article` | `article.createUnderParent({ googleAuthId, parentId, name })` |
|
||||
| `GET /api/article/:sku` | `article.getBySku(googleAuthId, sku)` |
|
||||
| `GET /api/articles/search-index` | `article.listSearchIndex(googleAuthId, companyId)` |
|
||||
| `GET /api/articleIndex` | `article.listSearchIndex(googleAuthId, companyId)` |
|
||||
| `GET /api/article/export.zip` | `article.listExport(googleAuthId, companyId, categoryId?)` |
|
||||
| `PATCH /api/article/:sku` | `article.updateBySku(googleAuthId, sku, { name?, unitamount?, unitSi? })` |
|
||||
| `PUT /api/article/:sku/prices` | `article.setPricesBySku(googleAuthId, sku, [{ price, tax, minmultiplier? }])` |
|
||||
| `PUT /api/article/:sku/eans` | `article.setEansBySku(googleAuthId, sku, string[])` |
|
||||
|
||||
Reference in New Issue
Block a user