2021-06-10 09:57:13 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
2021-06-11 03:59:27 -05:00
|
|
|
* Class to build video attributes/join names we want to fetch from the database
|
2021-06-10 09:57:13 -05:00
|
|
|
*
|
|
|
|
*/
|
2021-06-11 03:59:27 -05:00
|
|
|
export class VideoTables {
|
2021-06-10 07:43:55 -05:00
|
|
|
|
|
|
|
constructor (readonly mode: 'get' | 'list') {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-06-11 07:09:33 -05:00
|
|
|
getChannelAttributesForUser () {
|
|
|
|
return [ 'id', 'accountId' ]
|
|
|
|
}
|
|
|
|
|
2021-06-10 07:43:55 -05:00
|
|
|
getChannelAttributes () {
|
|
|
|
let attributeKeys = [
|
|
|
|
'id',
|
|
|
|
'name',
|
|
|
|
'description',
|
|
|
|
'actorId'
|
|
|
|
]
|
|
|
|
|
|
|
|
if (this.mode === 'get') {
|
|
|
|
attributeKeys = attributeKeys.concat([
|
|
|
|
'support',
|
|
|
|
'createdAt',
|
|
|
|
'updatedAt'
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
|
|
|
return attributeKeys
|
|
|
|
}
|
|
|
|
|
2021-06-11 07:09:33 -05:00
|
|
|
getUserAccountAttributes () {
|
|
|
|
return [ 'id', 'userId' ]
|
|
|
|
}
|
|
|
|
|
2021-06-10 07:43:55 -05:00
|
|
|
getAccountAttributes () {
|
|
|
|
let attributeKeys = [ 'id', 'name', 'actorId' ]
|
|
|
|
|
|
|
|
if (this.mode === 'get') {
|
|
|
|
attributeKeys = attributeKeys.concat([
|
|
|
|
'description',
|
2021-06-11 08:53:52 -05:00
|
|
|
'userId',
|
2021-06-10 07:43:55 -05:00
|
|
|
'createdAt',
|
|
|
|
'updatedAt'
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
|
|
|
return attributeKeys
|
|
|
|
}
|
|
|
|
|
|
|
|
getThumbnailAttributes () {
|
|
|
|
let attributeKeys = [ 'id', 'type', 'filename' ]
|
|
|
|
|
|
|
|
if (this.mode === 'get') {
|
|
|
|
attributeKeys = attributeKeys.concat([
|
|
|
|
'height',
|
|
|
|
'width',
|
|
|
|
'fileUrl',
|
|
|
|
'automaticallyGenerated',
|
|
|
|
'videoId',
|
|
|
|
'videoPlaylistId',
|
|
|
|
'createdAt',
|
|
|
|
'updatedAt'
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
|
|
|
return attributeKeys
|
|
|
|
}
|
|
|
|
|
|
|
|
getFileAttributes () {
|
|
|
|
return [
|
|
|
|
'id',
|
|
|
|
'createdAt',
|
|
|
|
'updatedAt',
|
|
|
|
'resolution',
|
|
|
|
'size',
|
|
|
|
'extname',
|
|
|
|
'filename',
|
|
|
|
'fileUrl',
|
|
|
|
'torrentFilename',
|
|
|
|
'torrentUrl',
|
|
|
|
'infoHash',
|
|
|
|
'fps',
|
|
|
|
'metadataUrl',
|
|
|
|
'videoStreamingPlaylistId',
|
|
|
|
'videoId'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
getStreamingPlaylistAttributes () {
|
|
|
|
let playlistKeys = [ 'id', 'playlistUrl', 'type' ]
|
|
|
|
|
|
|
|
if (this.mode === 'get') {
|
|
|
|
playlistKeys = playlistKeys.concat([
|
|
|
|
'p2pMediaLoaderInfohashes',
|
|
|
|
'p2pMediaLoaderPeerVersion',
|
|
|
|
'segmentsSha256Url',
|
|
|
|
'videoId',
|
|
|
|
'createdAt',
|
|
|
|
'updatedAt'
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
|
|
|
return playlistKeys
|
|
|
|
}
|
|
|
|
|
|
|
|
getUserHistoryAttributes () {
|
|
|
|
return [ 'id', 'currentTime' ]
|
|
|
|
}
|
|
|
|
|
|
|
|
getPlaylistAttributes () {
|
|
|
|
return [
|
|
|
|
'createdAt',
|
|
|
|
'updatedAt',
|
|
|
|
'url',
|
|
|
|
'position',
|
|
|
|
'startTimestamp',
|
|
|
|
'stopTimestamp',
|
|
|
|
'videoPlaylistId'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
getTagAttributes () {
|
|
|
|
return [ 'id', 'name' ]
|
|
|
|
}
|
|
|
|
|
|
|
|
getVideoTagAttributes () {
|
|
|
|
return [ 'videoId', 'tagId', 'createdAt', 'updatedAt' ]
|
|
|
|
}
|
|
|
|
|
|
|
|
getBlacklistedAttributes () {
|
|
|
|
return [ 'id', 'reason', 'unfederated' ]
|
|
|
|
}
|
|
|
|
|
|
|
|
getScheduleUpdateAttributes () {
|
|
|
|
return [
|
|
|
|
'id',
|
|
|
|
'updateAt',
|
|
|
|
'privacy',
|
|
|
|
'videoId',
|
|
|
|
'createdAt',
|
|
|
|
'updatedAt'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
getLiveAttributes () {
|
|
|
|
return [
|
|
|
|
'id',
|
|
|
|
'streamKey',
|
|
|
|
'saveReplay',
|
|
|
|
'permanentLive',
|
|
|
|
'videoId',
|
|
|
|
'createdAt',
|
|
|
|
'updatedAt'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
getTrackerAttributes () {
|
|
|
|
return [ 'id', 'url' ]
|
|
|
|
}
|
|
|
|
|
|
|
|
getVideoTrackerAttributes () {
|
|
|
|
return [
|
|
|
|
'videoId',
|
|
|
|
'trackerId',
|
|
|
|
'createdAt',
|
|
|
|
'updatedAt'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
getRedundancyAttributes () {
|
|
|
|
return [ 'id', 'fileUrl' ]
|
|
|
|
}
|
|
|
|
|
|
|
|
getActorAttributes () {
|
|
|
|
let attributeKeys = [
|
|
|
|
'id',
|
|
|
|
'preferredUsername',
|
|
|
|
'url',
|
|
|
|
'serverId',
|
|
|
|
'avatarId'
|
|
|
|
]
|
|
|
|
|
|
|
|
if (this.mode === 'get') {
|
|
|
|
attributeKeys = attributeKeys.concat([
|
|
|
|
'type',
|
|
|
|
'followersCount',
|
|
|
|
'followingCount',
|
|
|
|
'inboxUrl',
|
|
|
|
'outboxUrl',
|
|
|
|
'sharedInboxUrl',
|
|
|
|
'followersUrl',
|
|
|
|
'followingUrl',
|
|
|
|
'remoteCreatedAt',
|
|
|
|
'createdAt',
|
|
|
|
'updatedAt'
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
|
|
|
return attributeKeys
|
|
|
|
}
|
|
|
|
|
|
|
|
getAvatarAttributes () {
|
|
|
|
let attributeKeys = [
|
|
|
|
'id',
|
|
|
|
'filename',
|
2021-06-11 03:59:27 -05:00
|
|
|
'type',
|
2021-06-10 07:43:55 -05:00
|
|
|
'fileUrl',
|
|
|
|
'onDisk',
|
|
|
|
'createdAt',
|
|
|
|
'updatedAt'
|
|
|
|
]
|
|
|
|
|
|
|
|
if (this.mode === 'get') {
|
|
|
|
attributeKeys = attributeKeys.concat([
|
|
|
|
'height',
|
|
|
|
'width',
|
|
|
|
'type'
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
|
|
|
return attributeKeys
|
|
|
|
}
|
|
|
|
|
|
|
|
getServerAttributes () {
|
|
|
|
return [ 'id', 'host' ]
|
|
|
|
}
|
|
|
|
|
|
|
|
getVideoAttributes () {
|
|
|
|
return [
|
|
|
|
'id',
|
|
|
|
'uuid',
|
|
|
|
'name',
|
|
|
|
'category',
|
|
|
|
'licence',
|
|
|
|
'language',
|
|
|
|
'privacy',
|
|
|
|
'nsfw',
|
|
|
|
'description',
|
|
|
|
'support',
|
|
|
|
'duration',
|
|
|
|
'views',
|
|
|
|
'likes',
|
|
|
|
'dislikes',
|
|
|
|
'remote',
|
|
|
|
'isLive',
|
|
|
|
'url',
|
|
|
|
'commentsEnabled',
|
|
|
|
'downloadEnabled',
|
|
|
|
'waitTranscoding',
|
|
|
|
'state',
|
|
|
|
'publishedAt',
|
|
|
|
'originallyPublishedAt',
|
|
|
|
'channelId',
|
|
|
|
'createdAt',
|
|
|
|
'updatedAt'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|