mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Use hook inside the transaction
To prevent serialization issue
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user