]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/constants.js
Allow to sort by likes
[github/Chocobozzz/PeerTube.git] / server / initializers / constants.js
index b99186e13714e2aed4922b6dbcb6aff49f20bc06..f9247e9450cab909e9b85669e83ccc2df54c69ea 100644 (file)
@@ -5,7 +5,7 @@ const path = require('path')
 
 // ---------------------------------------------------------------------------
 
-const LAST_MIGRATION_VERSION = 15
+const LAST_MIGRATION_VERSION = 25
 
 // ---------------------------------------------------------------------------
 
@@ -22,9 +22,9 @@ const SEARCHABLE_COLUMNS = {
 
 // Sortable columns per schema
 const SORTABLE_COLUMNS = {
-  USERS: [ 'id', '-id', 'username', '-username', 'createdAt', '-createdAt' ],
-  VIDEO_ABUSES: [ 'id', '-id', 'createdAt', '-createdAt' ],
-  VIDEOS: [ 'name', '-name', 'duration', '-duration', 'createdAt', '-createdAt', 'views', '-views' ]
+  USERS: [ 'id', 'username', 'createdAt' ],
+  VIDEO_ABUSES: [ 'id', 'createdAt' ],
+  VIDEOS: [ 'name', 'duration', 'createdAt', 'views', 'likes' ]
 }
 
 const OAUTH_LIFETIME = {
@@ -95,6 +95,11 @@ const CONSTRAINTS_FIELDS = {
   }
 }
 
+const VIDEO_RATE_TYPES = {
+  LIKE: 'like',
+  DISLIKE: 'dislike'
+}
+
 // ---------------------------------------------------------------------------
 
 // Score a pod has when we create it as a friend
@@ -134,10 +139,9 @@ const REQUESTS_VIDEO_EVENT_LIMIT_PER_POD = 50
 const RETRY_REQUESTS = 5
 
 const REQUEST_ENDPOINTS = {
-  VIDEOS: 'videos',
-  QADU: 'videos/qadu',
-  EVENT: 'videos/events'
+  VIDEOS: 'videos'
 }
+
 const REQUEST_ENDPOINT_ACTIONS = {}
 REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] = {
   ADD: 'add',
@@ -146,6 +150,9 @@ REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] = {
   REPORT_ABUSE: 'report-abuse'
 }
 
+const REQUEST_VIDEO_QADU_ENDPOINT = 'videos/qadu'
+const REQUEST_VIDEO_EVENT_ENDPOINT = 'videos/events'
+
 const REQUEST_VIDEO_QADU_TYPES = {
   LIKES: 'likes',
   DISLIKES: 'dislikes',
@@ -227,16 +234,18 @@ module.exports = {
   REMOTE_SCHEME,
   REQUEST_ENDPOINT_ACTIONS,
   REQUEST_ENDPOINTS,
+  REQUEST_VIDEO_EVENT_ENDPOINT,
   REQUEST_VIDEO_EVENT_TYPES,
+  REQUEST_VIDEO_QADU_ENDPOINT,
   REQUEST_VIDEO_QADU_TYPES,
   REQUESTS_IN_PARALLEL,
   REQUESTS_INTERVAL,
   REQUESTS_LIMIT_PER_POD,
   REQUESTS_LIMIT_PODS,
-  REQUESTS_VIDEO_QADU_LIMIT_PER_POD,
-  REQUESTS_VIDEO_QADU_LIMIT_PODS,
   REQUESTS_VIDEO_EVENT_LIMIT_PER_POD,
   REQUESTS_VIDEO_EVENT_LIMIT_PODS,
+  REQUESTS_VIDEO_QADU_LIMIT_PER_POD,
+  REQUESTS_VIDEO_QADU_LIMIT_PODS,
   RETRY_REQUESTS,
   SEARCHABLE_COLUMNS,
   SIGNATURE_ALGORITHM,
@@ -245,7 +254,8 @@ module.exports = {
   STATIC_MAX_AGE,
   STATIC_PATHS,
   THUMBNAILS_SIZE,
-  USER_ROLES
+  USER_ROLES,
+  VIDEO_RATE_TYPES
 }
 
 // ---------------------------------------------------------------------------