Rewrite store JSDoc, split quote/order into modules, and generate typed API docs
- Rewrite JSDoc across all store methods to document the actual async methods (real params, returns, throws) instead of the internal wrappers - Split quote/order into individual module files backed by shared manifestDoc helpers; remove the createStore factory and thin wrappers - Deduplicate manifest line helpers into src/store/manifestLines.js - Extend generate-api-doc.js to render parameter/return/throws types and emit per-namespace API.<module>.md files with an API.md index - Regenerate all API docs
This commit is contained in:
@@ -42,22 +42,24 @@ function normalizePrices(prices) {
|
||||
return normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the price list of an article by its SKU.
|
||||
*
|
||||
* @param {object} pool - The mssql connection pool.
|
||||
* @returns {Function} An async function that sets article prices.
|
||||
*
|
||||
* @example
|
||||
* const fn = setPricesBySku(pool);
|
||||
* const article = await fn(42, 'SKU-1', [{ price: 1.5, tax: 19, minmultiplier: 1 }]);
|
||||
* // => { id, sku, name, ... }
|
||||
*/
|
||||
export default function setPricesBySku(pool) {
|
||||
const resolve = resolveArticleBySku(pool);
|
||||
const ensureTax = taxEnsure(pool);
|
||||
const load = queryBySku(pool);
|
||||
|
||||
/**
|
||||
* Replaces the price list of an article by its SKU.
|
||||
*
|
||||
* @param {number} googleAuthId - The id of the Google auth user.
|
||||
* @param {string} sku - The article SKU.
|
||||
* @param {Array<{price: number, tax: number, minmultiplier?: number}>} prices - The price entries (minmultiplier defaults to 1).
|
||||
* @returns {Promise<object>} The updated article.
|
||||
* @throws {Error} If the prices are invalid or the article is not found.
|
||||
*
|
||||
* @example
|
||||
* const article = await store.article.setPricesBySku(42, 'SKU-1', [{ price: 1.5, tax: 19, minmultiplier: 1 }]);
|
||||
* // => { id, sku, name, ... }
|
||||
*/
|
||||
return async (googleAuthId, sku, prices) => {
|
||||
const normalized = normalizePrices(prices);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user