This commit is contained in:
seb
2026-10-22 12:30:06 +02:00
parent bb880e3c84
commit 9495ad51cc
27 changed files with 539 additions and 238 deletions

View File

@@ -21,6 +21,21 @@ export default function setOffAll(provider) {
? SQLITE_LIST_CATEGORY_IDS
: MSSQL_LIST_CATEGORY_IDS;
const addCategoryTombstonesSql = `
INSERT INTO posterminaltombstone (posterminal_id, entity_type, entity_id)
SELECT posterminal_id, 'category', category_id
FROM posterminalcategory
WHERE posterminal_id = @posterminalId
`;
const addArticleTombstonesSql = `
INSERT INTO posterminaltombstone (posterminal_id, entity_type, entity_id)
SELECT DISTINCT pc.posterminal_id, 'article', ca.article_id
FROM posterminalcategory pc
INNER JOIN categoryarticle ca ON ca.category_id = pc.category_id
WHERE pc.posterminal_id = @posterminalId
`;
/**
* Removes all category assignments from a posterminal.
*
@@ -49,6 +64,9 @@ export default function setOffAll(provider) {
throw new Error('Posterminal not found');
}
await runner.query(addCategoryTombstonesSql, { posterminalId });
await runner.query(addArticleTombstonesSql, { posterminalId });
await runner.query(setOffAllSql, { posterminalId });
const result = await runner.query(listCatIdsSql, { posterminalId });