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:
@@ -6,20 +6,23 @@ import {
|
||||
import resolveArticleBySku from './resolveArticleBySku.js';
|
||||
import request from '../request.js';
|
||||
|
||||
/**
|
||||
* Reorders the images of an article by its SKU.
|
||||
*
|
||||
* @param {object} pool - The mssql connection pool.
|
||||
* @returns {Function} An async function that reorders article images.
|
||||
*
|
||||
* @example
|
||||
* const fn = orderImages(pool);
|
||||
* const result = await fn(42, 'SKU-1', { fullHashes: ['a', 'b'] });
|
||||
* // => { fullHashes: ['a', 'b'] }
|
||||
*/
|
||||
export default function orderImages(pool) {
|
||||
const resolve = resolveArticleBySku(pool);
|
||||
|
||||
/**
|
||||
* Reorders the images of an article by its SKU.
|
||||
*
|
||||
* @param {number} googleAuthId - The id of the Google auth user.
|
||||
* @param {string} sku - The article SKU.
|
||||
* @param {object} input - The reorder input.
|
||||
* @param {Array<string>} input.fullHashes - The full image hashes in their new order.
|
||||
* @returns {Promise<{fullHashes: Array<string>}>} The applied order.
|
||||
* @throws {Error} If the order is invalid.
|
||||
*
|
||||
* @example
|
||||
* const result = await store.article.orderImages(42, 'SKU-1', { fullHashes: ['a', 'b'] });
|
||||
* // => { fullHashes: ['a', 'b'] }
|
||||
*/
|
||||
return async (googleAuthId, sku, { fullHashes }) => {
|
||||
if (!Array.isArray(fullHashes)) {
|
||||
throw new Error('Invalid image order');
|
||||
|
||||
Reference in New Issue
Block a user