u
This commit is contained in:
@@ -43,7 +43,15 @@ export default function create(pool) {
|
||||
.query(CREATE);
|
||||
|
||||
await tx.commit();
|
||||
return result.recordset[0].id;
|
||||
|
||||
return {
|
||||
id: result.recordset[0].id,
|
||||
root_category_id: rootCategoryId,
|
||||
language_id: languageId,
|
||||
taxrate: taxrateId,
|
||||
reducedtaxrate: reducedtaxrateId,
|
||||
taxfreerate: taxfreerateId,
|
||||
};
|
||||
} catch (err) {
|
||||
try {
|
||||
await tx.rollback();
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import sql from 'mssql';
|
||||
import { GET_BY_COMPANY_USER_ID } from '../../sql/company.js';
|
||||
|
||||
export default function getByCompanyUserId(pool) {
|
||||
return async (companyUserId) => {
|
||||
const result = await pool
|
||||
.request()
|
||||
.input('companyUserId', sql.Int, companyUserId)
|
||||
.query(GET_BY_COMPANY_USER_ID);
|
||||
|
||||
const row = result.recordset[0];
|
||||
if (!row) return;
|
||||
|
||||
return [row.id, row.default_language_id, row.root_category_id, row.name];
|
||||
};
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
import sql from 'mssql';
|
||||
import { SET_DEFAULT_LANG } from '../../sql/company.js';
|
||||
|
||||
export default function setDefaultLang(pool) {
|
||||
return async (companyId, languageId) => {
|
||||
await pool
|
||||
.request()
|
||||
.input('companyId', sql.Int, companyId)
|
||||
.input('languageId', sql.Int, languageId)
|
||||
.query(SET_DEFAULT_LANG);
|
||||
};
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
import sql from 'mssql';
|
||||
import { SET_ROOT_CATEGORY } from '../../sql/company.js';
|
||||
|
||||
export default function setRootCategory(pool) {
|
||||
return async (companyId, categoryId) => {
|
||||
await pool
|
||||
.request()
|
||||
.input('companyId', sql.Int, companyId)
|
||||
.input('categoryId', sql.Int, categoryId)
|
||||
.query(SET_ROOT_CATEGORY);
|
||||
};
|
||||
}
|
||||
@@ -42,6 +42,15 @@ export default function update(pool) {
|
||||
.query(UPDATE);
|
||||
|
||||
await tx.commit();
|
||||
|
||||
return {
|
||||
id,
|
||||
root_category_id: company.root_category_id,
|
||||
language_id: languageId,
|
||||
taxrate: taxrateId,
|
||||
reducedtaxrate: reducedtaxrateId,
|
||||
taxfreerate: company.taxfreerate,
|
||||
};
|
||||
} catch (err) {
|
||||
try {
|
||||
await tx.rollback();
|
||||
|
||||
Reference in New Issue
Block a user