providerrefactor part1

This commit is contained in:
seb
2026-09-21 03:33:55 +02:00
parent 53a20c4353
commit 4ed6260e91
57 changed files with 1662 additions and 145 deletions

View File

@@ -0,0 +1,25 @@
import * as source from '../../mssql/queries/posterminal.js';
import { translateQueries } from './translate.js';
const queries = translateQueries(source, 'posterminal');
export const {
CREATE, DELETE_BY_COMPANY_AND_ID, GET_BY_ID, LIST_BY_COMPANY,
LIST_CATEGORY_IDS, POSTERMINAL_IDS_BY_COMPANY, SET_OFF, SET_OFF_ALL, UPDATE,
} = queries;
export const SET_ON = `
INSERT INTO posterminalcategory (posterminal_id, category_id)
VALUES (@posterminalId, @categoryId)
ON CONFLICT (posterminal_id, category_id) DO NOTHING
`;
export const SET_ON_ALL = `
WITH RECURSIVE cats AS (
SELECT id FROM category WHERE id = @rootCategoryId
UNION ALL
SELECT c.id FROM category c INNER JOIN cats ON c.parent_id = cats.id
)
INSERT INTO posterminalcategory (posterminal_id, category_id)
SELECT @posterminalId, id FROM cats WHERE 1
ON CONFLICT (posterminal_id, category_id) DO NOTHING
`;