import { literal, Op, QueryTypes, Transaction } from 'sequelize'
import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
+import { AttributesOnly } from '@shared/typescript-utils'
import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
import { MActorDefault } from '../../types/models'
}
]
})
-export class VideoShareModel extends Model {
+export class VideoShareModel extends Model<Partial<AttributesOnly<VideoShareModel>>> {
@AllowNull(false)
@Is('VideoShareUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
transaction: t
}
- return VideoShareModel.findAndCountAll(query)
+ return Promise.all([
+ VideoShareModel.count(query),
+ VideoShareModel.findAll(query)
+ ]).then(([ total, data ]) => ({ total, data }))
}
static listRemoteShareUrlsOfLocalVideos () {