Files
dashlibstorage/API.category.md
seb 70e0a9ddc4 Add entity customer numbers and scope APIs via selected company.
Entity gets an optional unique-per-company number with allocate/peek/isNumberFree helpers. Company-scoped store methods no longer take companyId and resolve google_auth.selected_company instead.
2026-08-07 04:29:35 +02:00

2.5 KiB

category

This document is auto-generated from the JSDoc comments in src/store by running npm run api-doc.

category.addImage

Source: src/store/category/addImage.js

Adds an image to a category, processing it into AVIF full and thumb variants.

const fn = addImage(pool);
const result = await fn(42, 5, imageBuffer);
// => { id, fullHash, thumbW, thumbH, thumbHash }

category.createUnderParent

Source: src/store/category/createUnderParent.js

Creates a new category under a given parent category.

const fn = createUnderParent(pool);
const category = await fn({ googleAuthId: 42, parentId: 5, name: 'Drinks' });
// => { id, parentId, sort, name, slug }

category.delete

Source: src/store/category/delete.js

Deletes a category, refusing to delete the company's root category.

const fn = del(pool);
await fn({ googleAuthId: 42, id: 5 });

category.deleteImage

Source: src/store/category/deleteImage.js

Deletes the image of a category.

const fn = deleteImage(pool);
const result = await fn(42, 5);
// => { id, thumbW: null, thumbH: null, thumbHash: null }

category.getCategoryArticles

Source: src/store/category/getCategoryArticles.js

Returns the articles belonging to a single category.

const fn = getCategoryArticles(pool);
const articles = await fn(42, 5);
// => [{ id, sku, name, ... }]

category.getTreeForCompany

Source: src/store/category/getTreeForCompany.js

Returns the full category tree for a company together with its articles and the posterminal ids assigned to each category.

const fn = getTreeForCompany(pool);
const tree = await fn(42);
// => { languageId, tree: [{ id, posterminalIds, ... }], articles: [...] }

category.move

Source: src/store/category/move.js

Moves a category to a new parent, preventing cycles and cross-company moves.

const fn = move(pool);
const result = await fn({ googleAuthId: 42, id: 5, parentId: 9 });
// => { id, parentId, sort }

category.order

Source: src/store/category/order.js

Reorders the child categories of a given parent.

const fn = order(pool);
const result = await fn({ googleAuthId: 42, parentId: 5, categoryIds: [3, 1, 2] });
// => { categoryIds: [3, 1, 2] }

category.rename

Source: src/store/category/rename.js

Renames a category and updates its slug.

const fn = rename(pool);
const result = await fn({ googleAuthId: 42, id: 5, name: 'Soft Drinks' });
// => { id, name, slug }