u
This commit is contained in:
@@ -147,6 +147,21 @@ export default function addChild(provider) {
|
||||
});
|
||||
const childId = childRes.rows[0]?.id ?? childRes.insertId;
|
||||
|
||||
// Copy existing attribute values from father (ancestor attributes that father has)
|
||||
const fatherAttrsRes = await runner.query(
|
||||
'SELECT attributevalue_id, sort FROM articleattributevalue WHERE article_id = @fatherId',
|
||||
{ fatherId },
|
||||
);
|
||||
for (const faRow of fatherAttrsRes.rows) {
|
||||
if (faRow.attributevalue_id !== finalValueId) {
|
||||
await runner.query(articleAttrValQueries.INSERT_ROW, {
|
||||
articleId: childId,
|
||||
attributeValueId: faRow.attributevalue_id,
|
||||
sort: faRow.sort,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Link articleattributevalue
|
||||
await runner.query(articleAttrValQueries.INSERT_ROW, {
|
||||
articleId: childId,
|
||||
|
||||
Reference in New Issue
Block a user