import { VideoModel } from './video'
import * as Sequelize from 'sequelize'
import { VideoRedundancyModel } from '../redundancy/video-redundancy'
+import { VideoStreamingPlaylistModel } from './video-streaming-playlist'
@Table({
tableName: 'videoFile',
]
}
- return VideoFileModel.findById(id, options)
+ return VideoFileModel.findByPk(id, options)
+ }
+
+ static listByStreamingPlaylist (streamingPlaylistId: number, transaction: Sequelize.Transaction) {
+ const query = {
+ include: [
+ {
+ model: VideoModel.unscoped(),
+ required: true,
+ include: [
+ {
+ model: VideoStreamingPlaylistModel.unscoped(),
+ required: true,
+ where: {
+ id: streamingPlaylistId
+ }
+ }
+ ]
+ }
+ ],
+ transaction
+ }
+
+ return VideoFileModel.findAll(query)
}
static async getStats () {