isVideoDurationValid,
isVideoLanguageValid,
isVideoLicenceValid,
- isVideoNameValid,
+ isVideoNameValid, isVideoOriginallyPublishedAtValid,
isVideoPrivacyValid,
isVideoStateValid,
isVideoSupportValid
{ fields: [ 'duration' ] },
{ fields: [ 'views' ] },
{ fields: [ 'channelId' ] },
+ {
+ fields: [ 'originallyPublishedAt' ],
+ where: {
+ originallyPublishedAt: {
+ [Sequelize.Op.ne]: null
+ }
+ }
+ },
{
fields: [ 'category' ], // We don't care videos with an unknown category
where: {
@Column
commentsEnabled: boolean
+ @AllowNull(false)
+ @Column
+ downloadEnabled: boolean
+
@AllowNull(false)
@Column
waitTranscoding: boolean
@Column
publishedAt: Date
+ @AllowNull(true)
+ @Default(null)
+ @Column
+ originallyPublishedAt: Date
+
@ForeignKey(() => VideoChannelModel)
@Column
channelId: number
sort?: string
startDate?: string // ISO 8601
endDate?: string // ISO 8601
+ originallyPublishedStartDate?: string
+ originallyPublishedEndDate?: string
nsfw?: boolean
categoryOneOf?: number[]
licenceOneOf?: number[]
whereAnd.push({ publishedAt: publishedAtRange })
}
+ if (options.originallyPublishedStartDate || options.originallyPublishedEndDate) {
+ const originallyPublishedAtRange = {}
+
+ if (options.originallyPublishedStartDate) originallyPublishedAtRange[ Sequelize.Op.gte ] = options.originallyPublishedStartDate
+ if (options.originallyPublishedEndDate) originallyPublishedAtRange[ Sequelize.Op.lte ] = options.originallyPublishedEndDate
+
+ whereAnd.push({ originallyPublishedAt: originallyPublishedAtRange })
+ }
+
if (options.durationMin || options.durationMax) {
const durationRange = {}
static loadWithFiles (id: number, t?: Sequelize.Transaction, logging?: boolean) {
return VideoModel.scope([ ScopeNames.WITH_FILES, ScopeNames.WITH_STREAMING_PLAYLISTS ])
- .findById(id, { transaction: t, logging })
+ .findByPk(id, { transaction: t, logging })
}
static loadByUUIDWithFile (uuid: string) {