u
This commit is contained in:
17
README.md
17
README.md
@@ -144,6 +144,22 @@ Backend mapping:
|
||||
| `createUnderParent` | `({ googleAuthId, parentId, name })` | `{ id, parentId, name, sku }` |
|
||||
| `getBySku` | `(googleAuthId, sku)` | detail object (see below) |
|
||||
| `updateBySku` | `(googleAuthId, sku, { name })` | same shape as `getBySku` |
|
||||
| `addImage` | `(googleAuthId, sku, imageBuffer)` | image result (see below) |
|
||||
|
||||
`addImage` accepts a full-size AVIF `Buffer`, scales to max 1000×1000 (`pic.binary`) and 200×200 (`pic.thumbbinary`) via `sharp`, computes `hash` / `thumbhash`, links `articlepic`. Auth like `getBySku`. Errors: `Article not found`, `Not authorized`.
|
||||
|
||||
`addImage` returns:
|
||||
|
||||
```js
|
||||
{
|
||||
picId,
|
||||
sort,
|
||||
full: { w, h, size }, // scaled AVIF, max 1000×1000 (fit inside)
|
||||
thumb: { w, h }, // scaled AVIF, max 200×200 (fit inside)
|
||||
hash, // SHA-256 hex of full image bytes
|
||||
thumbHash, // base64 thumbhash of thumb preview
|
||||
}
|
||||
```
|
||||
|
||||
`getBySku` / `updateBySku` return:
|
||||
|
||||
@@ -187,6 +203,7 @@ Auth via the article's `categoryarticle` category + `resolveCategoryAccess`. Err
|
||||
| `POST /api/article` | `article.createUnderParent({ googleAuthId, parentId, name })` |
|
||||
| `GET /api/article/:sku` | `article.getBySku(googleAuthId, sku)` |
|
||||
| `PATCH /api/article/:sku` | `article.updateBySku(googleAuthId, sku, { name })` |
|
||||
| `POST /api/article/:sku/image` | `article.addImage(googleAuthId, sku, imageBuffer)` |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user