]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/models/user-video-rate.js
8 const values
= require('lodash/values')
10 const constants
= require('../initializers/constants')
12 // ---------------------------------------------------------------------------
14 module
.exports = function (sequelize
, DataTypes
) {
15 const UserVideoRate
= sequelize
.define('UserVideoRate',
18 type: DataTypes
.ENUM(values(constants
.VIDEO_RATE_TYPES
)),
25 fields: [ 'videoId', 'userId', 'type' ],
40 // ------------------------------ STATICS ------------------------------
42 function associate (models
) {
43 this.belongsTo(models
.Video
, {
51 this.belongsTo(models
.User
, {
60 function load (userId
, videoId
, transaction
, callback
) {
62 callback
= transaction
74 if (transaction
) options
.transaction
= transaction
76 return this.findOne(query
, options
).asCallback(callback
)