Skip to content

Commit dc4ac58

Browse files
author
Ajit Kumar
committed
fix(plugin): enhance deletion logic to remove associated purchase orders
1 parent 465f2ed commit dc4ac58

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

server/entities/plugin.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ class Plugin extends Entity {
142142
throw new Error('Plugin not found');
143143
}
144144

145-
await Entity.execSql('DELETE FROM comment WHERE plugin_id = ?', [row.id]);
146-
await Entity.execSql('DELETE FROM download WHERE plugin_id = ?', [row.id]);
145+
await Entity.execSql('DELETE FROM comment WHERE plugin_id = ?', [row.id], this);
146+
await Entity.execSql('DELETE FROM download WHERE plugin_id = ?', [row.id], this);
147+
await Entity.execSql('DELETE FROM purchase_order WHERE plugin_id = ?', [row.id], this);
147148

148149
return super.delete(where, operator);
149150
}
@@ -163,7 +164,7 @@ class Plugin extends Entity {
163164
) u
164165
left join payment_method p on u.id = p.user_id and p.is_default = true`;
165166

166-
return Entity.execSql(sql);
167+
return Entity.execSql(sql, [], this);
167168
}
168169

169170
get minColumns() {

0 commit comments

Comments
 (0)