+ return ActorModel.unscoped().findByPk(id)
+ }
+
+ static loadAccountActorByVideoId (videoId: number, transaction: Sequelize.Transaction) {
+ const query = {
+ include: [
+ {
+ attributes: [ 'id' ],
+ model: AccountModel.unscoped(),
+ required: true,
+ include: [
+ {
+ attributes: [ 'id' ],
+ model: VideoChannelModel.unscoped(),
+ required: true,
+ include: [
+ {
+ attributes: [ 'id' ],
+ model: VideoModel.unscoped(),
+ required: true,
+ where: {
+ id: videoId
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ transaction
+ }
+
+ return ActorModel.unscoped().findOne(query)
+ }
+
+ static isActorUrlExist (url: string) {
+ const query = {
+ raw: true,
+ where: {
+ url
+ }
+ }
+
+ return ActorModel.unscoped().findOne(query)
+ .then(a => !!a)