refactor: introduce database provider abstraction, isolate MSSQL layer
- Add provider contract (src/providers/provider.js): query() -> {rows,
rowsAffected, insertId}, callback transaction(fn), exec() for stored
procs, initialize/purge lifecycle
- Add MssqlProvider (src/providers/mssql/index.js) wrapping an mssql
ConnectionPool with normalized results, tx commit/rollback and
constraint-error classifiers (unique 2627/2601, FK 547)
- LibDashStore constructor now takes a provider instead of a pool
(breaking); adds LibDashStore.create() async factory; keeps pool as
transitional bridge until store modules are converted (see TODO.md)
- Move MSSQL-specific code into the provider: src/sql/* ->
src/providers/mssql/queries/*, src/schema.js ->
src/providers/mssql/schema.js, purge SQL -> purgeSql.js
- Update scripts, generate-schema-graph.js and package.json exports
(./providers/mssql, ./providers/provider)
- Add TODO.md with the remaining provider/SQLite migration plan
No SQL or behavioral changes.
This commit is contained in:
125
TODO.md
Normal file
125
TODO.md
Normal file
@@ -0,0 +1,125 @@
|
||||
# TODO — Database provider reorganization
|
||||
|
||||
Milestones 1–3 are done (provider contract, MSSQL provider, repo reorg).
|
||||
Everything below is outstanding.
|
||||
|
||||
## 1. Convert store modules to the provider API (per area, keep behavior)
|
||||
Replace raw `pool` usage in `src/store/**` with `provider.query()` /
|
||||
`provider.transaction()` / `provider.exec()` and the normalized result shape
|
||||
(`{ rows, rowsAffected, insertId }` instead of `recordset` / `rowsAffected[]`).
|
||||
For every module:
|
||||
- [ ] `pool.request().input(...).query(SQL)` → `provider.query(SQL, params)`
|
||||
- [ ] `pool.transaction(); begin; commit; catch rollback` → `provider.transaction(async (tx) => { ... })`
|
||||
- [ ] `result.recordset` → `result.rows`; `result.rowsAffected[0]` → `result.rowsAffected`
|
||||
- [ ] `request.js` helper (`(tx ?? pool).request()`) becomes obsolete — delete when unused
|
||||
- [ ] `recordset[0].id` after `OUTPUT INSERTED.id` → keep, but prefer `insertId` where trivial
|
||||
|
||||
Conversion order (bottom-up by dependency):
|
||||
- [ ] `lang`, `tax` (leaf helpers, used by company create)
|
||||
- [ ] `google_auth`
|
||||
- [ ] `companyuser` (resolveCompanyAccess / resolveSelectedCompanyAccess first)
|
||||
- [ ] `company`, `companysetting`
|
||||
- [ ] `customergroup`, `entity`, `entityaddress`, `entitycontact`, `entityhistory`
|
||||
- [ ] `unit` (incl. `ensureDefault`), `brand`, `supplier`
|
||||
- [ ] `numbers` (see §2 — stored procs!)
|
||||
- [ ] `category` (recursive CTEs!)
|
||||
- [ ] `article` + articletext/articlepic/articleean/price/articlehistory
|
||||
- [ ] `articlesupplier`
|
||||
- [ ] `quote`, `order`, `delivery` (shared manifest helpers: `manifestLines`, `manifestDoc`, `manifestattachment`)
|
||||
- [ ] `posterminal`, `pic`
|
||||
- [ ] `initialize.js`, `purge.js` final wiring (drop `provider.pool` fallback from `index.js`)
|
||||
- [ ] Delete `src/store/request.js` once no module uses it
|
||||
|
||||
## 2. Replace MSSQL stored procedures (blocker for SQLite)
|
||||
- [ ] `numbers.nextNumber` uses proc `getnextnumberwithprefixandpadding` (output param)
|
||||
- [ ] `numbers.peekNumber` uses proc `peeknextnumberwithprefixandpadding` (output param)
|
||||
- [ ] Implement both in plain JS inside the store layer: `SELECT next/prefix/padding`,
|
||||
compute `prefix + padded next`, `UPDATE numbers SET next = next + 1 WHERE ...`.
|
||||
Must stay atomic: use `provider.transaction()` with row locking semantics
|
||||
(MSSQL: `WITH (UPDLOCK, ROWLOCK)` in the SELECT; SQLite: within its write tx).
|
||||
- [ ] Drop the proc definitions from schema/init scripts (`scripts/init-schema.js`).
|
||||
|
||||
## 3. provider contract additions / hygiene
|
||||
- [ ] Add `isUniqueConstraintError` / `isForeignKeyConstraintError` to the
|
||||
contract and use them in stores instead of raw mssql error numbers
|
||||
(currently error messages like `Customer group in use`, `Brand in use`,
|
||||
`Unit in use` rely on FK/unique detection — grep for these).
|
||||
- [ ] Make `initialize()`/`purge()` real provider methods (schema migrations move
|
||||
into the provider; store delegates). Decide per §5.
|
||||
- [ ] Document provider contract (JSDoc typedef in `src/providers/provider.js`).
|
||||
|
||||
## 4. better-sqlite3 provider
|
||||
- [ ] Add `src/providers/better-sqlite3/index.js` implementing the same contract:
|
||||
- `query()` → prepare + `.all()`/`.get()`/`.run()`; normalize
|
||||
`lastInsertRowid` → `insertId`, `changes` → `rowsAffected`
|
||||
- `transaction(fn)` → `db.transaction()` wrapper (note: better-sqlite3 is sync;
|
||||
wrap in async signature so store code stays unchanged)
|
||||
- Named params: mssql uses `@name`; better-sqlite3 uses `:name` / `@name` /
|
||||
`$name` — define one (e.g. `@name`) in SQLite SQL so params pass through
|
||||
- Pragmas on open: `foreign_keys = ON`, `journal_mode = WAL`, `busy_timeout = 5000`
|
||||
- `BLOB` handling: return `Buffer` for pic/image/attachment binaries
|
||||
- Error classification: unique → `SQLITE_CONSTRAINT_UNIQUE`, FK → `SQLITE_CONSTRAINT_FOREIGNKEY`
|
||||
- Do NOT close the caller-owned db in the provider; expose `close()`
|
||||
- [ ] `better-sqlite3` as peerDependency (optional) in `package.json`
|
||||
- [ ] package.json exports: `"./providers/better-sqlite3"`
|
||||
|
||||
## 5. SQLite schema (native, not mechanically translated)
|
||||
- [ ] `src/providers/better-sqlite3/schema.js` + migrations:
|
||||
- `INT IDENTITY` → `INTEGER PRIMARY KEY` (rowid)
|
||||
- `NVARCHAR(n)` → `TEXT`; `VARBINARY(MAX)` → `BLOB`
|
||||
- `DATETIME2 DEFAULT SYSUTCDATETIME()` → `TEXT` ISO-8601 UTC
|
||||
(`strftime('%Y-%m-%dT%H:%M:%fZ','now')`)
|
||||
- `IF NOT EXISTS ... sys.tables` → `CREATE TABLE IF NOT EXISTS`
|
||||
- `OUTPUT INSERTED...` in queries → `RETURNING ...`
|
||||
- `MERGE companysetting` → `INSERT ... ON CONFLICT ... DO UPDATE`
|
||||
- `[identifier]` brackets → rename or quote (`"number"`)
|
||||
- [ ] **Entity number uniqueness** (MSSQL uses indexed view `v_entity_company_number`):
|
||||
- Add `company_id` column to `entity` (denormalized from customergroup, kept
|
||||
in sync on insert + customergroup moves) and enforce
|
||||
`CREATE UNIQUE INDEX uq_entity_company_number ON entity(company_id, number) WHERE number IS NOT NULL`
|
||||
- Add the equivalent MSSQL migration for parity; remove the indexed view
|
||||
- [ ] Versioned migrations via `meta` table (already exists) instead of pure
|
||||
`IF NOT EXISTS` scripts for both providers
|
||||
- [ ] Implement `initialize()` (migrations) and `purge()` (drop tables, FK-order)
|
||||
in the SQLite provider; port `purgeSql.js` logic (currently topological
|
||||
drop order — replicate)
|
||||
|
||||
## 6. SQL translation per area (SQLite queries)
|
||||
- [ ] `TOP 1` → `LIMIT 1` (mind: TOP without ORDER BY — keep identical ordering)
|
||||
- [ ] `OUTER APPLY (SELECT TOP 1 ...)` (article/category first-pic joins) →
|
||||
correlated subquery or `JOIN` on min(sort,id)
|
||||
- [ ] `FOR JSON PATH` (getBySku, listSearchIndex, listExport, getTreeForCompany) →
|
||||
build JSON in JS from plain rows (preferred: keeps providers dumb)
|
||||
- [ ] Recursive CTEs (`SEARCH_ARTICLES`, `RESOLVE_ARTICLE_ACCESS_BY_SKU`,
|
||||
`GET_CATEGORY_TREE_FLAT`) → SQLite `WITH RECURSIVE` (mostly compatible)
|
||||
- [ ] `ISNULL` / `COALESCE` differences; `FLOAT` vs `REAL`
|
||||
- [ ] Case-insensitive comparisons relying on MSSQL default collation
|
||||
(e.g. name-uniqueness checks) → `COLLATE NOCASE` in SQLite schema or
|
||||
explicit `LOWER()` in both dialects
|
||||
|
||||
## 7. Contract / parity tests
|
||||
- [ ] Test harness that runs the identical suite against both providers
|
||||
(SQLite in-memory for speed; MSSQL in CI)
|
||||
- [ ] Cover: return shapes, auth errors (`No company selected`, `Not authorized`),
|
||||
domain errors, tx rollback, FK/unique behavior (`Brand in use` etc.),
|
||||
binary round-trips (pic, manifestattachment, google_auth picturebinary),
|
||||
date handling, recursive category tree, importRows two-pass V/K linking,
|
||||
numbers.next/peek atomicity
|
||||
- [ ] `scripts/test-api.js`: parametrize over provider
|
||||
- [ ] `scripts/init-schema.js`, `reset-db.js`, `purge-db.js`: accept provider
|
||||
selection (e.g. `--provider=better-sqlite3` / env `DASH_DB_PROVIDER`)
|
||||
|
||||
## 8. Docs & tooling
|
||||
- [ ] README: provider-based usage, both examples, migration notes for dashback
|
||||
- [ ] `API.md` / `API.*.md` generators (`generate-api-doc.js`): update paths if
|
||||
they scan `src/sql` / `src/schema`
|
||||
- [ ] `generate-schema-graph.js` / `schema-graph.dot`: point at both schemas
|
||||
- [ ] Deprecation note: `new LibDashStore(pool)` removed — constructor now takes
|
||||
a provider (breaking change; coordinate with dashback)
|
||||
|
||||
## 9. Cleanup
|
||||
- [ ] Remove transitional `this.pool` / `provider.pool` usage from `index.js`
|
||||
- [ ] Remove `mssql` from peerDependencies only if no runtime coupling remains
|
||||
(queries/schema stay mssql-specific, so likely keep it)
|
||||
- [ ] Decide export for `SCHEMA_SCRIPTS` (currently re-exported from `index.js`
|
||||
from the moved schema file)
|
||||
@@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url';
|
||||
import { Graphviz } from '@hpcc-js/wasm-graphviz';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const schemaPath = join(__dirname, 'src', 'schema.js');
|
||||
const schemaPath = join(__dirname, 'src', 'providers', 'mssql', 'schema.js');
|
||||
const outputPath = join(__dirname, 'schema-graph.svg');
|
||||
const dotOutputPath = join(__dirname, 'schema-graph.dot');
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
"main": "./src/index.js",
|
||||
"exports": {
|
||||
".": "./src/index.js",
|
||||
"./schema": "./src/schema.js"
|
||||
"./schema": "./src/providers/mssql/schema.js",
|
||||
"./providers/mssql": "./src/providers/mssql/index.js",
|
||||
"./providers/provider": "./src/providers/provider.js"
|
||||
},
|
||||
"scripts": {
|
||||
"schema-graph": "node generate-schema-graph.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'dotenv/config';
|
||||
import sql from 'mssql';
|
||||
import { SCHEMA_SCRIPTS } from '../src/schema.js';
|
||||
import { SCHEMA_SCRIPTS } from '../src/providers/mssql/schema.js';
|
||||
|
||||
const config = {
|
||||
server: process.env.MSSQL_SERVER,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'dotenv/config';
|
||||
import sql from 'mssql';
|
||||
import { buildPurgeSql } from '../src/sql/purge.js';
|
||||
import { buildPurgeSql } from '../src/providers/mssql/purgeSql.js';
|
||||
|
||||
const pool = await sql.connect({
|
||||
server: process.env.MSSQL_SERVER,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dotenv/config';
|
||||
import sql from 'mssql';
|
||||
import { buildPurgeSql } from '../src/sql/purge.js';
|
||||
import { SCHEMA_SCRIPTS } from '../src/schema.js';
|
||||
import { buildPurgeSql } from '../src/providers/mssql/purgeSql.js';
|
||||
import { SCHEMA_SCRIPTS } from '../src/providers/mssql/schema.js';
|
||||
|
||||
const pool = await sql.connect({
|
||||
server: process.env.MSSQL_SERVER,
|
||||
|
||||
@@ -4,6 +4,7 @@ import sql from 'mssql';
|
||||
import chalk from 'chalk';
|
||||
import * as p from '@clack/prompts';
|
||||
import LibDashStore from '../src/index.js';
|
||||
import { MssqlProvider } from '../src/providers/mssql/index.js';
|
||||
|
||||
const config = {
|
||||
server: process.env.MSSQL_SERVER,
|
||||
@@ -2004,7 +2005,7 @@ async function main() {
|
||||
spin.message('Initializing schema…');
|
||||
let client;
|
||||
try {
|
||||
client = await new LibDashStore(pool);
|
||||
client = await new LibDashStore(new MssqlProvider(pool));
|
||||
spin.stop(chalk.green('Ready'));
|
||||
} catch (err) {
|
||||
spin.stop(chalk.red('Initialize failed'));
|
||||
|
||||
30
src/index.js
30
src/index.js
@@ -123,7 +123,24 @@ import manifestattachmentGetById from './store/manifestattachment/getById.js';
|
||||
import manifestattachmentOrder from './store/manifestattachment/order.js';
|
||||
|
||||
export default class LibDashStore {
|
||||
constructor(pool) {
|
||||
/**
|
||||
* @param {import('./providers/provider.js').DatabaseProvider} provider
|
||||
*/
|
||||
constructor(provider) {
|
||||
if (
|
||||
!provider ||
|
||||
typeof provider.query !== 'function' ||
|
||||
typeof provider.transaction !== 'function'
|
||||
) {
|
||||
throw new TypeError(
|
||||
'LibDashStore requires a database provider (query/transaction/initialize/purge).',
|
||||
);
|
||||
}
|
||||
|
||||
this.provider = provider;
|
||||
// Transitional: store modules still use the raw mssql pool.
|
||||
// They are converted to provider.query() area by area (see TODO.md).
|
||||
const pool = provider.pool;
|
||||
this.pool = pool;
|
||||
|
||||
this.companyuser = {
|
||||
@@ -317,11 +334,16 @@ export default class LibDashStore {
|
||||
order: manifestattachmentOrder(pool),
|
||||
};
|
||||
|
||||
this.purge = storePurge(pool);
|
||||
this.initialize = storeInitialize(pool);
|
||||
this.purge = storePurge(provider);
|
||||
this.initialize = storeInitialize(provider);
|
||||
|
||||
return this.initialize().then(() => this);
|
||||
}
|
||||
|
||||
/** Recommended async factory (constructor returning a promise is confusing). */
|
||||
static async create(provider) {
|
||||
return new LibDashStore(provider);
|
||||
}
|
||||
}
|
||||
|
||||
export { SCHEMA_SCRIPTS } from './schema.js';
|
||||
export { SCHEMA_SCRIPTS } from './providers/mssql/schema.js';
|
||||
|
||||
126
src/providers/mssql/index.js
Normal file
126
src/providers/mssql/index.js
Normal file
@@ -0,0 +1,126 @@
|
||||
/**
|
||||
* MSSQL provider over an `mssql` ConnectionPool.
|
||||
* Normalizes mssql results into the provider contract shape:
|
||||
* { rows, rowsAffected, insertId }
|
||||
*/
|
||||
|
||||
function normalizeRows(result) {
|
||||
const recordset = result?.recordset ?? [];
|
||||
const affected = Array.isArray(result?.rowsAffected)
|
||||
? result.rowsAffected.reduce((a, b) => a + b, 0)
|
||||
: result?.rowsAffected ?? 0;
|
||||
return { rows: recordset, rowsAffected: affected, insertId: null };
|
||||
}
|
||||
|
||||
export class MssqlExecutor {
|
||||
/** @param {() => import('mssql').Request} requestFactory */
|
||||
constructor(requestFactory) {
|
||||
this.#requestFactory = requestFactory;
|
||||
}
|
||||
|
||||
#requestFactory;
|
||||
|
||||
/** @returns {Promise<import('../provider.js').QueryResult>} */
|
||||
async query(sql, params = {}) {
|
||||
const req = this.#requestFactory();
|
||||
for (const [key, value] of Object.entries(params)) {
|
||||
req.input(key, value);
|
||||
}
|
||||
return normalizeRows(await req.query(sql));
|
||||
}
|
||||
|
||||
/**
|
||||
* Stored-procedure call with input/output params.
|
||||
* Used by numbers.nextNumber / peekNumber
|
||||
* (`getnextnumberwithprefixandpadding`).
|
||||
*/
|
||||
async exec(procName, { inputs = {}, outputs = [] } = {}) {
|
||||
const req = this.#requestFactory();
|
||||
for (const [key, value] of Object.entries(inputs)) {
|
||||
req.input(key, value);
|
||||
}
|
||||
for (const out of outputs) {
|
||||
req.output(out);
|
||||
}
|
||||
const result = await req.execute(procName);
|
||||
return {
|
||||
rows: result.recordset ?? [],
|
||||
rowsAffected: Array.isArray(result.rowsAffected)
|
||||
? result.rowsAffected.reduce((a, b) => a + b, 0)
|
||||
: 0,
|
||||
insertId: null,
|
||||
outputs: result.output ?? {},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export class MssqlProvider {
|
||||
/** @param {import('mssql').ConnectionPool} pool */
|
||||
constructor(pool) {
|
||||
if (!pool || typeof pool.request !== 'function') {
|
||||
throw new TypeError('MssqlProvider requires an mssql ConnectionPool');
|
||||
}
|
||||
this.pool = pool;
|
||||
}
|
||||
|
||||
makeExecutor(requestFactory = () => this.pool.request()) {
|
||||
return new MssqlExecutor(requestFactory);
|
||||
}
|
||||
|
||||
async query(sql, params = {}) {
|
||||
return this.makeExecutor().query(sql, params);
|
||||
}
|
||||
|
||||
async exec(procName, options) {
|
||||
return this.makeExecutor().exec(procName, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs `fn(runner)` inside a transaction. Commit on success,
|
||||
* rollback on error. `runner` has query/exec like the provider.
|
||||
*
|
||||
* @template T
|
||||
* @param {(runner: MssqlExecutor) => Promise<T>} fn
|
||||
* @returns {Promise<T>}
|
||||
*/
|
||||
async transaction(fn) {
|
||||
const tx = this.pool.transaction();
|
||||
await tx.begin();
|
||||
try {
|
||||
const runner = this.makeExecutor(() => tx.request());
|
||||
const result = await fn(runner);
|
||||
await tx.commit();
|
||||
return result;
|
||||
} catch (err) {
|
||||
try {
|
||||
await tx.rollback();
|
||||
} catch {
|
||||
// ignore rollback failure after original error
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
async initialize() {
|
||||
// Implemented by store/initialize.js — no-op here (keeps parity with
|
||||
// other providers, which may run migrations internally instead).
|
||||
}
|
||||
|
||||
async purge() {
|
||||
// Implemented by store/purge.js — no-op here.
|
||||
}
|
||||
|
||||
close() {
|
||||
return this.pool.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** mssql: 2627 = PK/unique violation, 2601 = unique index violation */
|
||||
export function isUniqueConstraintError(err) {
|
||||
return err?.number === 2627 || err?.number === 2601;
|
||||
}
|
||||
|
||||
/** mssql: 547 = FK conflict */
|
||||
export function isForeignKeyConstraintError(err) {
|
||||
return err?.number === 547;
|
||||
}
|
||||
40
src/providers/provider.js
Normal file
40
src/providers/provider.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Database provider contract for LibDashStore.
|
||||
*
|
||||
* A provider wraps a concrete database driver and exposes:
|
||||
* - query(sql, params) -> { rows, rowsAffected, insertId }
|
||||
* - transaction(fn) -> runs fn(runner) in a tx, commit/rollback
|
||||
* - exec(proc, {inputs,outputs}) -> stored procedure call (optional capability)
|
||||
* - initialize() / purge() -> schema lifecycle
|
||||
* - pool -> the underlying driver handle (transitional)
|
||||
*
|
||||
* @typedef {Object} QueryResult
|
||||
* @property {Array<Object>} rows Result rows (mssql `recordset` equivalent).
|
||||
* @property {number} rowsAffected Number of affected rows (mssql `rowsAffected[0]`).
|
||||
* @property {number|null} insertId Last inserted id when applicable, else null.
|
||||
*
|
||||
* @typedef {Object} DatabaseProvider
|
||||
* @property {(sql: string, params?: Object<string, *>) => Promise<QueryResult>} query
|
||||
* @property {(fn: (runner: DatabaseProvider) => Promise<*>) => Promise<*>} transaction
|
||||
* @property {() => Promise<void>} initialize
|
||||
* @property {() => Promise<void>} purge
|
||||
* @property {*} pool
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks whether an error is a unique-constraint violation.
|
||||
* @param {unknown} err
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isUniqueConstraintError(err) {
|
||||
throw new Error('Not implemented: isUniqueConstraintError');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether an error is a foreign-key-constraint violation.
|
||||
* @param {unknown} err
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isForeignKeyConstraintError(err) {
|
||||
throw new Error('Not implemented: isForeignKeyConstraintError');
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ADD as ADD_ARTICLEPIC, GET_NEXT_SORT } from '../../sql/articlepic.js';
|
||||
import { CREATE as CREATE_PIC } from '../../sql/pic.js';
|
||||
import { ADD as ADD_ARTICLEPIC, GET_NEXT_SORT } from '../../providers/mssql/queries/articlepic.js';
|
||||
import { CREATE as CREATE_PIC } from '../../providers/mssql/queries/pic.js';
|
||||
import processAvifImage from '../../util/processAvifImage.js';
|
||||
import newFullHash from '../../util/newFullHash.js';
|
||||
import request from '../request.js';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { CREATE } from '../../sql/article.js';
|
||||
import { ADD as ADD_CATEGORYARTICLE } from '../../sql/categoryarticle.js';
|
||||
import { CREATE as CREATE_ARTICLETEXT } from '../../sql/articletext.js';
|
||||
import { INSERT as INSERT_HISTORY } from '../../sql/articlehistory.js';
|
||||
import { CREATE } from '../../providers/mssql/queries/article.js';
|
||||
import { ADD as ADD_CATEGORYARTICLE } from '../../providers/mssql/queries/categoryarticle.js';
|
||||
import { CREATE as CREATE_ARTICLETEXT } from '../../providers/mssql/queries/articletext.js';
|
||||
import { INSERT as INSERT_HISTORY } from '../../providers/mssql/queries/articlehistory.js';
|
||||
import resolveCategoryAccess from '../category/resolveCategoryAccess.js';
|
||||
import ensureDefaultUnit from '../unit/ensureDefault.js';
|
||||
import nextSku from '../numbers/nextSku.js';
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
DELETE_PICS_BY_ARTICLE,
|
||||
GET_CHILD_COUNT,
|
||||
GET_LIST_IDS,
|
||||
} from '../../sql/articleDelete.js';
|
||||
} from '../../providers/mssql/queries/articleDelete.js';
|
||||
import resolveArticleBySku from './resolveArticleBySku.js';
|
||||
import request from '../request.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DELETE_BY_ARTICLE_AND_HASH } from '../../sql/pic.js';
|
||||
import { DELETE_BY_ARTICLE_AND_HASH } from '../../providers/mssql/queries/pic.js';
|
||||
import resolveArticleBySku from './resolveArticleBySku.js';
|
||||
|
||||
export default function deleteImage(pool) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GET_ARTICLE_BY_SKU_FULL } from '../../sql/article.js';
|
||||
import { GET_ARTICLE_BY_SKU_FULL } from '../../providers/mssql/queries/article.js';
|
||||
|
||||
function parseJsonArray(raw) {
|
||||
if (!raw) return [];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { LIST_BY_ARTICLE_ID } from '../../sql/articlehistory.js';
|
||||
import { LIST_BY_ARTICLE_ID } from '../../providers/mssql/queries/articlehistory.js';
|
||||
import resolveArticleBySku from './resolveArticleBySku.js';
|
||||
|
||||
export default function getHistoryBySku(pool) {
|
||||
|
||||
@@ -7,14 +7,14 @@ import {
|
||||
SET_IS_FATHER,
|
||||
UPDATE_BRAND,
|
||||
UPDATE_FATHER_BY_SKU,
|
||||
} from '../../sql/article.js';
|
||||
import { ADD as ADD_CATEGORYARTICLE } from '../../sql/categoryarticle.js';
|
||||
import { CREATE as CREATE_ARTICLETEXT } from '../../sql/articletext.js';
|
||||
import { INSERT as INSERT_HISTORY } from '../../sql/articlehistory.js';
|
||||
import { GET_CHILD_COUNT } from '../../sql/articleDelete.js';
|
||||
import { CREATE as CREATE_BRAND, GET_BY_COMPANY_AND_NAME } from '../../sql/brand.js';
|
||||
import { CREATE as CREATE_PRICE } from '../../sql/price.js';
|
||||
import { CREATE as CREATE_TAX, GET_BY_RATE } from '../../sql/tax.js';
|
||||
} from '../../providers/mssql/queries/article.js';
|
||||
import { ADD as ADD_CATEGORYARTICLE } from '../../providers/mssql/queries/categoryarticle.js';
|
||||
import { CREATE as CREATE_ARTICLETEXT } from '../../providers/mssql/queries/articletext.js';
|
||||
import { INSERT as INSERT_HISTORY } from '../../providers/mssql/queries/articlehistory.js';
|
||||
import { GET_CHILD_COUNT } from '../../providers/mssql/queries/articleDelete.js';
|
||||
import { CREATE as CREATE_BRAND, GET_BY_COMPANY_AND_NAME } from '../../providers/mssql/queries/brand.js';
|
||||
import { CREATE as CREATE_PRICE } from '../../providers/mssql/queries/price.js';
|
||||
import { CREATE as CREATE_TAX, GET_BY_RATE } from '../../providers/mssql/queries/tax.js';
|
||||
import request from '../request.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
import ensureByPath from '../category/ensureByPath.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GET_ARTICLE_EXPORT, GET_CATEGORY_TREE_FLAT } from '../../sql/article.js';
|
||||
import { GET_ARTICLE_EXPORT, GET_CATEGORY_TREE_FLAT } from '../../providers/mssql/queries/article.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
import resolveCategoryAccess from '../category/resolveCategoryAccess.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SEARCH_ARTICLES } from '../../sql/article.js';
|
||||
import { SEARCH_ARTICLES } from '../../providers/mssql/queries/article.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
|
||||
export default function listSearchIndex(pool) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
LIST_HASHES_BY_ARTICLE,
|
||||
SET_TEMP_SORTS,
|
||||
UPDATE_SORT_BY_HASH,
|
||||
} from '../../sql/articlepic.js';
|
||||
} from '../../providers/mssql/queries/articlepic.js';
|
||||
import resolveArticleBySku from './resolveArticleBySku.js';
|
||||
import request from '../request.js';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
GET_EANS_BY_ARTICLE_ID,
|
||||
GET_PHOTOS_BY_ARTICLE_ID,
|
||||
GET_PRICES_BY_ARTICLE_ID,
|
||||
} from '../../sql/articleDetail.js';
|
||||
} from '../../providers/mssql/queries/articleDetail.js';
|
||||
|
||||
function shapeArticleDetail(row, categoryIds, photos, eans, prices) {
|
||||
return {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { RESOLVE_ARTICLE_ACCESS_BY_SKU } from '../../sql/article.js';
|
||||
import { RESOLVE_ARTICLE_ACCESS_BY_SKU } from '../../providers/mssql/queries/article.js';
|
||||
|
||||
export default function resolveArticleBySku(pool) {
|
||||
return async (googleAuthId, sku) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
GET_BRAND_BY_COMPANY_AND_ID,
|
||||
UPDATE_BRAND,
|
||||
} from '../../sql/article.js';
|
||||
} from '../../providers/mssql/queries/article.js';
|
||||
import queryBySku from './queryBySku.js';
|
||||
import resolveArticleBySku from './resolveArticleBySku.js';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
ADD_CATEGORY,
|
||||
DELETE_CATEGORIES_BY_ARTICLE,
|
||||
} from '../../sql/article.js';
|
||||
} from '../../providers/mssql/queries/article.js';
|
||||
import request from '../request.js';
|
||||
import resolveCategoryAccess from '../category/resolveCategoryAccess.js';
|
||||
import queryBySku from './queryBySku.js';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
ADD_EAN,
|
||||
DELETE_EANS_BY_ARTICLE,
|
||||
} from '../../sql/article.js';
|
||||
} from '../../providers/mssql/queries/article.js';
|
||||
import request from '../request.js';
|
||||
import queryBySku from './queryBySku.js';
|
||||
import resolveArticleBySku from './resolveArticleBySku.js';
|
||||
|
||||
@@ -3,8 +3,8 @@ import {
|
||||
SET_FATHER_SORT,
|
||||
SET_IS_FATHER,
|
||||
UPDATE_FATHER_BY_SKU,
|
||||
} from '../../sql/article.js';
|
||||
import { GET_CHILD_COUNT } from '../../sql/articleDelete.js';
|
||||
} from '../../providers/mssql/queries/article.js';
|
||||
import { GET_CHILD_COUNT } from '../../providers/mssql/queries/articleDelete.js';
|
||||
import request from '../request.js';
|
||||
import queryBySku from './queryBySku.js';
|
||||
import resolveArticleBySku from './resolveArticleBySku.js';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
CREATE as CREATE_PRICE,
|
||||
DELETE_BY_ARTICLE_AND_CUSTOMERGROUP,
|
||||
} from '../../sql/price.js';
|
||||
} from '../../providers/mssql/queries/price.js';
|
||||
import request from '../request.js';
|
||||
import taxEnsure from '../tax/ensure.js';
|
||||
import queryBySku from './queryBySku.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UPDATE_WEIGHT } from '../../sql/article.js';
|
||||
import { UPDATE_WEIGHT } from '../../providers/mssql/queries/article.js';
|
||||
import queryBySku from './queryBySku.js';
|
||||
import resolveArticleBySku from './resolveArticleBySku.js';
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@ import {
|
||||
UPDATE_UNIT,
|
||||
UPDATE_UNITAMOUNT,
|
||||
UPDATE_UNIT_AND_AMOUNT,
|
||||
} from '../../sql/article.js';
|
||||
import { INSERT as INSERT_HISTORY } from '../../sql/articlehistory.js';
|
||||
import { UPDATE_BY_ARTICLE_AND_LANGUAGE } from '../../sql/articletext.js';
|
||||
import { GET_DETAIL_BY_ARTICLE_ID } from '../../sql/articleDetail.js';
|
||||
import { GET_FULL_BY_SI } from '../../sql/unit.js';
|
||||
} from '../../providers/mssql/queries/article.js';
|
||||
import { INSERT as INSERT_HISTORY } from '../../providers/mssql/queries/articlehistory.js';
|
||||
import { UPDATE_BY_ARTICLE_AND_LANGUAGE } from '../../providers/mssql/queries/articletext.js';
|
||||
import { GET_DETAIL_BY_ARTICLE_ID } from '../../providers/mssql/queries/articleDetail.js';
|
||||
import { GET_FULL_BY_SI } from '../../providers/mssql/queries/unit.js';
|
||||
import request from '../request.js';
|
||||
import queryBySku from './queryBySku.js';
|
||||
import resolveArticleBySku from './resolveArticleBySku.js';
|
||||
|
||||
@@ -3,8 +3,8 @@ import {
|
||||
CREATE as CREATE_ARTICLE_SUPPLIER,
|
||||
GET_BY_ID_AND_ARTICLE_ID,
|
||||
GET_NEXT_SORT,
|
||||
} from '../../sql/articlesupplier.js';
|
||||
import { CREATE as CREATE_PRICE } from '../../sql/price.js';
|
||||
} from '../../providers/mssql/queries/articlesupplier.js';
|
||||
import { CREATE as CREATE_PRICE } from '../../providers/mssql/queries/price.js';
|
||||
import request from '../request.js';
|
||||
import resolveArticleBySku from '../article/resolveArticleBySku.js';
|
||||
import ensureLieferantenGroup from '../supplier/ensureLieferantenGroup.js';
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
DELETE_BY_ID_AND_ARTICLE_ID,
|
||||
DELETE_PRICE,
|
||||
GET_BY_ID_AND_ARTICLE_ID,
|
||||
} from '../../sql/articlesupplier.js';
|
||||
} from '../../providers/mssql/queries/articlesupplier.js';
|
||||
import request from '../request.js';
|
||||
import resolveArticleBySku from '../article/resolveArticleBySku.js';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { GET_SUPPLIER_BY_ID, SUPPLIER_GROUP_NAME } from '../../sql/entity.js';
|
||||
import { GET_COMPANY_DEFAULT_TAX } from '../../sql/articlesupplier.js';
|
||||
import { GET_SUPPLIER_BY_ID, SUPPLIER_GROUP_NAME } from '../../providers/mssql/queries/entity.js';
|
||||
import { GET_COMPANY_DEFAULT_TAX } from '../../providers/mssql/queries/articlesupplier.js';
|
||||
import request from '../request.js';
|
||||
|
||||
export function optionalString(value) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { LIST_BY_ARTICLE_ID } from '../../sql/articlesupplier.js';
|
||||
import { LIST_BY_ARTICLE_ID } from '../../providers/mssql/queries/articlesupplier.js';
|
||||
import resolveArticleBySku from '../article/resolveArticleBySku.js';
|
||||
import { shapeArticleSupplier } from './helpers.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { LIST_BY_ENTITY_AND_SKUS } from '../../sql/articlesupplier.js';
|
||||
import { LIST_BY_ENTITY_AND_SKUS } from '../../providers/mssql/queries/articlesupplier.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
import { assertSupplier } from './helpers.js';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
LIST_IDS_BY_ARTICLE,
|
||||
SET_TEMP_SORTS,
|
||||
UPDATE_SORT,
|
||||
} from '../../sql/articlesupplier.js';
|
||||
} from '../../providers/mssql/queries/articlesupplier.js';
|
||||
import request from '../request.js';
|
||||
import resolveArticleBySku from '../article/resolveArticleBySku.js';
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ import {
|
||||
GET_BY_ID_AND_ARTICLE_ID,
|
||||
UPDATE as UPDATE_ARTICLE_SUPPLIER,
|
||||
UPDATE_PRICE,
|
||||
} from '../../sql/articlesupplier.js';
|
||||
import { CREATE as CREATE_PRICE } from '../../sql/price.js';
|
||||
} from '../../providers/mssql/queries/articlesupplier.js';
|
||||
import { CREATE as CREATE_PRICE } from '../../providers/mssql/queries/price.js';
|
||||
import request from '../request.js';
|
||||
import resolveArticleBySku from '../article/resolveArticleBySku.js';
|
||||
import ensureLieferantenGroup from '../supplier/ensureLieferantenGroup.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DELETE_BY_COMPANY_AND_ID } from '../../sql/brand.js';
|
||||
import { DELETE_BY_COMPANY_AND_ID } from '../../providers/mssql/queries/brand.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
|
||||
export default function del(pool) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { LIST_BY_COMPANY } from '../../sql/brand.js';
|
||||
import { LIST_BY_COMPANY } from '../../providers/mssql/queries/brand.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
|
||||
export default function list(pool) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
CREATE,
|
||||
GET_BY_COMPANY_AND_NAME,
|
||||
UPDATE_BY_ID,
|
||||
} from '../../sql/brand.js';
|
||||
} from '../../providers/mssql/queries/brand.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
|
||||
export default function upsert(pool) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ADD as ADD_CATEGORYPIC, GET_NEXT_SORT } from '../../sql/categorypic.js';
|
||||
import { CREATE as CREATE_PIC } from '../../sql/pic.js';
|
||||
import { ADD as ADD_CATEGORYPIC, GET_NEXT_SORT } from '../../providers/mssql/queries/categorypic.js';
|
||||
import { CREATE as CREATE_PIC } from '../../providers/mssql/queries/pic.js';
|
||||
import processAvifImage from '../../util/processAvifImage.js';
|
||||
import newFullHash from '../../util/newFullHash.js';
|
||||
import request from '../request.js';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
CREATE,
|
||||
GET_NEXT_SIBLING_SORT,
|
||||
} from '../../sql/category.js';
|
||||
import { CREATE as CREATE_CATEGORYTEXT } from '../../sql/categorytext.js';
|
||||
} from '../../providers/mssql/queries/category.js';
|
||||
import { CREATE as CREATE_CATEGORYTEXT } from '../../providers/mssql/queries/categorytext.js';
|
||||
import resolveCategoryAccess from './resolveCategoryAccess.js';
|
||||
import request from '../request.js';
|
||||
import slugify from '../slugify.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DELETE } from '../../sql/category.js';
|
||||
import { DELETE } from '../../providers/mssql/queries/category.js';
|
||||
import resolveCategoryAccess from './resolveCategoryAccess.js';
|
||||
|
||||
export default function del(pool) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DELETE_BY_CATEGORY } from '../../sql/categorypic.js';
|
||||
import { DELETE_BY_CATEGORY } from '../../providers/mssql/queries/categorypic.js';
|
||||
import resolveCategoryAccess from './resolveCategoryAccess.js';
|
||||
|
||||
export default function deleteImage(pool) {
|
||||
|
||||
@@ -2,8 +2,8 @@ import {
|
||||
CREATE,
|
||||
GET_BY_PARENT_AND_NAME,
|
||||
GET_NEXT_SIBLING_SORT,
|
||||
} from '../../sql/category.js';
|
||||
import { CREATE as CREATE_CATEGORYTEXT } from '../../sql/categorytext.js';
|
||||
} from '../../providers/mssql/queries/category.js';
|
||||
import { CREATE as CREATE_CATEGORYTEXT } from '../../providers/mssql/queries/categorytext.js';
|
||||
import resolveCategoryAccess from './resolveCategoryAccess.js';
|
||||
import request from '../request.js';
|
||||
import slugify from '../slugify.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GET_TREE_FOR_COMPANY } from '../../sql/category.js';
|
||||
import { GET_TREE_FOR_COMPANY } from '../../providers/mssql/queries/category.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
import queryCategoryArticles from './queryCategoryArticles.js';
|
||||
import getCategoryPosterminalIds from '../posterminal/getCategoryPosterminalIds.js';
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
GET_NEXT_SIBLING_SORT,
|
||||
IS_ANCESTOR,
|
||||
MOVE,
|
||||
} from '../../sql/category.js';
|
||||
} from '../../providers/mssql/queries/category.js';
|
||||
import request from '../request.js';
|
||||
import resolveCategoryAccess from './resolveCategoryAccess.js';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
LIST_CHILD_IDS,
|
||||
UPDATE_SORT,
|
||||
} from '../../sql/category.js';
|
||||
} from '../../providers/mssql/queries/category.js';
|
||||
import request from '../request.js';
|
||||
import resolveCategoryAccess from './resolveCategoryAccess.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GET_CATEGORY_ARTICLES } from '../../sql/category.js';
|
||||
import { GET_CATEGORY_ARTICLES } from '../../providers/mssql/queries/category.js';
|
||||
|
||||
export default function queryCategoryArticles(pool) {
|
||||
return async ({ categoryId, languageId, posCustomerGroupId }) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UPDATE_BY_CATEGORY_AND_LANGUAGE } from '../../sql/categorytext.js';
|
||||
import { UPDATE_BY_CATEGORY_AND_LANGUAGE } from '../../providers/mssql/queries/categorytext.js';
|
||||
import resolveCategoryAccess from './resolveCategoryAccess.js';
|
||||
import slugify from '../slugify.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { RESOLVE_CATEGORY_ACCESS } from '../../sql/category.js';
|
||||
import { RESOLVE_CATEGORY_ACCESS } from '../../providers/mssql/queries/category.js';
|
||||
|
||||
export default function resolveCategoryAccess(pool) {
|
||||
return async (googleAuthId, categoryId) => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { POS_GROUP_NAME } from '../../sql/entity.js';
|
||||
import { CREATE } from '../../sql/company.js';
|
||||
import { CREATE as CREATE_CATEGORY } from '../../sql/category.js';
|
||||
import { POS_GROUP_NAME } from '../../providers/mssql/queries/entity.js';
|
||||
import { CREATE } from '../../providers/mssql/queries/company.js';
|
||||
import { CREATE as CREATE_CATEGORY } from '../../providers/mssql/queries/category.js';
|
||||
import {
|
||||
CREATE_WITHOUT_COMPANY as CREATE_CUSTOMERGROUP,
|
||||
SET_COMPANY as SET_CUSTOMERGROUP_COMPANY,
|
||||
} from '../../sql/customergroup.js';
|
||||
import { ADD as ADD_COMPANYUSER } from '../../sql/companyuser.js';
|
||||
} from '../../providers/mssql/queries/customergroup.js';
|
||||
import { ADD as ADD_COMPANYUSER } from '../../providers/mssql/queries/companyuser.js';
|
||||
import getByName from './getByName.js';
|
||||
import langEnsure from '../lang/ensure.js';
|
||||
import taxEnsure from '../tax/ensure.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DELETE } from '../../sql/company.js';
|
||||
import { DELETE } from '../../providers/mssql/queries/company.js';
|
||||
|
||||
export default function del(pool) {
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GET_BY_ID } from '../../sql/company.js';
|
||||
import { GET_BY_ID } from '../../providers/mssql/queries/company.js';
|
||||
import request from '../request.js';
|
||||
|
||||
export default function getById(pool) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GET_BY_NAME } from '../../sql/company.js';
|
||||
import { GET_BY_NAME } from '../../providers/mssql/queries/company.js';
|
||||
import request from '../request.js';
|
||||
|
||||
export default function getByName(pool) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { LIST } from '../../sql/company.js';
|
||||
import { LIST } from '../../providers/mssql/queries/company.js';
|
||||
|
||||
export default function list(pool) {
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UPDATE } from '../../sql/company.js';
|
||||
import { UPDATE } from '../../providers/mssql/queries/company.js';
|
||||
import getById from './getById.js';
|
||||
import getByName from './getByName.js';
|
||||
import langEnsure from '../lang/ensure.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GET_BY_COMPANY_AND_KEY } from '../../sql/companysetting.js';
|
||||
import { GET_BY_COMPANY_AND_KEY } from '../../providers/mssql/queries/companysetting.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
import shapeSetting from './shapeSetting.js';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
LIST_BY_COMPANY,
|
||||
LIST_BY_COMPANY_FRONTEND,
|
||||
} from '../../sql/companysetting.js';
|
||||
} from '../../providers/mssql/queries/companysetting.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
import shapeSetting from './shapeSetting.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GET_BY_COMPANY_AND_KEY, UPSERT } from '../../sql/companysetting.js';
|
||||
import { GET_BY_COMPANY_AND_KEY, UPSERT } from '../../providers/mssql/queries/companysetting.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
import shapeSetting from './shapeSetting.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ADD } from '../../sql/companyuser.js';
|
||||
import { ADD } from '../../providers/mssql/queries/companyuser.js';
|
||||
|
||||
export default function add(pool) {
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DELETE } from '../../sql/companyuser.js';
|
||||
import { DELETE } from '../../providers/mssql/queries/companyuser.js';
|
||||
|
||||
export default function del(pool) {
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GET_BY_EMAIL } from '../../sql/companyuser.js';
|
||||
import { GET_BY_EMAIL } from '../../providers/mssql/queries/companyuser.js';
|
||||
|
||||
export default function getByEmail(pool) {
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GET_COMPANY_ACCESS } from '../../sql/companyuser.js';
|
||||
import { GET_COMPANY_ACCESS } from '../../providers/mssql/queries/companyuser.js';
|
||||
|
||||
export default function resolveCompanyAccess(pool) {
|
||||
return async (googleAuthId, companyId) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { GET_BY_ID } from '../../sql/google_auth.js';
|
||||
import { GET_BY_ID } from '../../providers/mssql/queries/google_auth.js';
|
||||
import resolveCompanyAccess from './resolveCompanyAccess.js';
|
||||
|
||||
export default function resolveSelectedCompanyAccess(pool) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CREATE, GET_NEXT_SORT } from '../../sql/customergroup.js';
|
||||
import { POS_GROUP_NAME, SUPPLIER_GROUP_NAME } from '../../sql/entity.js';
|
||||
import { CREATE, GET_NEXT_SORT } from '../../providers/mssql/queries/customergroup.js';
|
||||
import { POS_GROUP_NAME, SUPPLIER_GROUP_NAME } from '../../providers/mssql/queries/entity.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
|
||||
const RESERVED_NAMES = new Set([POS_GROUP_NAME, SUPPLIER_GROUP_NAME]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DELETE_BY_COMPANY_AND_ID } from '../../sql/customergroup.js';
|
||||
import { DELETE_BY_COMPANY_AND_ID } from '../../providers/mssql/queries/customergroup.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
|
||||
export default function del(pool) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user