this.sequelize.models.Tag
],
- where: {
- id: { $notIn: this.sequelize.literal(
- '(SELECT "BlacklistedVideos"."videoId" FROM "BlacklistedVideos")'
- )}
- }
+ where: createBaseVideosWhere.call(this)
}
return this.findAndCountAll(query).asCallback(function (err, result) {
}
const query = {
- where: {
- id: { $notIn: this.sequelize.literal(
- '(SELECT "BlacklistedVideos"."videoId" FROM "BlacklistedVideos")'
- )}
- },
+ where: createBaseVideosWhere.call(this),
offset: start,
limit: count,
distinct: true, // For the count, a video can have many tags
// ---------------------------------------------------------------------------
+function createBaseVideosWhere () {
+ return {
+ id: {
+ $notIn: this.sequelize.literal(
+ '(SELECT "BlacklistedVideos"."videoId" FROM "BlacklistedVideos")'
+ )
+ }
+ }
+}
+
function removeThumbnail (video, callback) {
const thumbnailPath = pathUtils.join(constants.CONFIG.STORAGE.THUMBNAILS_DIR, video.getThumbnailName())
fs.unlink(thumbnailPath, callback)