u
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user