This commit is contained in:
seb
2026-08-07 05:21:56 +02:00
parent 70e0a9ddc4
commit 396389457f
22 changed files with 225 additions and 242 deletions

View File

@@ -1,18 +1,18 @@
import { CREATE } from '../../sql/tax.js';
import request from '../request.js';
/**
* Creates a new tax rate.
*
* @param {object} pool - The mssql connection pool.
* @returns {Function} An async function that creates a tax rate.
*
* @example
* const fn = create(pool);
* const id = await fn(19);
* // => 1
*/
export default function create(pool) {
/**
* Creates a new tax rate.
*
* @param {number} rate - The tax rate in percent (e.g. `19`).
* @param {object} [tx] - Optional transaction to run within.
* @returns {Promise<number>} The id of the created tax rate.
*
* @example
* const id = await store.tax.create(19);
* // => 1
*/
return async (rate, tx) => {
const result = await request(pool, tx)
.input('rate', rate)