- static loadWithRights (id: number | string, t?: Transaction): Promise<MVideoWithRights> {
- const where = buildWhereIdOrUUID(id)
- const options = {
- where,
- transaction: t
- }
-
- return VideoModel.scope([
- ScopeNames.WITH_BLACKLISTED,
- ScopeNames.WITH_USER_ID
- ]).findOne(options)
- }
-
- static loadOnlyId (id: number | string, t?: Transaction): Promise<MVideoIdThumbnail> {
- const where = buildWhereIdOrUUID(id)
-
- const options = {
- attributes: [ 'id' ],
- where,
- transaction: t
- }
-
- return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(options)
- }
-
- static loadWithFiles (id: number | string, t?: Transaction, logging?: boolean): Promise<MVideoWithAllFiles> {
- const where = buildWhereIdOrUUID(id)
-
- const query = {
- where,
- transaction: t,
- logging
- }
-
- return VideoModel.scope([
- ScopeNames.WITH_WEBTORRENT_FILES,
- ScopeNames.WITH_STREAMING_PLAYLISTS,
- ScopeNames.WITH_THUMBNAILS
- ]).findOne(query)
- }
-
- static loadByUUID (uuid: string): Promise<MVideoThumbnail> {
- const options = {
- where: {
- uuid
- }
- }
-
- return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(options)
- }
-
- static loadByUrl (url: string, transaction?: Transaction): Promise<MVideoThumbnail> {
- const query: FindOptions = {
- where: {
- url
- },
- transaction
- }
-
- return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(query)
- }
-