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:
@@ -5,20 +5,22 @@ import {
|
||||
import request from '../request.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
|
||||
/**
|
||||
* Reorders the customer groups of a company.
|
||||
*
|
||||
* @param {object} pool - The mssql connection pool.
|
||||
* @returns {Function} An async function that reorders customer groups.
|
||||
*
|
||||
* @example
|
||||
* const fn = order(pool);
|
||||
* const result = await fn(42, { customergroupIds: [3, 1, 2] });
|
||||
* // => { customergroupIds: [3, 1, 2] }
|
||||
*/
|
||||
export default function order(pool) {
|
||||
const access = resolveSelectedCompanyAccess(pool);
|
||||
|
||||
/**
|
||||
* Reorders the customer groups of the user's selected company.
|
||||
*
|
||||
* @param {number} googleAuthId - The id of the Google auth user.
|
||||
* @param {object} input - The reorder input.
|
||||
* @param {Array<number>} input.customergroupIds - The customer group ids in their new order.
|
||||
* @returns {Promise<{customergroupIds: Array<number>}>} The applied order.
|
||||
* @throws {Error} If the order is invalid.
|
||||
*
|
||||
* @example
|
||||
* const result = await store.customergroup.order(42, { customergroupIds: [3, 1, 2] });
|
||||
* // => { customergroupIds: [3, 1, 2] }
|
||||
*/
|
||||
return async (googleAuthId, { customergroupIds } = {}) => {
|
||||
if (!Array.isArray(customergroupIds)) {
|
||||
throw new Error('Invalid customer group order');
|
||||
|
||||
Reference in New Issue
Block a user