Use hook inside the transaction

To prevent serialization issue
pull/5739/head
Chocobozzz 2023-03-31 13:28:41 +02:00
parent 05a60d8599
commit bb7e5605d1
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import { Transaction } from 'sequelize'
import {
BeforeDestroy,
AllowNull,
BeforeDestroy,
BelongsTo,
Column,
CreatedAt,
@ -100,11 +101,12 @@ export class VideoLiveModel extends Model<Partial<AttributesOnly<VideoLiveModel>
ReplaySetting: VideoLiveReplaySettingModel
@BeforeDestroy
static deleteReplaySetting (instance: VideoLiveModel) {
static deleteReplaySetting (instance: VideoLiveModel, options: { transaction: Transaction }) {
return VideoLiveReplaySettingModel.destroy({
where: {
id: instance.replaySettingId
}
},
transaction: options.transaction
})
}