if (res === false) throw new Error('Video duration is not valid.')
}
}
+ },
+ views: {
+ type: DataTypes.INTEGER,
+ allowNull: false,
+ defaultValue: 0,
+ validate: {
+ min: 0,
+ isInt: true
+ }
}
},
{
},
{
fields: [ 'infoHash' ]
+ },
+ {
+ fields: [ 'views' ]
}
],
classMethods: {
magnetUri: this.generateMagnetUri(),
author: this.Author.name,
duration: this.duration,
+ views: this.views,
tags: map(this.Tags, 'name'),
thumbnailPath: pathUtils.join(constants.STATIC_PATHS.THUMBNAILS, this.getThumbnailName()),
createdAt: this.createdAt,
}
function list (callback) {
- return this.find().asCallback()
+ return this.findAll().asCallback(callback)
}
function listForApi (start, count, sort, callback) {