u
This commit is contained in:
25
README.md
25
README.md
@@ -142,14 +142,33 @@ Backend mapping:
|
||||
| Method | Signature | Returns |
|
||||
| --- | --- | --- |
|
||||
| `createUnderParent` | `({ googleAuthId, parentId, name })` | `{ id, parentId, name, sku }` |
|
||||
| `getBySku` | `(googleAuthId, sku)` | `{ id, sku, name, slug, net, taxRate, optionsCount, articleListCount, childCount, fatherArticleId, fatherSku, thumbW, thumbH, thumbHash }` |
|
||||
| `getBySku` | `(googleAuthId, sku)` | detail object (see below) |
|
||||
| `updateBySku` | `(googleAuthId, sku, { name })` | same shape as `getBySku` |
|
||||
|
||||
`getBySku` / `updateBySku` return:
|
||||
|
||||
```js
|
||||
{
|
||||
id, sku, name, slug,
|
||||
unitamount, weight,
|
||||
unit: { si },
|
||||
brand: { name, thumbW, thumbH, thumbHash } | null,
|
||||
categoryIds: number[],
|
||||
photos: { sort, thumbW, thumbH, thumbHash }[],
|
||||
eans: string[],
|
||||
prices: { minmultiplier, net, taxRate, customergroupId }[],
|
||||
optionsCount, articleListCount, childCount,
|
||||
fatherArticleId, fatherSku,
|
||||
}
|
||||
```
|
||||
|
||||
`getCategoryArticles` / `getTreeForCompany().articles[]` keep the flat list shape (`net`, `taxRate`, single `thumbW`/`thumbH`/`thumbHash`).
|
||||
|
||||
`parentId` is the category id. Creates `article` + `articletext` (company default language) + `categoryarticle` in one transaction. Allocates `sku` via `getnextnumberwithprefixandpadding` (`type` `sku`; creates `numbers` row with empty prefix if missing). Default unit `pc` is ensured if missing (`unitamount` 1, `weight` 0). Auth via `resolveCategoryAccess(googleAuthId, parentId)` — `Parent not found` / `Not authorized`.
|
||||
|
||||
Same article shape as `getCategoryArticles` / `getTreeForCompany().articles[]`. Auth via the article's `categoryarticle` category + `resolveCategoryAccess`. Errors: `Article not found`, `Not authorized`.
|
||||
Auth via the article's `categoryarticle` category + `resolveCategoryAccess`. Errors: `Article not found`, `Not authorized`.
|
||||
|
||||
`updateBySku` updates `articletext` (company default language) in a transaction (`name` + slugified `slug`), then returns the same select as `getBySku`. Errors: `Article not found`, `Not authorized`, `Name required`.
|
||||
`updateBySku` updates `articletext` (company default language) in a transaction (`name` + slugified `slug`), then returns the same object as `getBySku`. Errors: `Article not found`, `Not authorized`, `Name required`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user