|
|
@ -1260,12 +1260,13 @@ class BaseModelSqlv2 { |
|
|
|
|
|
|
|
|
|
|
|
async delByPk(id, trx?, cookie?) { |
|
|
|
async delByPk(id, trx?, cookie?) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
// retrieve data for handling paramas in hook
|
|
|
|
|
|
|
|
const data = await this.readByPk(id); |
|
|
|
await this.beforeDelete(id, trx, cookie); |
|
|
|
await this.beforeDelete(id, trx, cookie); |
|
|
|
|
|
|
|
|
|
|
|
const response = await this.dbDriver(this.tnPath) |
|
|
|
const response = await this.dbDriver(this.tnPath) |
|
|
|
.del() |
|
|
|
.del() |
|
|
|
.where(await this._wherePk(id)); |
|
|
|
.where(await this._wherePk(id)); |
|
|
|
await this.afterDelete(response, trx, cookie); |
|
|
|
await this.afterDelete(data, trx, cookie); |
|
|
|
return response; |
|
|
|
return response; |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
console.log(e); |
|
|
|
console.log(e); |
|
|
|