This commit is contained in:
seb
2026-07-31 19:49:07 +02:00
parent 6b1701d4dc
commit e8326e22ac
10 changed files with 827 additions and 5 deletions

View File

@@ -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)` |
---