This commit is contained in:
seb
2026-07-31 05:57:23 +02:00
parent b99c3a9ec7
commit 02bca8e236
14 changed files with 93 additions and 132 deletions

View File

@@ -2,10 +2,10 @@ import sql from 'mssql';
import { CREATE } from '../../sql/category.js';
export default function create(pool) {
return async ({ parent_id, sort }) => {
return async ({ parentId, sort }) => {
const result = await pool
.request()
.input('parentId', sql.Int, parent_id)
.input('parentId', sql.Int, parentId)
.input('sort', sql.Int, sort)
.query(CREATE);

View File

@@ -46,11 +46,11 @@ export default function create(pool) {
return {
id: result.recordset[0].id,
root_category_id: rootCategoryId,
language_id: languageId,
taxrate_id: taxrateId,
reducedtaxrate_id: reducedtaxrateId,
taxfreerate_id: taxfreerateId,
rootCategoryId,
languageId,
taxrateId,
reducedtaxrateId,
taxfreerateId,
};
} catch (err) {
try {

View File

@@ -45,11 +45,11 @@ export default function update(pool) {
return {
id,
root_category_id: company.root_category_id,
language_id: languageId,
taxrate_id: taxrateId,
reducedtaxrate_id: reducedtaxrateId,
taxfreerate_id: company.taxfreerate,
rootCategoryId: company.root_category_id,
languageId,
taxrateId,
reducedtaxrateId,
taxfreerateId: company.taxfreerate,
};
} catch (err) {
try {

View File

@@ -1,11 +0,0 @@
import sql from 'mssql';
import { DEL } from '../../sql/google_auth.js';
export default function del(pool) {
return async (id) => {
await pool
.request()
.input('id', sql.Int, id)
.query(DEL);
};
}

View File

@@ -1,13 +0,0 @@
import sql from 'mssql';
import { GET_BY_ID } from '../../sql/google_auth.js';
export default function getById(pool) {
return async (id) => {
const result = await pool
.request()
.input('id', sql.Int, id)
.query(GET_BY_ID);
return result.recordset[0];
};
}

View File

@@ -1,8 +0,0 @@
import { LIST } from '../../sql/google_auth.js';
export default function list(pool) {
return async () => {
const result = await pool.request().query(LIST);
return result.recordset;
};
}

View File

@@ -0,0 +1,8 @@
import { LIST_ALLOWED_EMAILS } from '../../sql/google_auth.js';
export default function listAllowedEmails(pool) {
return async () => {
const result = await pool.request().query(LIST_ALLOWED_EMAILS);
return result.recordset;
};
}

View File

@@ -0,0 +1,11 @@
import sql from 'mssql';
import { REMOVE_ALLOWED_EMAIL } from '../../sql/google_auth.js';
export default function removeAllowedEmail(pool) {
return async (email) => {
await pool
.request()
.input('email', sql.NVarChar(320), email)
.query(REMOVE_ALLOWED_EMAIL);
};
}