u
This commit is contained in:
@@ -4,16 +4,14 @@ import {
|
||||
import {
|
||||
DELETE_BY_ARTICLE_AND_PROPERTY_ID as SQLITE_DELETE,
|
||||
} from '../../providers/sqlite3/queries/articleproperty.js';
|
||||
import { INSERT as MSSQL_INSERT_HISTORY } from '../../providers/mssql/queries/articlehistory.js';
|
||||
import { INSERT as SQLITE_INSERT_HISTORY } from '../../providers/sqlite3/queries/articlehistory.js';
|
||||
import resolveArticleBySku from '../article/resolveArticleBySku.js';
|
||||
import { recordPropertyDeleteHistory } from '../articlehistory/record.js';
|
||||
import makeRunner from '../runner.js';
|
||||
|
||||
export default function deleteArticleProperty(provider) {
|
||||
const resolve = resolveArticleBySku(provider);
|
||||
const isSqlite = provider?.dialect === 'sqlite3';
|
||||
const deleteSql = isSqlite ? SQLITE_DELETE : MSSQL_DELETE;
|
||||
const insertHistorySql = isSqlite ? SQLITE_INSERT_HISTORY : MSSQL_INSERT_HISTORY;
|
||||
|
||||
/**
|
||||
* Deletes a property from an article by SKU and propertyId.
|
||||
@@ -41,10 +39,11 @@ export default function deleteArticleProperty(provider) {
|
||||
await runner.query(deleteSql, { articleId, propertyId });
|
||||
|
||||
if (prop) {
|
||||
await runner.query(insertHistorySql, {
|
||||
await recordPropertyDeleteHistory(runner, {
|
||||
articleId,
|
||||
companyuserId,
|
||||
text: `Eigenschaft "${prop.name}" (${prop.value}) gelöscht`,
|
||||
name: prop.name,
|
||||
value: prop.value,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user