From aa3796bda5a6776e0d21048239f25d385a8e7545 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 25 Jul 2019 11:15:03 +0200 Subject: [PATCH] Sort on videoQuotaUsed in backend --- server/initializers/constants.ts | 2 +- server/models/utils.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 5329d5fab..40f86a30d 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -39,7 +39,7 @@ const WEBSERVER = { // Sortable columns per schema const SORTABLE_COLUMNS = { - USERS: [ 'id', 'username', 'createdAt' ], + USERS: [ 'id', 'username', 'videoQuotaUsed', 'createdAt' ], USER_SUBSCRIPTIONS: [ 'id', 'createdAt' ], ACCOUNTS: [ 'createdAt' ], JOBS: [ 'createdAt' ], diff --git a/server/models/utils.ts b/server/models/utils.ts index 206e108c3..30de91e1d 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts @@ -13,6 +13,8 @@ function getSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderIt if (field.toLowerCase() === 'match') { // Search finalField = Sequelize.col('similarity') + } else if (field === 'videoQuotaUsed') { // Users list + finalField = Sequelize.col('videoQuotaUsed') } else { finalField = field } -- 2.25.1