part1
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user