docs: add JSDoc headers to all externally exported store functions

This commit is contained in:
seb
2026-08-07 03:58:48 +02:00
parent c290fe8f4b
commit 4833acd680
101 changed files with 1134 additions and 0 deletions

View File

@@ -8,6 +8,17 @@ function shape(row) {
return { id: row.id, name: row.name, sort: row.sort };
}
/**
* Creates a new customer group for a company.
*
* @param {object} pool - The mssql connection pool.
* @returns {Function} An async function that creates a customer group.
*
* @example
* const fn = create(pool);
* const group = await fn(42, 1, { name: 'Wholesale' });
* // => { id, name, sort }
*/
export default function create(pool) {
const access = resolveCompanyAccess(pool);

View File

@@ -1,6 +1,16 @@
import { DELETE_BY_COMPANY_AND_ID } from '../../sql/customergroup.js';
import resolveCompanyAccess from '../companyuser/resolveCompanyAccess.js';
/**
* Deletes a customer group for a company by its id.
*
* @param {object} pool - The mssql connection pool.
* @returns {Function} An async function that deletes a customer group.
*
* @example
* const fn = del(pool);
* await fn(42, 1, 5);
*/
export default function del(pool) {
const access = resolveCompanyAccess(pool);

View File

@@ -1,6 +1,17 @@
import { LIST_BY_COMPANY } from '../../sql/customergroup.js';
import resolveCompanyAccess from '../companyuser/resolveCompanyAccess.js';
/**
* Lists the customer groups of a company.
*
* @param {object} pool - The mssql connection pool.
* @returns {Function} An async function that lists customer groups.
*
* @example
* const fn = list(pool);
* const groups = await fn(42, 1);
* // => [{ id, name, sort }]
*/
export default function list(pool) {
const access = resolveCompanyAccess(pool);

View File

@@ -5,6 +5,17 @@ import {
import request from '../request.js';
import resolveCompanyAccess from '../companyuser/resolveCompanyAccess.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, 1, { customergroupIds: [3, 1, 2] });
* // => { customergroupIds: [3, 1, 2] }
*/
export default function order(pool) {
const access = resolveCompanyAccess(pool);

View File

@@ -8,6 +8,17 @@ function shape(row) {
return { id: row.id, name: row.name, sort: row.sort };
}
/**
* Updates the name of a customer group for a company.
*
* @param {object} pool - The mssql connection pool.
* @returns {Function} An async function that updates a customer group.
*
* @example
* const fn = update(pool);
* const group = await fn(42, 1, 5, { name: 'Retail' });
* // => { id, name, sort }
*/
export default function update(pool) {
const access = resolveCompanyAccess(pool);