u
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import sql from 'mssql';
|
||||
import { UPDATE } from '../../sql/company.js';
|
||||
import getById from './getById.js';
|
||||
import getByName from './getByName.js';
|
||||
@@ -13,7 +12,7 @@ export default function update(pool) {
|
||||
const ensureTax = taxEnsure(pool);
|
||||
|
||||
return async (id, { iso639, name, taxrate, reducedtaxrate }) => {
|
||||
const tx = new sql.Transaction(pool);
|
||||
const tx = pool.transaction();
|
||||
await tx.begin();
|
||||
|
||||
try {
|
||||
@@ -34,11 +33,11 @@ export default function update(pool) {
|
||||
const reducedtaxrateId = await ensureTax(reducedtaxrate, tx);
|
||||
|
||||
await request(pool, tx)
|
||||
.input('id', sql.Int, id)
|
||||
.input('name', sql.NVarChar(255), name)
|
||||
.input('languageId', sql.Int, languageId)
|
||||
.input('taxrate', sql.Int, taxrateId)
|
||||
.input('reducedtaxrate', sql.Int, reducedtaxrateId)
|
||||
.input('id', id)
|
||||
.input('name', name)
|
||||
.input('languageId', languageId)
|
||||
.input('taxrate', taxrateId)
|
||||
.input('reducedtaxrate', reducedtaxrateId)
|
||||
.query(UPDATE);
|
||||
|
||||
await tx.commit();
|
||||
|
||||
Reference in New Issue
Block a user