// ---------------------------------------------------------------------------
module.exports = function (sequelize, DataTypes) {
- // TODO: add indexes on searchable columns
const Video = sequelize.define('Video',
{
id: {
function (callback) {
const params = {
- name: video.name,
remoteId: video.id
}
through: models.VideoTag,
onDelete: 'cascade'
})
+
+ this.hasMany(models.VideoAbuse, {
+ foreignKey: {
+ name: 'videoId',
+ allowNull: false
+ },
+ onDelete: 'cascade'
+ })
}
function generateMagnetUri () {
duration: this.duration,
tags: map(this.Tags, 'name'),
thumbnailPath: constants.STATIC_PATHS.THUMBNAILS + '/' + this.getThumbnailName(),
- createdAt: this.createdAt
+ createdAt: this.createdAt,
+ updatedAt: this.updatedAt
}
return json
thumbnailData: thumbnailData.toString('binary'),
tags: map(self.Tags, 'name'),
createdAt: self.createdAt,
+ updatedAt: self.updatedAt,
extname: self.extname
}
duration: this.duration,
tags: map(this.Tags, 'name'),
createdAt: this.createdAt,
+ updatedAt: this.updatedAt,
extname: this.extname
}